Maven release with jenkins slave and Credentials : how to pass SCM credentials to maven? Maven release with jenkins slave and Credentials : how to pass SCM credentials to maven? jenkins jenkins

Maven release with jenkins slave and Credentials : how to pass SCM credentials to maven?


Spent all morning trying to figure this out, then spot the "SSH Agent" tick box on the "Build environment" section. Tick it, and give the right credential and it works.I considered deleting the question, but after reading lots of other high maintenance suggestions (involving copies of the .pem file) I thought I'd leave it.


To make this work with github repos I had to install the SSH Agent (like @P_W999 suggested) and add the following configuration to my pom.xml:

[...]<build>    <plugins>        [...]        <plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-release-plugin</artifactId>            <version>2.5.3</version>            <configuration>                <tagNameFormat>v@{project.version}</tagNameFormat>                <checkModificationExcludes>                    <checkModificationExclude>pom.xml</checkModificationExclude>                </checkModificationExcludes>            </configuration>        </plugin>        [...]    </plugins></build><scm>    <connection>scm:git:ssh://git@github.com/${mygithubusername}/${mygithubreponame}.git</connection>    <developerConnection>scm:git:ssh://git@github.com/${mygithubusername}/${mygithubreponame}.git</developerConnection>    <url>https://github.com/${mygithubusername}/${mygithubreponame}.git</url>    <tag>v@{project.version}</tag></scm>[...]