Dynamic resolution of dependency for published module

Hi there,

I currently have a module A that declares a dependency on B using dynamic version 2.+.

When I publish module A at version 1.1 , its module metadata file has replaced the dynamic version with the resolved version at the time of publication. i.e A.module file B has requires 2.1.1

Desired Functionality

When another module, C declares a dependency on A at version 1.1 we would like the transitive dependency on B to be dynamic i,e. use 2.+. (Note: ideally this would be automatic based on the module metadata of A rather than requiring any specific configuration for B in module C)

Actual Functionality

When another module, C declares a dependency on A at version 1.1 the resolved version of B, ie 2.1.1 from the A.module file is used.

Can my desired functionality be achieved either with module metadata or some other mechanism such that the dynamic version of a transitive dependency is always used?

What you ask for actually is the default behavior unless you configured Gradle differently by using a versionMapping for your publication of A.

That was exactly the issue (I was unaware that someone had changed the default). Thanks.

1 Like

Perhaps you might be able to help with a related question.

If we use the Resolved versions strategy, is it possible to override this and use the Declared version just for one or more specific dependencies?

I don’t think in a clean way, other than declaring the versions the way you want them published.