Unfortunately, the latter approach is incompatible with configuration-on-demand. I understand why: with my terse approach, only the root project and the subproject containing the above code are configured. Gradle cannot guess which unconfigured subprojects would have used the jacoco plugin if configured. Thus, the other 18 subprojects are omitted as jacocoAggregation dependencies and never given a chance to run tests and contribute to the aggregate coverage report.
Is there any way to make my terse plugins.withId("jacoco") approach compatible with configuration-on-demand? I would be satisfied with a fallback wherein the testCodeCoverageReport task forces all subprojects to be configured just so that Gradle can discover which ones use jacoco and which do not. That blunt hammer would effectively disable configuration-on-demand when building the aggregate coverage report, but it would retain the benefits of configuration-on-demand when performing other tasks. Is this possible?
The best I have come up with so far is to use evaluationDependsOn to force evaluation of all other subprojects when evaluating the aggregate-coverage subproject’s script:
I prefer an implicit approach that uses plugins.withId("jacoco") to automatically discover subprojects that provide coverage data:
You should not even ever consider doing that, that is a very bad idea.
Accessing the model of other projects is almost as bad as doing cross-project configuration.
Latest with isolated projects it will not be possible anymore, but you should already now never even try to do it for various reasons, that is extremely discouraged bad practice.
Even if it would not be, using plugins. on the own project should already not be done (have a look at its JavaDoc), but pluginManager.withPlugin("...") { ... } instead. But of course also that not on another project’s model.
I would be satisfied with a fallback wherein the testCodeCoverageReport task forces all subprojects to be configured just so that Gradle can discover which ones use jacoco and which do not.
That’s exactly the way to go, yes.
Just depend on all projects and that’s it.
The coverage data is retrieved using an artifact view and artifact views just ignore dependencies / projects that do not provide the requested variant.
Unfortunately this fails, complaining about several projects that offer no matching variants:
Could not determine the dependencies of task ':code-coverage-report:testCodeCoverageReport'.
> Could not resolve all dependencies for configuration ':code-coverage-report:aggregateCodeCoverageReportResults'.
> Could not resolve project :cast:cast.
Required by:
project :code-coverage-report
> No matching variant of project :cast:cast was found. The consumer was configured to find a library for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- Variant 'cppApiElements':
- Incompatible because this component declares a component for use during 'cplusplus-api' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'debugLinkElements':
- Incompatible because this component declares a component for use during 'native-link' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'debugRuntimeElements':
- Incompatible because this component declares a component for use during 'native-runtime' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'releaseLinkElements':
- Incompatible because this component declares a component for use during 'native-link' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'releaseRuntimeElements':
- Incompatible because this component declares a component for use during 'native-runtime' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
> Could not resolve project :cast:smoke_main.
Required by:
project :code-coverage-report
> No matching variant of project :cast:smoke_main was found. The consumer was configured to find a library for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- Variant 'debugRuntimeElements':
- Incompatible because this component declares a component for use during 'native-runtime' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'releaseRuntimeElements':
- Incompatible because this component declares a component for use during 'native-runtime' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
> Could not resolve project :cast:xlator_test.
Required by:
project :code-coverage-report
> No matching variant of project :cast:xlator_test was found. The consumer was configured to find a library for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- Variant 'cppApiElements':
- Incompatible because this component declares a component for use during 'cplusplus-api' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'debugLinkElements':
- Incompatible because this component declares a component for use during 'native-link' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'debugRuntimeElements':
- Incompatible because this component declares a component for use during 'native-runtime' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'releaseLinkElements':
- Incompatible because this component declares a component for use during 'native-link' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'releaseRuntimeElements':
- Incompatible because this component declares a component for use during 'native-runtime' and the consumer needed a component for use during runtime
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its component category (required a library)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
> Could not resolve project :cast:java:test.
Required by:
project :code-coverage-report
> No matching variant of project :cast:java:test was found. The consumer was configured to find a library for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- No variants exist.
> Could not resolve project :cast:js:html.
Required by:
project :code-coverage-report
> No matching variant of project :cast:js:html was found. The consumer was configured to find a library for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- No variants exist.
* Try:
> No matching variant errors are explained in more detail at https://docs.gradle.org/8.14.2/userguide/variant_model.html#sub:variant-no-match.
> Review the variant matching algorithm at https://docs.gradle.org/8.14.2/userguide/variant_attributes.html#sec:abm_algorithm.
> Creating consumable variants is explained in more detail at https://docs.gradle.org/8.14.2/userguide/declaring_dependencies.html#sec:resolvable-consumable-configs.
Each of the unresolvable projects above contains no Java code and produces no JAR artifact. One of these projects contains only static test resources; the others contain C code and produce natively compiled libraries or executables.
@Vampire, did I misintepret your advice? Or is there a clean way to adapt your advice to quietly ignore subprojects that contain no Java code?
This happens if the project where you apply the aggregation plugin in is also somehow applying the java-base plugin.
If it applies the java-base plugin, the aggregateCodeCoverageReportResults configuration is configured to resolve a JVM runtime classpath as can be seen by the requested attributes in your error message.
For the dependency resolution to work, the “originally requested” variant must be found. Then the artifact view does a variant reselection to find the coverage data variant, ignoring dependencies that do not provide it.
So either make sure to not apply the java-base plugin to the aggregation project and hope that there then is no problem with ambiguity, or make all projects Java projects even if they are not really ones, or do not just aggregate all project. There is no clean way I’m aware of right now to determine at configuration time whether another project is a Java project or not
Other things you could consider is, to depend on all projects but exclude the ones that are no Java projects manually if they are just a fiew and not changing often, or if you have a “root of the Java projects” that directly or indirectly depend on all the others, then just depend on that manually. The aggregation plugins will aggregate over all project dependencies including transitive ones.
No luck with this approach. I modified my aggregation subproject to not apply the java, java-base, or jvm-test-suite plugins. Literally the only plugin being applied is jacoco-report-aggregation. I then followed these instructions to manually register a report, as required due to the lack of a jvm-test-suite plugin. The complete build.gradle.kts for the aggregation subproject is now:
The aggregate report task (testCodeCoverageReport in the aggregation subproject) still fails:
Could not determine the dependencies of task ':code-coverage-report:testCodeCoverageReport'.
> Could not resolve all dependencies for configuration ':code-coverage-report:aggregateCodeCoverageReportResults'.
> Could not resolve project :cast:cast.
Required by:
project :code-coverage-report
> Cannot choose between the available variants of project :cast:cast:
- debugLinkElements
- debugRuntimeElements
- releaseLinkElements
- releaseRuntimeElements
All of them match the consumer attributes:
- Variant 'debugLinkElements' capability 'wala.cast:cast:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'false' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-link' but the consumer didn't ask for it
- Variant 'debugRuntimeElements' capability 'wala.cast:cast:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'false' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-runtime' but the consumer didn't ask for it
- Variant 'releaseLinkElements' capability 'wala.cast:cast:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'true' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-link' but the consumer didn't ask for it
- Variant 'releaseRuntimeElements' capability 'wala.cast:cast:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'true' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-runtime' but the consumer didn't ask for it
> Could not resolve project :cast:smoke_main.
Required by:
project :code-coverage-report
> Cannot choose between the available variants of project :cast:smoke_main
The only attribute distinguishing these variants is 'org.gradle.native.optimized'. Add this attribute to the consumer's configuration to resolve the ambiguity:
- Value: 'false' selects variant: 'debugRuntimeElements'
- Value: 'true' selects variant: 'releaseRuntimeElements'
> Could not resolve project :cast:xlator_test.
Required by:
project :code-coverage-report
> Cannot choose between the available variants of project :cast:xlator_test:
- debugLinkElements
- debugRuntimeElements
- releaseLinkElements
- releaseRuntimeElements
All of them match the consumer attributes:
- Variant 'debugLinkElements' capability 'wala.cast:xlator_test:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'false' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-link' but the consumer didn't ask for it
- Variant 'debugRuntimeElements' capability 'wala.cast:xlator_test:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'false' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-runtime' but the consumer didn't ask for it
- Variant 'releaseLinkElements' capability 'wala.cast:xlator_test:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'true' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-link' but the consumer didn't ask for it
- Variant 'releaseRuntimeElements' capability 'wala.cast:xlator_test:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'true' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-runtime' but the consumer didn't ask for it
> Could not resolve project :cast:java:test.
Required by:
project :code-coverage-report
> Unable to find a matching variant of project :cast:java:test:
- No variants exist.
> Could not resolve project :cast:js:html.
Required by:
project :code-coverage-report
> Unable to find a matching variant of project :cast:js:html:
- No variants exist.
> Cannot resolve external dependency commons-io:commons-io:2.19.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :cast
project :code-coverage-report > project :cast:js
project :code-coverage-report > project :cast:js:nodejs
> Cannot resolve external dependency org.jspecify:jspecify:1.0.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :core
project :code-coverage-report > project :util
> Cannot resolve external dependency com.google.code.gson:gson:2.13.1 because no repositories are defined.
Required by:
project :code-coverage-report > project :core
project :code-coverage-report > project :cast:js
> Cannot resolve external dependency org.smali:dexlib2:2.5.2 because no repositories are defined.
Required by:
project :code-coverage-report > project :dalvik
> Cannot resolve external dependency org.slf4j:slf4j-api:2.0.17 because no repositories are defined.
Required by:
project :code-coverage-report > project :dalvik
> Cannot resolve external dependency com.google.guava:guava:33.4.8-jre because no repositories are defined.
Required by:
project :code-coverage-report > project :dalvik
project :code-coverage-report > project :scandroid
> Cannot resolve external dependency org.eclipse.platform:org.eclipse.core.resources:3.20.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide
project :code-coverage-report > project :ide:jdt
project :code-coverage-report > project :ide:jsdt
> Cannot resolve external dependency org.eclipse.platform:org.eclipse.core.runtime:3.30.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide
project :code-coverage-report > project :ide:jsdt
> Cannot resolve external dependency org.eclipse.platform:org.eclipse.equinox.common:3.18.200 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide
project :code-coverage-report > project :ide:jdt
project :code-coverage-report > project :ide:jsdt
project :code-coverage-report > project :cast:java:ecj
> Cannot resolve external dependency org.eclipse.platform:org.eclipse.jface:3.32.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide
project :code-coverage-report > project :ide:jdt
> Cannot resolve external dependency org.eclipse.platform:org.eclipse.osgi:3.18.600 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide
project :code-coverage-report > project :ide:jdt
project :code-coverage-report > project :ide:jsdt
> Cannot resolve external dependency org.eclipse.pde:org.eclipse.pde.core:3.17.200 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide
> Cannot resolve external dependency org.osgi:org.osgi.framework:1.10.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide
project :code-coverage-report > project :ide:jdt
project :code-coverage-report > project :ide:jsdt
> Cannot resolve external dependency org.eclipse.jdt:org.eclipse.jdt.core:3.36.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide
project :code-coverage-report > project :ide:jdt
project :code-coverage-report > project :cast:java:ecj
> Cannot resolve external dependency org.eclipse.platform:org.eclipse.ui.workbench:3.131.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide
project :code-coverage-report > project :ide:jdt
project :code-coverage-report > project :ide:jsdt
> Cannot resolve external dependency commons-cli:commons-cli:1.9.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :scandroid
> Cannot resolve external dependency net.htmlparser.jericho:jericho-html:3.2 because no repositories are defined.
Required by:
project :code-coverage-report > project :cast:js
> Cannot resolve external dependency org.eclipse.platform:org.eclipse.equinox.app:1.6.400 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide:jdt
> Cannot resolve external dependency org.eclipse.platform:org.eclipse.core.jobs:3.15.100 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide:jdt
> Cannot resolve external dependency org.eclipse.jdt:ecj:3.42.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide:jdt
project :code-coverage-report > project :cast:java:ecj
> Cannot resolve external dependency org.eclipse.wst.jsdt:core:1.0.201.v2010012803 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide:jsdt
> Cannot resolve external dependency org.eclipse.wst.jsdt:ui:1.0.201.v2010012803 because no repositories are defined.
Required by:
project :code-coverage-report > project :ide:jsdt
> Cannot resolve external dependency org.json:json:20250517 because no repositories are defined.
Required by:
project :code-coverage-report > project :cast:js:nodejs
> Cannot resolve external dependency org.mozilla:rhino:1.8.0 because no repositories are defined.
Required by:
project :code-coverage-report > project :cast:js:rhino
> Cannot resolve external dependency nu.validator.htmlparser:htmlparser:1.4 because no repositories are defined.
Required by:
project :code-coverage-report > project :cast:js:html:nu_validator
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Notice that each non-Java project still leads to a “Could not resolve project” error:
:cast:cast
:cast:smoke_main
:cast:xlator_test
:cast:java:test
:cast:js:html
These same projects were failing to be resolved earlier, when I first tried adding all subprojects to jacocoAggregation. Omitting the java-base plugin did not help.
I’m not even thinking about the dependency failures in Java subprojects yet, though those would need to be addressed eventually.
I also tried an incomplete aggregation that depends only on :cast:cast (a non-Java subproject):
No java-base plugin, per @Vampire’s advice. But it still fails:
Could not determine the dependencies of task ':code-coverage-report:testCodeCoverageReport'.
> Could not resolve all dependencies for configuration ':code-coverage-report:aggregateCodeCoverageReportResults'.
> Could not resolve project :cast:cast.
Required by:
project :code-coverage-report
> Cannot choose between the available variants of project :cast:cast:
- debugLinkElements
- debugRuntimeElements
- releaseLinkElements
- releaseRuntimeElements
All of them match the consumer attributes:
- Variant 'debugLinkElements' capability 'wala.cast:cast:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'false' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-link' but the consumer didn't ask for it
- Variant 'debugRuntimeElements' capability 'wala.cast:cast:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'false' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-runtime' but the consumer didn't ask for it
- Variant 'releaseLinkElements' capability 'wala.cast:cast:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'true' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-link' but the consumer didn't ask for it
- Variant 'releaseRuntimeElements' capability 'wala.cast:cast:1.6.11-SNAPSHOT':
- Unmatched attributes:
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.debuggable 'true' but the consumer didn't ask for it
- Provides org.gradle.native.linkage 'SHARED' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.native.optimized 'true' but the consumer didn't ask for it
- Provides org.gradle.usage 'native-runtime' but the consumer didn't ask for it
* Try:
> Ambiguity errors are explained in more detail at https://docs.gradle.org/8.14.2/userguide/variant_model.html#sub:variant-ambiguity.
> Review the variant matching algorithm at https://docs.gradle.org/8.14.2/userguide/variant_attributes.html#sec:abm_algorithm.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 921ms
9 actionable tasks: 9 up-to-date
Configuration cache entry stored.
Each of these alternatives has its own pros and cons. I will consider them. Some feel subjectively less clean than my latest working approach:
These same projects were failing to be resolved earlier, when I first tried adding all subprojects to jacocoAggregation. Omitting the java-base plugin did not help.
Well, it changed things.
You are not getting any longer that the Java variant is not found.
But as I warned you, you now have abiguity problems, as now it cannot decide which variant it chooses, at a point where one valid variant needs to be matched, as at that point it does not know that you practically discard the result next using the artifact view.
Maybe you could use a custom disambiguation rule so that one variant is selected, no matter which.
No java-base plugin, per @Vampire’s advice. But it still fails:
Of course it does fail too, why should it not?
You already have seen in the previous try that this project cannot be resolved as there are multiple matching variants.
Some feel subjectively less clean than my latest working approach:
That might be subjectively the case, but objectively nothing I suggested can be less clean than that approach as you must not access the model of another project, even without project isolation.
if nothing else, you’ve given me plenty of options to consider. Thank you for that!