Release workflow with Maven and Nexus
Asked by Kenneth Blair:

1. Is there any way to setup Bamboo to make release versions follow the Maven version? Something along the lines of ${maven.version}-b${buildNumber}.

2. The artifacts need to be published to Nexus. Is the expected workflow here that the build plan publishes the artifacts or that a Deployment publishes the artifacts?

3. I haven't found any Nexus related plugins which is strange to me since it's so commonly used. Is the only option for tying promotions in Bamboo to promotions in Nexus with some sort of bash script to call their API?


Answers:
author: LarsM
body: 1) Sure, just add a plan variable like maven.version with value 1 and pass it to the maven task.

2) It depends on what you like more. I my opinion use a deployment project.

3) Use maven-release-plugin and SCM Information in your pom of your project. Then you just run mvn release:prepare and release:perform (see <http://maven.apache.org/maven-release/maven-release-plugin/>)

This is a interesting video from Jonathan Docklovic from Summit last Year about maven and releasing via Bamboo ([http://www.youtube.com/watch?v=YIgX67c-2hQ\&index=52\&list=PLaD4FvsFdarR451b0HQXHinsFQTDY-MSg](http://www.youtube.com/watch?v=YIgX67c-2hQ&index=52&list=PLaD4FvsFdarR451b0HQXHinsFQTDY-MSg))

comments: author: Kenneth Blair
body: 1. The information is already available in the POM, it should pull it from there not force manual entry. Fortunately I found a plugin that extracts that information into a variable. It works on a single branch, I haven't tested multiple simultaneous branches so I'm not sure it will work in practice.

2. Fair enough.

3. Maven doesn't handle *promotion* at all. So the release plugin doesn't really offer anything. It has to be done with tooling, such as a Nexus staging repository. The problem is I need to tie that to the versions in Bamboo. If I can't then Bamboo is essentially an expensive, less capable Jenkins.

I have some ideas on how I can accomplish that using shell scripts in Bamboo that curl the API in Nexus. The build can deploy to a Nexus staging repository and the deployment "environments" can promote it through while triggering the actual deployment as well. I was really hoping there would be integration in lieu of hacky bash scripting.

Oh well, thank you for your time.


author: LarsM
body: You can use the maven-nexus-plugin and run it in the release-plugin - see [](http://www.baeldung.com/maven-release-nexus)<http://www.baeldung.com/maven-release-nexus>

And then use a Maven2/3 Task to execute it.


author: Adam Pryce
body: The problem is that Bamboo is using a cached repository, so even when using the maven-nexus-plugin, the plugin cannot push the commits with the release tag back to the repository (in my case Bitbucket Server).


author: Chandler Zhang
body: > he problem is that Bamboo is using a cached repository, so even when using the maven-nexus-plugin, the plugin cannot push the commits with the release tag back to the repository (in my case Bitbucket Server).
>
> <br />
>
Do you mean `maven-release-plugin`? Could you please provide some logs of your build? We use maven-release-plugin and don't have the problem