Social Icons

twitterfacebookgoogle pluslinkedinrss feed

Wednesday, June 20, 2012

Build Maven Multi Module Project and Run using one Command

When we have maven multi module project, there will be dependency between sub project. Therefor if you need to build all projects need tp navigate to parent directory and run the mvn clean install command.

If we have web based multi module project, currently most people doing is go to parent directory and build the all projects using mvn install or mvn clean install command, after that navigate to web project and start web container.

Ex: Projects are P1(parent project), Core and Web. When we building project go to P1 and build the all subprojects, after that go to web project and start jetty server using mvn jetty:run

But that approach wasting you time little bit and when we doing same thing all the time it will become boring  task to do(build parent and go to child folder and run the server)

For avoid this issue I am going to show how to run web project with out navigate to child project.

following command will help you to run specific project without moving to sub project folder.

mvn -amd clean install -pl WebProject jetty:run-exploded