1

I want my artifacts to be suffixed with alpha, beta, rc when built by feature/*, develop, release/* branches resp. versions in the pom file should not be changed.

I tried with multiple Maven plugins but couldn't find the exact solution. All the plugins expecting the version in the pom file should be changed to alpha or beta or rc but that results in conflicts while merging.

Any other easy solution or suggestions to solve this?

Thanks.

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
Vignesh P
  • 9
  • 2
  • 8

1 Answers1

1

Why not just using version set: I assume you are using some CI like Jenkins.

  1. Create 3 parameters in your Jenkins (one for your branch: feature, develop or release), and one for the desired version, and one for your NEXT version. (of course your approach can be different).
  2. Clone your repository and the branch which you have specified as parameter.
  3. Based on the parameter you define alpha, beta or rc.

You can check 3. in a sort of script. For example: When the checkout branch is release, set the environment variable CANDIDATE with value rc.

mvn -q -f ${POMPATH} versions:set -DnewVersion=${CANDIDATE}-${VERSION};

All versions in your pom will be set on rc-1.2.0 if you choose the release branch and version is 1.2.0.

Build your artifacts and push them to your nexus or Artifactory (or something like that). After that just do a new version set without doing a commit on the previous changes and set only the $NEXTVERSION without the CANDIDATE part.

Your artifacts will have names, dependent from the branch from which they are build, but without creating conflicts on the branches.

Of course there are a lot of approaches and I don't say you have to use this way of working, but I hope it can be useful in a way for you.

lvthillo
  • 28,263
  • 13
  • 94
  • 127