Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run "mvn package" on "Build project" in Eclipse

Tags:

I have maven java project in eclipse. I right click project, choose "Build project" and I want "mvn package" get invoked automatically. Is it possible?

like image 867
Igorock Avatar asked Dec 24 '12 22:12

Igorock


People also ask

How do I run a Maven build in Eclipse?

Building and Running the Maven Project in Eclipse To run the maven project, select it and go to “Run As > Java Application”. In the next window, select the main class to execute. In this case, select the App class and click on the Ok button. You will see the “Hello World” output in the Console window.

How do I run an Maven package?

Rightclick on your pom. xml and choose "Run as" -> "Maven build.." and put in Goals: package . If you now select "run" (CTRL + F11) it will run automatically if you select these run configuration.

How do I build a project using mvn clean package?

Let's open the command console, go the C:\MVN\consumerBanking directory and execute the following mvn command. Maven will start building the project. We give maven two goals, first to clean the target directory (clean) and then package the project build output as jar (package).


1 Answers

Rightclick on your pom.xml and choose "Run as" -> "Maven build.." and put in Goals:package. If you now select "run" (CTRL + F11) it will run automatically if you select these run configuration.

And as Chris said, m2e is required.

like image 149
xoned Avatar answered Nov 28 '22 09:11

xoned