Search code examples
javaentitymulti-project

Share entities between multi-projects


I have 3 Java projects with the same entities.

I want to share entities between these projects because entities can evolve during the development phase.

We are thinking about building a jar with entities and sharing it using Maven (with a repository).

Maybe you have another solution ?


Solution

  • I also can recommend to use Maven to share code between projects.

    Here are some tips to get started:

    • Use a Maven Repository Manager such as Nexus. It will help you to create a stable development environment.
    • Every developer (also the Continuous Integration Server user) should configure their settings file to use your Maven Repository Manager. Don't specify your repositories in the POMs, confiugre them only in your Maven Repository Manager. http://www.sonatype.com/books/nexus-book/reference/maven-sect-single-group.html
    • Use the dependencyManagement and pluginManagement elements of your parent POMs to specify all versions of the plugins and dependencies you are using. Omit these versions in the other POMs (they will inherit them from the parent POM).
    • I also recommend to use different POMs for multi-module builds and parent POMs.