I have a master POM for all projects. The POM contains the following SCM part:
<groupId>com.company</groupId>
<artifactId>master</artifactId>
<version>...</version>
<packaging>pom</packaging>
<scm>
<connection>scm:git:https://[email protected]/scm/${scm.repository.name}/${scm.project.name}.git</connection>
<developerConnection>scm:git:https://[email protected]/scm/${scm.repository.name}/${scm.project.name}.git</developerConnection>
<url>https://bitbucket.server.de/scm/${scm.repository.name}/${scm.project.name}.git</url>
<tag>HEAD</tag>
</scm>
<properties>
<project.scm.id>bitbucket-scm</project.scm.id>
<scm.project.name>maven-master</scm.project.name>
<scm.repository.name>tsu</scm.repository.name>
</properties>
Now, I have a maven multi module project, this is the parent POM:
<parent>
<groupId>com.company</groupId>
<artifactId>master</artifactId>
<version>...</version>
</parent>
<groupId>com.company.group</groupId>
<artifactId>project-foo</artifactId>
<version>...</version>
<packaging>jar</packaging>
<name>project FOO</name>
<properties>
<scm.project.name>project-foo</scm.project.name>
</properties>
When executing the release plugin to release the master POM (first snippet), it works fine. However, when executing the release plugin to release the multi module project (second snippet), it fails, saying:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project project-foo: Unable to commit files [ERROR] Provider message: [ERROR] The git-push command failed. [ERROR] Command output: [ERROR] fatal: remote error: Repository not found [ERROR] The requested repository does not exist, or you do not have permission to [ERROR] access it.
In the logs, I can also see the repository URL.
For the working release of the Master POM, it uses
https://user:********@bitbucket.server.de/scm/tsu/maven-master.git refs/heads/dev:refs/heads/dev
For the non-working release of the multi-module project, it uses
https://user:********@bitbucket.server.de/scm/tsu/project-foo.git/project-foo refs/heads/dev:refs/heads/dev
It seems to append the artifact-ID of the project to the URL when releasing the multi-module project.
When copying the entire SCM section to the multi-module project and modifying it, it works. However, I only want to interpolate a single property in the master POM to avoid having to copy the SCM tags to every project.
Any help to fix this issue is appreciated.
The main aim of the maven-release plugin is to provide a standard mechanism to release project artifacts outside the immediate development team. The plugin provides basic functionality to create a release and to update the project's SCM accordingly.
The SCM Plugin offers vendor independent access to common scm commands by offering a set of command mappings for the configured scm. Each command is implemented as a goal.
Assuming that SCM has been configured in the pom. xml and the project directory is managed by a SCM, invoking the checkin goal in the scm will start the commit process for all configured sources in your pom. xml. The files should be added beforehand by an external scm client.
release:perform will fork a new Maven instance to build the checked-out project. This new Maven instance will use the same system configuration and Maven profiles used by the one running the release:perform goal.
Since Maven 3.6.1 you can set the following in the pom parent :
<scm child.scm.connection.inherit.append.path="false"
child.scm.developerConnection.inherit.append.path="false"
child.scm.url.inherit.append.path="false">
<connection>scm:git:https://[email protected]/scm/${scm.repository.name}/${scm.project.name}.git</connection>
<developerConnection>scm:git:https://[email protected]/scm/${scm.repository.name}/${scm.project.name}.git</developerConnection>
<url>https://bitbucket.server.de/scm/${scm.repository.name}/${scm.project.name}.git</url>
<tag>HEAD</tag>
</scm>
You have to redefine the scm in the children poms :
<scm child.scm.connection.inherit.append.path="false"
child.scm.developerConnection.inherit.append.path="false"
child.scm.url.inherit.append.path="false">
<connection>scm:git:https://[email protected]/scm/${scm.repository.name}/${scm.project.name}.git</connection>
<developerConnection>scm:git:https://[email protected]/scm/${scm.repository.name}/${scm.project.name}.git</developerConnection>
<url>https://bitbucket.server.de/scm/${scm.repository.name}/${scm.project.name}.git</url>
<tag>HEAD</tag>
</scm>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With