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

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

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

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.