Can we see dependency classifier in dependencySubstitution

We are having a case when certain project defines multiple artifacts, produced from different sourcesets, published under the same GAV, with different classifiers.

I am trying to use project substitution, as in the example here, so we can work and test on the codebase as a single project. I would like to exclude the classifier dependency from the resolution, as it doesn’t work well with the new module structure in IDEA 16.

Is there a good way to determine the classifier of a dependency from the resolutionStrategy.dependencySubstitution.all { ... } handler?

There is currently no way to access the classifier. But maybe we can find a different solution for your problem if you elaborate on the issue?

We are using project substitution to achieve some of the of the “project composition” use-cases.

In this particular case, an upstream project is publishing a main artifact and an auxiliary artifact with classifier, containing some test utils that we want to reuse.

It all works in IDEA 15, but when using with IDEA 16 and the new fine-grained source-sets model it breaks down. An easy way to fix it is to not resolve that particular dependency (we don’t mind if the test utils come from Artifactory).

How does it break down? Does some dependency end up pointing to the wrong module in Idea?

You could probably have different substitution rules for the compile (do substitution for that particular artifact) and testCompile (don’t do substitution for that artifact) configurations.

In IDEA 16, each source-set is represented as a module. In this case, the “test” publication is produced from the “test” sourceset, but when we resolve it it ends up substituted with the “main” sourceset.

Did my suggestion above help or does that not work out?

Sorry, I missed your suggestion. It works, though it required a build change - the testing source root was getting the module “main” publication both from the source (as transitive dependency) and from Artifactory (as declared dependency).

I fixed that by removing the declared dependency, which was not really needed anyway.