Question regarding DependencySubstitution

Hello there,

I have a strange problem. We have a multi project build with one root and like 100 submodules. Now if we have a release we build everything, war files pop out and we deliver.

When we need to provide a bugfix for that release we branch the root project + the sub project which has this bugfix and change the version number to e.g. 0.160.1.

Let’s say I want to build my war file “com.my:my-war:0.160.1” with 99 modules of version “0.160” and that one module with “0.160.1”. So I want to substitute the “com.my:my-module:0.160” with the project dependency (that has that 0.160.1 version and contains the bugfix).

I tried following:

configurations.all {
    resolutionStrategy.dependencySubstitution {
        substitute module("com.my:my-module:0.160") with project(":my-module")
    }
}

When I hit :dependencies task I get:

+--- com.my:my-module:0.160 -> project :my-module

From that point of view it looks good.

My problem now is that it seems that the transitive dependencies are not fetched of that “:my-module” project when I e.g. let the war file build. It gives me compile errors. The strange thing is that if I only build that “:my-module:jar” for example it has no problem.

Does anyone have ideas?

I think I kind of have it working if I do not replace it with a project but a module dependency. I just need to make sure that these are available in the repository. More or less a Workaround… Strange that it doesn’t work with project…