Releasing Multiple Maven Artifacts Using Nested Git Submodules

I searched for a while and did not find a working solution or tutorial / tutorial on releasing Maven modules when using nested Git submodules.

We have a complex structure of public and private projects, which require a specific order for successful development. Our goal is to complete the release of Maven for tags and deploy multiple Maven artifacts in one step.

Here is a simplified Maven project / modules and Git repository structure:

parent-public:1.0.0:pom (descriptor only, no Maven modules, public Git repository) | | | |- public-module:1.0.0-SNAPSHOT:jar | (Maven module, child of parent-public, Git submodule, public repository) | |- parent-private:1.0.0-SNAPSHOT:pom (Maven modules, Git submodule, private repository) | |- public-module:1.0.0-SNAPSHOT:jar | (Maven module only, child of parent-public, Git submodule, public repository, released) | |- private-module:1.0.0-SNAPSHOT:war (Maven module, child of parent-private, released) 

The current structure allows Maven to independently create and deploy projects / modules.

When public-module (from the parent-public / parent-private / public-module directory) the maven-release-plugin works well (the Git repository was tagged and the artifact released was released).

When releasing parent-private , the maven-release-plugin prepares and starts the release before the crash during the target check (this problem is discussed here , but the solution is not working in my context and not enough reputation for comments).

Here is the current maven-release-plugin configuration:

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>2.3.2</version> <configuration> <tagNameFormat>v@{project.version}</tagNameFormat> <commitByProject>true</commitByProject> <pushChanges>true</pushChanges> </configuration> </plugin> 

Is there a more elegant way to organize Maven modules and Git repositories in order to release some Maven artifacts? Alternatively, did someone find a solution to clone recursively Git submodules during validation immediately before deploying artifacts?

+8
git git-submodules maven release maven-release-plugin
source share
1 answer

The answer to this question will not satisfy the initial question, but the Maven Release plugin is not smart enough to understand the boundaries of the git submodule. I think that what you are looking for is an opportunity for the Maven Release plugin to understand that the directory points to a submodule, and for this release plugin to automatically tag borders? This will not happen, and I do not think that it is on any plane at the moment.

What I always recommend for Maven users who use git never breaks the boundaries of the multi-module project that the Release plugin should use through submodules. Store it in one store.

Again, this is not a great answer, but has been using Maven Release Plugin for many years, it’s also true that this is not a great plugin :-(

+5
source share

All Articles