Today, I've been looking at Maven Multi-Module and EAR projects and they seem quite similar in that both seem to define an assembly of a collection of other projects - it almost seems like an EAR project should just be an alternate packaging for a multi-module project.
Have I misunderstood something? Or do these types of project work together?
Following Pascal's answer: Updated to clarify the question, hopefully that will help if it's not easy to understand; sorry it's maybe not phrased very well, the ear stuff is kinda new to me...
So say I have two projects, one producing a war and the other a utility jar. The war depends on the jar and I need to package them up into an ear for deployment. Should I use a project with a pom packaging type? I guess I have to use a project with an ear packaging type somewhere to produce the final artifact, so am I best using just a project with ear packaging, or projects with both pom and ear? If both, how?
EAR projects work just fine as part of a larger aggregated project. In those cases when you do not want to have the EAR be a separate project; you could always create the file via an assembly.
This approach makes sense in some cases. Usually where you have to create multiple versions of the EAR or when you would like to create the deploy a large EAR file but have no need to keep the artifact once created.
I've used this approach to deal with a corporate standard that requires all deployable to be EAR files, even when the app is a single WAR file. An assembly can create the EAR with its single WAR file and deployment descriptors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With