How to manage maven settings.xml on a shared jenkins server?

51,133

Solution 1

I would recommend using the configuration file plugin, provides a UI to edit one or more Maven settings files.

These settings files can be passed into your Maven build using the "-s" option.

Solution 2

We manage all our build nodes using Puppet. It gives you greater control than just settings.xml. Highly recommended

Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance. Using Puppet, you can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage change, scaling from 10s of servers to 1000s, on-premise or in the cloud.

Solution 3

You can specify for each job in the Maven Advanced Options part a specific seetings.xml path

Solution 4

If your company is using Nexus Pro (as you've already mentioned), then your unique Maven settings.xml can be stored there, and retrieved at build time using the nexus-maven-plugin as described here: http://books.sonatype.com/nexus-book/reference/maven-settings.html

Combined with token-based access (again, Nexus Pro does this), you do not need to store passwords insecurely in the settings.xml (see https://books.sonatype.com/nexus-book/reference/usertoken.html)

Solution 5

I faced the similar issue when building the project with jenkins as ojdbc jar is not available in maven central repository.

It worked when I placed the ojdbc jar in WEB-INF/lib folder and removed the maven dependency in pom.xml.

Share:
51,133
ams
Author by

ams

I love software development.

Updated on December 13, 2020

Comments

  • ams
    ams over 3 years

    I have a Jenkins cluster that is shared by several teams, that I can configure build jobs on, However i can't easily make changes to the Jenkins configuration itself.

    There is a central "nexus pro" maven repository manager but each team / group in this very large multinational has their own repo, publishing to the repos requires username / password combination.

    This means that I have to configure the Jenkins server with a maven settings.xml that is unique to the team I am working with without messing up the maven configuration of the other users of the Jenkins cluster.

    Git is the source control repository.

    1. On a shared Jenkins cluster how do I configure a maven settings.xml that is unique to a a group of build jobs or to a single job? What are the best practices for handling this type of situation?
  • ams
    ams almost 11 years
    the issue is getting the settings.xml onto the jenkins server in the first place as I don't have shell access to the jenkins machine.
  • yodamad
    yodamad almost 11 years
    maybe you can try to add settings.xml to your workspace file and use jenkins variables (like JENKINS_HOME) to set the path to the workspace. Another idea, is that you can configure in global settings the method for settings.xml to be use and if I remember well, you can define it as "workspace relative"
  • Andrii Plotnikov
    Andrii Plotnikov about 7 years
    with this plugin, how can I find the name to provide into -s?
  • Mark O'Connor
    Mark O'Connor about 7 years
    The configuration file plugin enables you to create a Maven settings file via the Jenkins admin screens. This file's path will then be automatically passed to your Maven build step if you select it from the build job.
  • user1084563
    user1084563 almost 7 years
    If you use Nexus Pro for your maven repo its worth looking down at RCross's answer below
  • user1084563
    user1084563 over 6 years
    Fixed the links