Can I point OnDemand Bamboo to my Maven repository?
Asked by Ryan King:

We are evaluating Bamboo as part of our OnDemand trial and are running up against an issue wth Bamboo.

I have imported one of our existing projects into SVN, and have created a build plan to build the project using Maven 2.2.x.

However, the build is failing because Maven cannot find a number of dependencies that reside in our own Maven repository. Normally, I would just point the settings.xml file to our repo, but cannot figure out a way to do this with OnDemand Bamboo and its Elastic instances.

Is this even possible?

Thanks!


Answers:
author: SimonS
body: Hey kyanring,

This isn't possible by default with Bamboo OnDemand's custom images. We do plan on making this available in the future though - please see this feature request:

<https://studio.atlassian.com/browse/JST-2305>

This *may* be possible with a custom-defined elastic image that you point Bamboo to, but we wouldn't be able to support it if you ran into problems.

-Simon

comments: author: Karsten Silz
body: The issue you mentioned (now [https://jira.atlassian.com/browse/AOD-2305](https://jira.atlassian.com/browse/AOD-2305))) is about offering a Maven repository as part of the OnDemand suite. That's definitely nice, but an intermediate step would be to point a Bamboo plan to our own Maven repository instead. Is that planned?


author: SimonS
body: It isn't planned for the immediate future... if we're going to implement it it would probably look like the feature request I linked earlier. Sorry, it's too far out to really know :(

Keep a watch and comment on that feature request though. The more votes and comments we get on it the more likely it will be planned for a future release.


author: Andrew Serff
body: There is really no way to set up the maven settings.xml for Bamboo OnDemand? This makes Bamboo useless to me. If I can't get dependancies from our own maven repo, then I can't build my products. Additionally, I can't just put then info in our pom, because there are credentials to log into our maven repo that are better suited to live in the settings.xml. Also, I agree the referenced JIRA issue doesn't solve this issue at all. Even if you make a hosted maven repo available in OnDemand, you still have to be able to tell bamboo to configure maven to use it...


author: Andrew Serff
body: So after I posted my comment, I discovered that you can create a [custom elastic image](https://confluence.atlassian.com/display/AOD/Creating+a+custom+elastic+image). Basic steps:

* Start the base Bamboo elastic image form the Bamboo admin
* Log into it. You have to get the private key used by bamboo in your bamboo config. After you start it, go to your bamboo admin, Instances, click on the instance and there will be a SSH access section. The key is linked there, click it and download it. You can get the ssh connect command from your EC2 console.
* Edit /opt/maven-3.0/conf/settings.xml and add your repositories and what ever else you need to (credentials, etc).
* Now log into your EC2 console and right click on the image and select "Create Image (EBS AMI)"
  * I just named mine and didn't change anything else
  * Once that is done, note the AMI ID of the image you just created
* Go back to the bamboo admin, Go to image configurations and add a new one with your AMI.
* I also had to disable all other instances because it wouldn't automatically start my instance configuration.
* Then go start it!

That was basically all I had to do and now when I build my maven projects, they get their dependancies from our own nexus repository.


author: ssetayeshfar
body: Hello,

The other solution to this is using maven command line options. In your maven task add preferred option to the *Goals* field, then Maven on the next run should pick the options from the configuration file and use proper repositories. Note that you don't need to put absolute path there, path relative to the build directory should be enough.

$mvn --help

usage: mvn \[options\]\[\<goal(s)\>\]\[\<phase(s)\>\]

Options:

...

-gs,--global-settingsAlternate path for the global settings file

...

-s,--settingsAlternate path for the user settings file

Hope this helps!


Tags: cloud