When using Atlassian Elastic Bamboo to build Maven project, it's a common task to update Maven
settings.xml to add private repository information, e.g. credentials to access company's private repository.
Below are two approaches I find to update Maven settings.
settings.xml to code repository
The first approach you can take is to add the
settings.xml to your code repository, then specify the path to
settings.xml file using
-s option of
settings.xml is in the root directory of your project, use
mvn -s settings.xml clean deploy as the command line to invoke Maven.
settings.xml in Bamboo image
If an Amazon EBS volume is added to the Bamboo agent, you can directly change the
settings.xml file. Atlassian has a guide on how to do this. Below is a much simpler guide on how to do it.
- Start the Bamboo agent
- Edit the file
/mnt/bamboo-ebs/maven/.m2/settings.xml. Not the one
/home/bamboo/.m2/settings.xmlis copied from
/mnt/bamboo-ebs/maven/.m2/settings.xmlafter agent started.
- Find the EBS volume used by the running agent.
- Create a snapshot from the EBS volume.
- Update Bamboo elastic image configurations to attach the new snapshot.