Reputation: 3
I have a Ear, war and 2 jar projects in my eclipse. I want to automatically build 2 jars, war and ear project, when i run the pom inside ear project.
I remember doing this in maven in the past. But i forgot since i lost touch working with Maven for few years now.
Someone please remind me of that..
I used dependency compile, but it is not building jar, when i build the ear directly. Should i first run pom in jar? does it not build that jar automatically when i build ear?
Upvotes: 0
Views: 329
Reputation: 29912
Create a multi module build that will build it all for you in the reactor. Read more about it e.g. http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html#pom-relationships-sect-multi-vs-inherit
Upvotes: 1
Reputation: 61538
I guess you should define tha .jar
and .war
projects as dependencies of your .ear
project. It is also advisable to have a parent pom
, where all the projects are defined as modules, including the .ear
project.
In this book you can find a well explained step-by-step setup of a maven multimodule project (with downloadable code).
There is also a great working example of an enterprise multimodule project in the JBoss quickstart examples.
Upvotes: 0