What is the appropriate settings.xml to use these days?

49 views
Skip to first unread message

Mez Pahlan

unread,
Oct 12, 2020, 7:05:57 AM10/12/20
to Jenkins Developers
Hi everyone

I'm getting the following error whilst trying to build a PR branch from a contributor. They've bumped the parent POM version and minimum supported Jenkins version and those changes look fine. However I can't download the new artefacts from this PR which then causes some knock on issues in my IDE.

Could not transfer artifact org.jenkins-ci.main:jenkins-bom:pom:2.222.3 from/to repo.jenkins-ci.org (https://repo.jenkins-ci.org/public/): ~/.m2/repository/org/jenkins-ci/main/jenkins-bom/2.222.3/jenkins-bom-2.222.3.pom.part.lock (No such file or directory)

I started to look at my Maven settings.xml just in case and realised I added that about two years ago and it may be out of date. So to rule that out can anyone share a link of what the settings.xml should contain. I realise it is highly personal to the developer but I only use Maven for Jenkins development if that helps? At the moment I've got:
  • <pluginGroups>
    • <pluginGroup>org.jenkins-ci.tools</pluginGroup>
  • <profiles>
  • <mirrors>
  • <servers>
    • My secrets for plugin publishing
Does that seem sensible? If so I can troubleshoot elsewhere. Thanks.

Mez Pahlan

unread,
Oct 12, 2020, 7:36:32 AM10/12/20
to Jenkins Developers
Haha! It's always the way that you post a question and then figure out the answer straight afterwards!

To update this the error was a genuine permissions issue. I told a small lie above I did once dabble in using Docker and Jenkins on this machine and that messed up the permissions in the .m2 directory and set some folders as being owned by root. I deleted .m2 and started again and I was able to sync dependencies once more.

However I am still curious as to what I should be putting in my settings.xml as the last time I touched it was when I first started Jenkins plugin development and that was years ago.

Jesse Glick

unread,
Oct 12, 2020, 1:19:21 PM10/12/20
to Jenkins Dev
On Mon, Oct 12, 2020 at 7:36 AM Mez Pahlan <mez.p...@gmail.com> wrote:
> I am still curious as to what I should be putting in my settings.xml

You do not really need one at all, as all Jenkins components declare
the Jenkins Artifactory repository.

Daniel Beck

unread,
Oct 12, 2020, 1:55:21 PM10/12/20
to JenkinsCI Developers
Well, credentials to publish, but that's probably about it. Documented at https://www.jenkins.io/doc/developer/publishing/releasing/#artifactory-credentials-for-maven 

Mez Pahlan

unread,
Nov 7, 2020, 10:35:34 AM11/7/20
to Jenkins Developers
Thanks for the pointers!

For anyone else looking as well as the credentials for publishing in my ~/.m2/settings.xml I also needed to add a mirrors section otherwise I started to get weird dependency resolution issues. It looks like this at the moment which is significantly smaller to what I had to start with.

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <mirrors>
    <mirror>
      <mirrorOf>*</mirrorOf>
      <name>public</name>
      <url>https://repo.jenkins-ci.org/public</url>
      <id>public</id>
    </mirror>
  </mirrors>

  <servers>
    <server>
      <id>maven.jenkins-ci.org</id> <!-- For parent 1.397 or newer; this ID is used for historical reasons and independent of the actual host name -->
      <username>username</username>
      <password>encrypted_password</password>
    </server>
  </servers>

</settings>


Without the mirrors section I was getting the following error: Could not find artifact org.jenkins-ci.tools:maven-hpi-plugin:pom in central (https://repo.maven.apache.org/maven2). That plugin is clearly not in the Central repo which lead me down the path trying to understand mirrors when I came across this answer.

I hope this helps someone for the future.

Daniel Beck

unread,
Nov 7, 2020, 12:34:43 PM11/7/20
to JenkinsCI Developers
On Sat, Nov 7, 2020 at 4:35 PM Mez Pahlan <mez.p...@gmail.com> wrote:
Without the mirrors section I was getting the following error: Could not find artifact org.jenkins-ci.tools:maven-hpi-plugin:pom in central (https://repo.maven.apache.org/maven2). That plugin is clearly not in the Central repo which lead me down the path trying to understand mirrors when I came across this answer.

Mez Pahlan

unread,
Nov 7, 2020, 12:50:17 PM11/7/20
to Jenkins Developers
Thanks it does. https://github.com/jenkinsci/appcenter-plugin/blob/master/pom.xml#L229

Maybe there is something interfering in my IDE? Apologies I don't often use Maven so am learning (relearning) a lot of this for the first time.

Reply all
Reply to author
Forward
0 new messages