Me and my teammate are using Nexus repository to store JAR files that are builded from develop
branch before we test it and are ready to release the SNAPSHOT version.
This is our branch structure in the repository:
- main - one branch, used just for production code
- develop - one branch, used for pre-release code that should be tested before merging in
main
- feature_xyz - multiple feature branches that are created from
develop
and where xyz feature should be implemented. It is merged indevelop
branch.
Example
Imagine there is 2.5.0
released version of one Maven project. We will both create two different feature branches (feature_foo
and feature_bar
) from develop branch and change the version name to 2.5.1-SNAPSHOT
. Me and my teammate want to test the code just locally on our machines, the code is unstable and should not be pulled by the other teammate. That is why we test it first locally.
THE PROBLEM
To run the code locally, we have to have JAR file for the 2.5.1-SNAPSHOT
version of that Maven project locally on our machine. But that JAR file will be just built and pushed to the Nexus repository only from develop
branch. So in order to test locally, we always have to push at least one new SNAPSHOT version to develop, in order for to Maven be able to download the JAR file from the Nexus repository locally. This code that is pushed to develop is never tested locally and therefore the second teammate should not download that JAR file on his machine. That other teammate is working on 2.5.1-SNAPSHOT
version too and that code might be unstable as well. The same problem, in order to test his features locally, he has to do the same as the first one.
Out goal is just to have JAR file downloaded to one teammate's machine with the SNAPSHOT version that he is working on but only with his features inside.
What we did?
We discussed about naming SNAPSHOT versions like this:
2.5.1-SNAPSHOT-1
and 2.5.1-SNAPSHOT-2
and to push them to the Nexus repository like that and use them locally on different machines to be able to test features. After everything is locally tested, we will merge feature_foo
and feature_bar
branches into develop using just 2.5.1-SNAPSHOT
version.
Is there a better solution or in case this is one of them, is there any convention that describes how versions should be named in this case?