I'm working on a layered business application written in Java that should be packaged as an EAR file and deployed to a JBoss application server. There's a web-application layer, a service layer, a domain layer but no persistence layer. At least on paper.
What is the best practice for deploying the different layers? In our team we have a little religious war going on between:
- Packaging each layer in its own JAR file (e.g. in its own Maven module), and adding each module to the EAR file, OR
- Bundling everything together in a single JAR file, with each layer mapped to a package naming convention.
Are there other possibilities I'm missing? What are the best practices in this area? Are there any online or offline resources I could consult about this?