Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?
like image 818
ams Avatar asked May 22 '13 07:05

ams


People also ask

Where should I keep settings xml for Maven?

The Maven settings file, settings. xml , is usually kept in the . m2 directory inside your home directory.


4 Answers

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.

like image 194
Mark O'Connor Avatar answered Oct 20 '22 22:10

Mark O'Connor


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

like image 37
yodamad Avatar answered Oct 20 '22 20:10

yodamad


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.

like image 38
Hilikus Avatar answered Oct 20 '22 22:10

Hilikus


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)

like image 22
RCross Avatar answered Oct 20 '22 22:10

RCross