I'm migrating from Apache Ant + Apache Ivy
to Apache Maven
for the lifecycle management of a new project.
I've never used Maven for official releases, so I'm a total newbie on this.
Currently I have installed and configured Maven 3 and the M2Eclipse Plugin, and I've created a new Struts2 WAR project with The Blank Convention Archetype (struts2-archetype-convention), project that I'm able to deploy to JBoss 7.
After reading tons of articles and StackOverflow answers I've figured out that the first rule of Maven is: one project, one artifact;
Then, to work with an EAR I need three projects: EAR, WAR, EJB; but this answer suggests that I need 4 projects, not three: one EAR, one WAR, one EJB, and one PARENT. I thought that the EJB would be the parent... so the first question is:
- which is the right way ?
And now that I've a working Struts2 WAR, the second question is:
- Which is the best (cleanest, commonly used) way to include my existing WAR in an EAR project (or in a PARENT project, if needed) ?
Creating it manually ? Generating some other ear artifact or Java-EE-webapp artifacts, and then add the dependencies ? Any example of an hypothetical POM.xml needed would be greatly appreciated.