I'm new to Bitbucket and Bamboo, and I'm looking for a way to make sure that whenever someone successfully merges from another branch to the master branch, the version listed in the pom.xml is updated. For example:
1.24-SNAPSHOT => 1.25-SNAPSHOT
I'd appreciate any input you might have, and I apologize if this information is vague!
Hi @Samuel VanFossen, welcome to Atlassian Community!
To set the version number as dynamic value, you'll need to declare the equivalent Bamboo variable bamboo.buildNumber during the execution of the Maven script.
For example, you may want your Maven 2 version to be determined by Bamboo. In Maven 2 pom.xml
you may have:
...
<groupId>com.atlassian.boo</groupId>
<artifactId>boo-test</artifactId>
<packaging>jar</packaging>
<version>1.1.${bambooBuildNumber}-SNAPSHOT</version>
...
You can then specify the following in the Goal field of your build plan:
clean package -DbambooBuildNumber=${bamboo.buildNumber}
When the command runs, Bamboo will replace bamboobuildNumber
with the actual number (e.g. 1102), which will be passed to the underlying Maven build to use. The command will then produce a jar that looks like this: boo-test-1.1.1102-SNAPSHOT.jar
.
More information can be found here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.