Custom Dynamic Version Resolution Strategy

(Anders Brolien) #1

Our corporate version numbering strategy does not match the normal X.Y.Z version numbers. Instead we have the following pattern:

R([1-9][0-9])([A-HJ-NS-Z])([0-9]*). Where the following order applies: R1A01< R1A02< R1A< R1B < R2A

We use dynamic version such as R1A+ and is able to pick up R1A02, R1A03, …, R1A11 and so on. However I would like to be able to define so that R1A+ chooses R1A over any of the numbered versions (R1Axxx) when that is available. Further on R1+ should choose R1B01 over R1A57.

Is it possible to define a custom dynamic version resolution strategy?

(detelinyordanov) #2

Isn’t this more about overriding the latest revision strategy? If ‘R1A+’ picks up ‘R1A’ and ‘R1A[0-9]+’, then it should be the latest revision strategy that defines which is greatest among those. If so, I already asked for this, but it is not possible at the moment.

(Anders Brolien) #3

Yes it could be simplified to a latest revision strategy. Using a maven repo here, is something similar possible there?

(detelinyordanov) #4

Are you using Maven all over the place - on the repository (Maven pom files) and on the client-side (build)? I was using Maven once (2.x) but have switched to Ivy/Gradle long time ago and I was not aware that such a versioning scheme is even possible with Maven. I assume you are using Maven 3.x - if so, is what you are trying to achieve possible with vanilla Maven?

(Anders Brolien) #5

We are using gradle as our build environment, the artifacts are published in a maven/nexus repository. We are currently using dynamic versions, like R1A+ to pick up new versions R1A01, R1A02, … However I would also like to pick up R1A if that one is available.

(Anders Brolien) #6

I have browsed arround in the gradle source code. In the DefaultDependencyResolver (org.gradle.api.internal.artifacts.ivyservice.resolveengine) we have the following:

ModuleConflictResolver conflictResolver;

if (configuration.getResolutionStrategy().getConflictResolution() instanceof StrictConflictResolution) {

conflictResolver = new StrictConflictResolver();

} else {

conflictResolver = new LatestModuleConflictResolver();


If I could customize the LatestModuleConflicResolver I believe I could achieve want I need.

Is it possible to plug in a custom ModuleConflictResolver? The above snippet indicates that this currently is not possible.

(Luke Daley) #7

Hi Anders,

This is not currently possible. It’s harder than it might appear as we are moving away from Ivy and therefore can’t expose Ivy types/concepts up in the public API.

We are committed to providing a solution to this general problem though.

(Anders Brolien) #8

Hi Luke, Thanks for this. I fully understand your concerns. Can you give any indication on when a general solution could be available?

(Luke Daley) #9

Can you give any indication on when a general solution could be available?

Unfortunately I cannot. The best I can say is that it won’t be in 1.4.

There is still work to be done before we can expose such a hook. A few people have asked for this though so it’s not at the end of the queue.