Reputation: 50203
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:
And now that I've a working Struts2 WAR, the second question is:
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.
Upvotes: 3
Views: 871
Reputation: 50203
I ended up using:
JBoss Java EE 6 WebApp Archetype to generate the WebApp, composed by four projects: Parent, EAR, EJB, WAR:
mvn archetype:generate \
-DarchetypeArtifactId=jboss-javaee6-webapp-archetype \
-DarchetypeGroupId=org.jboss.spec.archetypes \
-DarchetypeVersion=7.0.2.CR2
Struts2 Blank Convention Archetype to generate the WAR:
mvn archetype:generate -B -DgroupId=com.mycompany.mysystem \
-DartifactId=myWebApp \
-DarchetypeGroupId=org.apache.struts \
-DarchetypeArtifactId=struts2-archetype-convention \
-DarchetypeVersion=<CURRENT_STRUTS_VERSION> \
-DremoteRepositories=http://struts.apache.org
Then I manually replaced the WAR generated by JBoss with the WAR generated by Struts2.
I guess it is the cleanest way.
Upvotes: 2