My project involve two module, there are web module and EJB module. my question are below:
1. What is the best practice to handle multiple module in maven? is there any sample i should refer?
2. If there is EJB module involve in the project, i need to package it into .ear file? .war file will not help in my case, am i right?
3. I'm using eclipse with m2m plugin, should i create a new maven project with "maven-archtype-quickstart" or "maven-archtype-j2ee-simple" or some other archtype to handle above scenario?
1) Do separate Maven projects, one for the EJB JAR, the other for the WAR.
2) Maybe. Which version of Java EE are you targeting? The latest versions let you package EJBs into your WAR. If you still want an EAR, do it as a third Maven project.
3) I never use an archetype but just select "create a simple Maven project" and select the correct packaging type, but I do that mainly because I already have example POMs that I can use (I completely overwrite the generated POM) and I have been too lazy to convert them into archetypes!
I have a smilar situation where-in I have to mavenize an existing ear application that has ejb, web, and one another plain java project for some properties file.
When I looked at the existing ear, it has two jars, one for ejb and one for properties project and one war file.
Now since I am have to mavenize this application. I am totally confused and not able to get to any point.
It would appreciate if your help me with the steps to mavenize this application.
1. create a parent maven project, with build type as POM.
2. create another web project, using maven archtype for .war (it is maven module for parent maven project)
3. create another plain java project again using maven archtype for bundling as .jar.
4. create one last project for ejb to be packaged as .jar
Note: this application will be deployed in Websphere.
I would have four Maven projects - one for the JAR with properties, one for the war, one for the ejbs, and the final for creating the ear. I don't see why you would need a parent pom (or did you mean a master pom?), at least not just for this particular situation. Then I would configure Jenkins to build them in the proper order (that is, rebuild the ear if any of the components get rebuilt).
subject: What is the best practice to handle multiple module in Maven ?