Question

I have multiple projects that depends on the same data model. The latter is defined by a Maven project. Let's take as example two composite projects A and B that include multiple modules each one and that depend on this data model. The project A and B are not related.

What is the best approach in this case? To leave the data model as an independent project with A and B depending on it? Or, to define the data model as a module and to include it in the two composite projects A and B (I don't know if a module may be shared by many projects)?

Thanks

Was it helpful?

Solution

The "maven way", especially since projects A and B are unrelated, would be to create a 3rd project for the shared code. It would have its own artifact id and version (separate from A and B).

When I do this I use the maven-release-plugin to tag it and deploy it to my Maven repository server (Nexus). If you aren't working this way you can manually build it and it will go in your local repository. When you build the other projects it will resolve.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top