How to Override the Maven Local Repository setting

Still need help?

The Atlassian Community is here for you.

Ask the community


When running a Maven Task in Bamboo, the build agent will often default to using ~/.m2/repository as the local repository. This guide will offer two options to override this setting, one locally – for one task – and one globally for Maven.


To achieve this for a given Task, you can:

  1. Go to the Plan that runs the maven clean deploy command
  2. Under the "Actions" menu, select "Configure Plan"
  3. Click on the Job that runs the Maven command
  4. Click on the Maven Task
  5. Add -Dmaven.repo.local=~/.m2/repository to the "Goal" section, before "clean deploy"
  6. Click "Save"

To achieve this in the settings file, you can:

  1. Open M2_HOME/conf/settings.xml in a text editor
  2. Find the <localRepository>/path/to/local/repo</localRepository> line
    • note: it may be inside a comment block <!-- ... ->, if so, move the -> to before the <localRepository> tag
  3. Replace /path/to/local/repo with the path to your repository
  4. Save and close

See Also

To configure Bamboo to use different Maven repositories for different builds, please see Configuring repository isolation for Maven executables.


Last modified on Aug 17, 2016

Was this helpful?

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