When I run mvn compile
from command line, it builds using pom.xml
. But when I try to run it within Eclipse (by using m2eclipse plugin), when I right click on the pom.xml
and run as maven build, it asks for a goal. I am new to Maven and want to run it through Eclipse. So why doesn't it ask for anything when running from command line? Is there a default goal?
Run a Maven goal from the context menu In the Maven tool window, click Lifecycle to open a list of Maven goals. Right-click the desired goal and from the context menu select Run 'name of the goal'. IntelliJ IDEA runs the specified goal and adds it to the Run Configurations node.
Using Maven with the Eclipse IDEThe Eclipse IDE provides support for the Maven build. This support is developed in the M2Eclipse project. It provides an editor for modifying the pom file and downloads dependencies if required. It also manages the classpath of the projects in the IDE.
Yes, there is a default goal, but what it is depends on the project, and can be explicitly defined.
See the BaseBuild Element Set (the default goal is install
) as well as the rest of that page for further information. IIRC you can define a default goal for m2eclipse, although I haven't used it in some time.
There's also a setting to define a goal to be run when a source directory is updated:
http://www.sonatype.com/books/m2eclipse-book/reference/preferences.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With