I'm trying to use the OpenRewrite plugin in my Java project and it requires guava. Gradle is unable to choose between two variants because the plugin doesn't check attribute org.gradle.jvm.environment. The two variants are androidRuntimeElements and jreRuntimeElements.
How can I either exclude the android runtime variant from my project or make Gradle pick the jre runtime variant?
Execution failed for task ':rewriteResolveDependencies'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
> Could not resolve com.google.guava:guava:31.1-jre.
Required by:
project : > org.openrewrite:rewrite-python:1.0.7
> The consumer was configured to find attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.usage' with value 'java-runtime', attribute 'org.gradle.libraryelements' with value 'jar', attribute 'org.gradle.dependency.bundling' with value 'external'. However we cannot choose between the following variants of com.google.guava:guava:32.1.1-jre:
- androidRuntimeElements
- jreRuntimeElements
All of them match the consumer attributes:
- Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.1-jre and com.google.guava:guava:32.1.1-jre and com.google.guava:listenablefuture:1.0 declares attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external', attribute 'org.gradle.libraryelements' with value 'jar', attribute 'org.gradle.usage' with value 'java-runtime':
- Unmatched attributes:
- Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
- Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.1-jre and com.google.guava:guava:32.1.1-jre and com.google.guava:listenablefuture:1.0 declares attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external', attribute 'org.gradle.libraryelements' with value 'jar', attribute 'org.gradle.usage' with value 'java-runtime':
- Unmatched attributes:
- Provides org.gradle.jvm.environment 'standard-jvm' but the consumer didn't ask for it
- Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'androidApiElements' capabilities com.google.collections:google-collections:32.1.1-jre and com.google.guava:guava:32.1.1-jre and com.google.guava:listenablefuture:1.0 declares attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external', attribute 'org.gradle.libraryelements' with value 'jar':
- Incompatible because this component declares attribute 'org.gradle.usage' with value 'java-api' and the consumer needed attribute 'org.gradle.usage' with value 'java-runtime'
- Variant 'jreApiElements' capabilities com.google.collections:google-collections:32.1.1-jre and com.google.guava:guava:32.1.1-jre and com.google.guava:listenablefuture:1.0 declares attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external', attribute 'org.gradle.libraryelements' with value 'jar':
- Incompatible because this component declares attribute 'org.gradle.usage' with value 'java-api' and the consumer needed attribute 'org.gradle.usage' with value 'java-runtime'
I tried Googling the issue, but didn't find any answers. I also tried excluding guava from my build.gradle configuration block, but I'm unable to exclude only the android runtime variant.