1

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 in develop 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?

Chuck Nuris
  • 71
  • 1
  • 6
  • 1
    Sorry but if you install the jar locally maven will take it from your local repository no need to release it on nexus first. Or I have misunderstood? – Pp88 Sep 14 '22 at 14:56
  • 1
    Yes ... that's it. If you need to test with your 2.5.1-SNAPSHOT, then simply _install_ it to your local repository. – Seelenvirtuose Sep 14 '22 at 15:01
  • Are you depending on a (remote) build system to create these snapshots for you? If that is the case, you will need to give each feature their own unique version number yes. Otherwise i'm with the comments above to only install locally for your tests. – slindenau Sep 15 '22 at 09:08

0 Answers0