Your problem is the capability.
Whether it is a bug in the resolution, or a bug in the error message not mentioning the capability which it usually does I do not know, but you should anyway open an issue about it, as it is very confusing and not obvious.
But if you invoke the :collection:core:outgoingVariants
task you see that “Variant apiElements” has capability cz.a-d.java.tools.collection.core:core:1.0-SNAPSHOT
while “Variant jdk8ApiElements” has capability tools.collection:core:unspecified
.
If I change it.capability(this.project.getGroup().toString(), this.project.getName(), this.project.getVersion().toString())
to it.capability("cz.a-d.java.tools.collection.core", this.project.getName(), "1.0-SNAPSHOT")
resolution works as expected.
The problem is, that when you read the group and version, they are not set yet and currently they are not yet lazy.
If you move the group and version to gradle.properties
files, they are available in time so any plugin reading those values (not just your own) will get the proper values.
So if you add collection/core/gradle.properties
with content
group = cz.a-d.java.tools.collection.core
and gradle.properties
with content
group = cz.a-d.java.tools
version = 1.0-SNAPSHOT
you can remove the group and version values and the resolution works as intended.