One nice feature of maven is the simplicity of mapping multiple completely self-contained projects together. For example, a company was two seperate teams that work on Project A and Project B. Between the two of them they have a set of shared Components.

Project A and Project B can be setup independently of each other, and the Components can be setup as a Project C with its own root pom that builds out all of the components. Developers now have two options, they can maintain two seperate projects of source, one of Project A (or B) and another of Project C. Or they can simply mount the Project C in a subdirectory and reference it as a <module>project-c</module> in the parent pom of Project A and B. The build artifacts of Project C will automatically be factored into the build environment.

a thought

not sure if this is a useful thought or not but..

root project pom: company.poms:project:version
projects pom: company:project:version
subprojects pom: company.project:subproject:version

Since the root pom isn't the same as the core project's pom (where the primary project source is) you can't just refer to the root pom as the company:project:version since that would mean the project itself would have to have some hokey artifact like company:project-core:version or something. So to get away from that and maintain the project pom reference I went with the idea of company.poms:project:version.

I like it since the company has a project and that artifact has that project in it, and all projects at the company can use the company.poms:project setup so all top level root poms are in the same place in the repository.

repo ends up like

company/poms/proja
company/poms/projb
company/poms/shared

company/proja
company/proja/part1
company/proja/part2

company/projb
company/projb/part1
company/projb/part2

company/shared/thingy1
company/shared/thingy2

  • No labels

1 Comment

  1. This is component re-use and I think it would be better to pull the component out into a shared area once it has been identified as re-usable. This would require using the relocation pom stuff.

    Moving the component is better than mounting stuff and gives the projects more control as they pick and choose which components to depend on.