Maven Project Structure
Posted by Mike Haller
on Thursday, February 28. 2008
at 17:00
in Java
My default project set up for Maven-based Java projects:/pom.xmlParent pom for the project. This is in a parent folder, as some CI servers don't like the build to be in a module, e.g. foo-build\pom.xml
/foo-api/API, domain model, common utilities, exceptions, value objects. Best: No dependencies to anything else other than the Java types. Acceptable: Dependencies to very very very common stuff like commons-logging or to a enterprise-wide our-commons.jar
/foo-core/Service implementation. Dependencies: To some components. Best: no other dependencies, esp. not to glue code such as Spring.
/foo-conf/Deployment and Configuration resources, bundles as jar for archiving purposes.
/foo-ejb/Enterprise JavaBeans (SLSB, MDB). This also contains the glue code, e.g. the Spring Application Context and Configuration.
/foo-ear/Enterprise Archive, only necessary for deployment.
/foo-sar/Service Archive, only necessary for JBoss deployments.
/foo-tests/Integration tests, excluded from the parent pom and normal build lifecycle (e.g. using a maven profile), because they need life remote services and databases.
Is your set up similar? If not, let me know your thoughts on why another structure might be more suitable in other situations.

