aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven target folder is empty when using Eclipse M2 plugin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven target folder is empty when using Eclipse M2 plugin" Watch "Maven target folder is empty when using Eclipse M2 plugin" New topic
Author

Maven target folder is empty when using Eclipse M2 plugin

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Hi guys : I have a Java project in eclipse that uses Maven (M2) dependency management. I noticed that the Eclipse / M2 plugin (Maven2) has an empty /target folder .... When I noticed this, I started wondering how my project even works if there is nothing in the /target folder !

So to resolve this, I decided to test how a "pure" maven project in eclipse would look.... And so I tried to create a M2 project from a simple archetype, from scratch inside of eclipse, and it ran fine, but the target folder was STILL empty.... I'm quite confused about how the target folder is used by maven in the M2 eclipse plugin... ?
Priyanka Sumanam
Greenhorn

Joined: Aug 17, 2010
Posts: 25
could you please be more specific on your question?
When you said your project using maven dependency management, doesn't that mean you project is already a maven project?
What are you exactly trying to do?
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Well.... My project is a Java project, in the eclipse sense. And I have enabled Maven Dependency Management. I assumed that this would use Maven to also build the project and deploy .jar files to the /target folder. But that did not happen.... So Im confused about how maven, the m2 plugin, and eclipse are interacting.

Priyanka Sumanam
Greenhorn

Joined: Aug 17, 2010
Posts: 25
Sorry to say that life is never so easy my friend.....
Doing so would just enable the maven plugin for your project.You need to do the rest by your self.

Basically ensure you project structure is in the below structure as this is the standard structure for a maven project.

my-app
|-- pom.xml
`-- src
|-- main
| |-- java
| | `-- com
| | `-- mycompany
| | `-- app
| | `-- App.java
| `-- resources
| `-- META-INF
| `-- application.properties
`-- test
`-- java
`-- com
`-- mycompany
`-- app
`-- AppTest.java

copy all your java packages into src/main/java.
Then add your dependencies in pom.xml
Then you need to run maven clean install command to build the final jar into target folder.

I would like to suggest you to give a good reading about this .Below is the link.

http://maven.apache.org/guides/getting-started/index.html
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Okay thanks!
so the eclipse plugin won't automatically accomplish theses tasks?

That seems a little strange..... Given that the u2 menu appears so comprehensive...


In any case that was a very helpfull answer thank a lot.....
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15624
    
  15

Maven can potentially do an IMMENSE amount of work, including running unit tests, checking code into repositories, building javadocs, installing products into the Maven repository, building a support website, and so forth all in a singleMaven operation. You don't want a minor code change to lock up your machine for half an hour just because a Maven rebuild kicked itself off. And actually, given the fact that Maven projects typically support a wide range of goals, it would be hard to figure out which goal it should choose to run automatically.

It isn't just Maven that has to be run manually by the user. Ant builds work that way, too.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven target folder is empty when using Eclipse M2 plugin
 
Similar Threads
maven / web inf
exporting complete WAR bundle after build in M2/eclipse wtp project
Is there a way to create application (ear) project from maven to eclipse?
Publish to maven repository as "latest"
maven configuration for compiling a java project in eclips