Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Best practices for handling maven -SNAPSHOT artifact deployment in Bamboo with automatic branch detection?

John Knight August 8, 2012

Using Bamboo 4.1, we have a number of common artifacts building and deploying to our local maven repository server for use in dependent plans; eg. java-common and java-core plans produce java-common-SNAPSHOT and java-core-SNAPSHOT artifacts, for use in java-planA and java-planB.

However, when ABD is enabled against a central Git remote, the branch (say java-common-featurebranch) deploys the -SNAPSHOT again, resulting in a potentially incompatible -SNAPSHOT jar dropping to maven, and leading to downstream build issues.

Obviously, this _could_ be handled by enforcing policies in which branches are required to update the POM to reflect a different artifact handle, or by ensuring that downstream builds rely on non-SNAPSHOT artifacts, but both of these solutions seem creaky.

How does Atlassian, or any other group that sees this question handle situations like this? I figured I'd ask before filing an improvement request in JAC, since it seems like this can't be an uncommon situation, and someone may have a clever solution.

Ideas I've tossed around:

  • Policy enforcement
  • Tasks to rewrite the POM on the fly
  • Manual execution of mvn deploy stages
  • Enhancement request :)

Anyone have better solutions? It seems like there's a couple open BAM issues that might start to lead to a solution, including BAM-10804, but there's still some definite magic that would have to occur inside Bamboo's mvn plugins to improve this.

1 answer

1 accepted

2 votes
Answer accepted
James Dumay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2012

How about specifying a different version for your maven project based on the branch name? With 4.2, we added the bamboo.branchName variable so passing the following to the Maven via the Goals field on the Maven task should work

-Dproject.version=${your_project_version}-${bamboo.branchName}-SNAPSHOT

John Knight August 13, 2012

You guys always seem to have a release that solves a need shortly after I find the need. Cheers!

James Dumay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2012

Glad to hear it! Hope this works out for you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events