Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven goal running from eclipse

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?

like image 667
Sara Avatar asked Jun 10 '12 17:06

Sara


People also ask

How do I run a Maven 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.

Can you use Maven with Eclipse?

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.


1 Answers

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

like image 90
Dave Newton Avatar answered Sep 20 '22 15:09

Dave Newton