• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is the best practice to handle multiple module in Maven ?

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day,

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?

Thanks for guidance!
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My advice:

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!
 
Greenhorn
Posts: 24
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

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.

My Approach:
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.

Thanks,
Shiv
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
reply
    Bookmark Topic Watch Topic
  • New Topic