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.xml
Parent 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.



Kai Grabfelder
My setup is quite similar: in addition to the VOs the foo-api also contains interfaces. And I don't really see a reason to include configurations as a jarfile in the build - my build is already slow enough ;-)

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications
 
Submitted comments will be subject to moderation before being displayed.
 

About

My name is Mike Haller and I'm a software developer and architect at Bosch Software Innovations in Germany. I love programming, playing games and reading books. I like good food, making photos and learning and mentoring about the craftsmanship of commercial software development. Stack Overflow profile for mhaller

Quicksearch