Reputation: 1604
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?
Upvotes: 10
Views: 31528
Reputation: 2440
Go to your JOB configuration
than to the Build section
Add build step :- Invoke top level maven target and fill Maven version and Goal
than click on Advance button and mention settings file path as mention in image
Upvotes: 0
Reputation: 1604
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.
Upvotes: 17
Reputation: 3119
The jenkins managed script plugin allows you to manage multiple maven settings files. Once it is installed, you can add configurations in Manage > Manage Files > Add new config > [Global] Maven Settings File where you store the configuration.
In the job configurationn in the Build Configuration Settings check Provide Configuration Files and select the settings.xml in Managed Files > File.
Upvotes: 6
Reputation: 21226
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
)
Upvotes: 7