Grouping maven dependencies by project
I have a multi-module project that has various components that follow a fairly standard layout. For instance:
root (pom)
...
module-NN (pom)
module-NN-launcher (jar)
module-NN-runtime (jar)
...
(where there are many modules-NN-projects)
Each * -launcher project uses a proprietary API to launch an environment that provides a common API. * -Runtime projects are then loaded into this structure to "do things".
I currently have launch dependencies defined in each * -launcher / pom.xml. Likewise, I have generic API references in * -runtime / pom.xml. I could update the project structure to be something like:
root (pom)
launcher (pom)
...
module-NN-launcher (jar)
...
runtime (pom)
...
module-NN-runtime (jar)
...
applications (pom)
...
module-NN (pom)
...
And put the appropriate dependencies in the pam.xml files to run / execute, but that makes the project layout less intuitive.
Has anyone faced such a problem before? What advice can you give when creating a meaningful layout without duplicating details in similar projects?
a source to share
I've done something about 90%.
Consider creating a project called "runtime-common". In this pom.xml, add any runtime dependencies that are common to runtime.
In the pom.xml for module-NN-runtime add this
<parent>
<groupId>FOO</groupId>
<artifactId>runtime-common</artifactId>
<version>1.0.0</version>
</parent>
Anything you add to the shared runtime will be added to the child projects for the runtime. This does not affect the ability of the root project to create all modules.
You end up with something like this:
ROOT (POM)
Launcher-COMMON (POM)
...
Launcher-1 (Jar)
...
Runtime-COMMON (POM)
Runtime-1 (Jar)
...
Runtime-2 (Jar)
...
You don't actually need to keep the launcher and runtime in the project if you don't want to be there. In this case, do something like this
ROOT (POM)
COMMON (POM)
Runtime-COMMON (POM)
...
Launcher-COMMON (POM)
...
Launcher-1 (Jar)
...
Runtime-1 (Jar)
...
Runtime-2 (Jar)
...
a source to share