Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify a separate location for settings.xml in Jenkins

I want to specify a different location for settings.xml for the maven build other than the default one (<USER_HOME>/.m2/settings.xml).

I have tried the -s flag but it is not working. Is there any way to do this?

like image 881
user1522820 Avatar asked Jan 28 '13 08:01

user1522820


People also ask

Where should settings XML be placed?

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

What is the use of settings XML in .m2 folder?

A Maven settings. xml file defines values that configure Maven execution in various ways. Most commonly, it is used to define a local repository location, alternate remote repository servers, and authentication information for private repositories.


2 Answers

I found an easy way to do this..

Go to the 'Build' Section of the job and click "Advanced". There is a 'Settings File' option there. Specify the location your 'settings.xml' file.

like image 173
user1522820 Avatar answered Sep 28 '22 08:09

user1522820


Actually -s flag works. We use it maven jobs.

Under Build section add Invoke top level Maven targets and set Goals to [your goals] -s [path/to/settings.xml] (e.g. clean deploy -s /some/path/settings.xml)

like image 30
Draco Ater Avatar answered Sep 28 '22 09:09

Draco Ater