Setting up your Maven settings.xml
to release a Jenkins plugin
I'm technically a maintainer for the Jenkins Job DSL Plugin. I say technically because I've not been able to spend as much time on it since picking up maintenance, especially as no longer doing much Jenkins or JVM development. But today I picked up doing a release, and as it's the first time since the excellent refreshed the plugin, migrating it from Gradle to Maven, I'd ended up needing to do a little setup first.
While trying to release, I saw an error like:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy (default-deploy) on project job-dsl-parent: Failed to deploy artifacts: Could not transfer artifact org.jenkins-ci.plugins:job-dsl-parent:pom:... from/to maven.jenkins-ci.org (https://repo.jenkins-ci.org/snapshots/): authentication failed for https://repo.jenkins-ci.org/snapshots/org/jenkins-ci/plugins/job-dsl-parent/1.86-SNAPSHOT/job-dsl-parent-....pom, status: 401 Unauthorized -> [Help 1]
This was because my Maven settings.xml
wasn't configured to push to the Jenkins Maven repository, which required the following in ~/.m2/settings.xml
:
<settings>
<servers>
<server>
<id>maven.jenkins-ci.org</id>
<username>{TODO}</username>
<password>{TODO}</password>
</server>
</servers>
</settings>
These are the credentials you use to log into Jenkins' JIRA or Jenkins.