How to Use a Maven settings.xml from outside the local repository

Still need help?

The Atlassian Community is here for you.

Ask the community

Purpose

If you intend to reference files (e.g. settings.xml) for Maven that are located in a separate directory or repository, you will need to use Maven arguments to reference them.

 

Solution

If you are using a settings.xml from a different local directory

  1. Edit your Job in Builds >> All Build Plans >> Build name >> Actions >> Configure Build 
  2. In your Maven Task, add the relative path to the beginning of the Goal field 
    eg: -s maven-settings-dir/settings.xml

  3. Save the Task

If you are pulling settings.xml from a different repository

You may have your settings.xml in a different repository that you want to pull in during the build. You can get settings.xml as follows:

  1. Link the other repository, if needed
  2. Edit your Job in Builds >> All Build Plans >> Build name >> Actions >> Configure Build 
  3. Add a new Source Code Checkout task before the Maven task
  4. Select your other repository as the Repository for the task
  5. Add a Checkout Directory (it will be added if it doesn't exist) and save
    eg: maven-settings-dir 

  6. In your Maven Task, add the relative path to the beginning of the Goal field and save
    eg: -s maven-settings-dir/settings.xml

If you have any questions about this process, please reach out to Atlassian Support

Last modified on Sep 28, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.