How to Override the Maven Local Repository setting
目的
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:
- Go to the Plan that runs the maven clean deploy command
- Under the "Actions" menu, select "Configure Plan"
- Click on the Job that runs the Maven command
- Click on the Maven Task
- Add -Dmaven.repo.local=~/.m2/repository to the "Goal" section, before "clean deploy"
- [保存] をクリックします。
To achieve this in the settings file, you can:
- Open M2_HOME/conf/settings.xml in a text editor
- 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
- note: it may be inside a comment block <!-- ... -
- Replace /path/to/local/repo with the path to your repository
- Save and close
参考情報
To configure Bamboo to use different Maven repositories for different builds, please see Configuring repository isolation for Maven executables.
最終更新日 2016 年 8 月 17 日
Powered by Confluence and Scroll Viewport.