Issue with git-push, Maven Release Plugin, and authentication between pom and settings.xml file

44 Views Asked by At

I'm having an issue with authentication for maven release plugin that I've been dealing with for a bit. I'm trying to hide credentials by putting them in the settings.xml file, but it fails to authenticate after versioning and pushing back to the repo.

The documentation has stated to put the following:

> <properties>   
<project.scm.id>azure</project.scm.id> 
</properties>

However, I have tried this by putting it before the release plugin, yet have not had any luck... I then tried to put:

azure

within the plugin section as stated in the POM file.

POM file:

        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.0.0-M4</version>
        <configuration>
            <serverId>azure</serverId>
            <url>https://visualstudio.com/repo</url>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <remoteTagging>false</remoteTagging>
            <suppressCommitBeforeTag>false</suppressCommitBeforeTag>
            <tagNameFormat>@{project.version}</tagNameFormat>
            <preparationGoals>clean package</preparationGoals>
            <goals>deploy</goals>
            <generateReleasePoms>false</generateReleasePoms>
            <releaseProfiles>release</releaseProfiles>
        </configuration>
        </plugin>

I've referenced the "serverID" tag for the settings.xml file which seems to be giving the main issue and causing the authentication to fail.

Settings.xml:

        <server>
            <id>azure</id>
            <username>username</username>
            <password>somepass</password>
        </server>

Error I'm getting from Jenkins:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M4:branch (default-cli) on project parent: Unable to commit files [ERROR] Provider message: [ERROR] The git-push command failed. [ERROR] Command output: [ERROR] fatal: Authentication failed for 'https://.visualstudio.com/repo' [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:

There isn't a ton of documentation on maven release plugin, and I'm not exactly sure how to map an ID from a POM file plugin to a "ID" in settings.xml successfully. Any help is appreciated.

We currently use the settings.xml file for nexus and works. From the logs:

Executing Maven: -B -f /app/servers/jenkins/jobs/app-release-branch-generate-branch2/workspace/pom.xml -Dmaven.repo.local=/app/servers/jenkins/jobs/app-release-branch-generate-branch2/workspace/.repository -s /app/conf/settings.xml release:branch -DupdateBranchVersions=true -DreleaseVersion=test234-RC1-SNAPSHOT -DbranchName=test234 -DdevelopmentVersion=trunk-SNAPSHOT

It is referencing the correct settings.xml location within the log as shown above

0

There are 0 best solutions below