I need to use compile group: 'org.apache.yetus', name: 'audience-annotations', version: '0.10.0'
in a Gradle project. However, as can be seen here, it has a system
-scoped optional
dependency.
I have the following defined in my build.gradle
file:
allprojects {
configurations.all {
exclude group: 'jdk.tools', module 'jdk.tools'
}
}
I was expecting this would take care of erasing the dependency from the dependency tree/graph.
However, it's still complaining with:
carlspring@carlspring:/java/opensource/gradle/possible-gradle-bug> gradle --no-daemon clean build
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve org.apache.yetus:audience-annotations:0.10.0.
Required by:
project :
> Could not resolve org.apache.yetus:audience-annotations:0.10.0.
> Could not parse POM https://repo1.maven.org/maven2/org/apache/yetus/audience-annotations/0.10.0/audience-annotations-0.10.0.pom
> Unable to resolve version for dependency 'jdk.tools:jdk.tools:jar'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
2 actionable tasks: 1 executed, 1 up-to-date
What more do I need to do in order to really exclude this dependency, which shouldn't actually be required, as I'm building the code using a JDK (1.8.0_144
)?
I'm using Gradle 4.2.1
, (not sure, if upgrading will be an option, unless it's a 4.x version).
I have a "Hello, World!" application illustrating this here.
I have the feeling this is a bug and I've filed gradle/gradle#10058, but I might be wrong. Please, advise!
Try this. It worked for me :
configurations {
all*.exclude module : 'jdk.tools'
}