I am using gradle tooling api 6.6.1 with java 14 to build a project (To test, I’ve used spotbugs).
Here is how I’m using the project connection (this is kotlin code btw):
projectConnection
.newBuild()
.forTasks("spotbus-annotations:build")
.setStandardError(stderr)
.setStandardOutput(stdout)
.withArguments("-S", "-d")
.addProgressListener { event: org.gradle.tooling.events.ProgressEvent ->
logger.info { "[${event.eventTime}] ${event.displayName}: ${event.descriptor.displayName}" }
}
.run()
The progress listener shows that one task had failed. However, it didn’t show muc more:
[1600928363746] Compile Java for :spotbugs-annotations:compileJava failed: Compile Java for :spotbugs-annotations:compileJava
the original exception I got was this:
org.gradle.tooling.BuildException: Could not execute build using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-6.6.1-all.zip'.
If I dig deeper, I find the actual cause:
java.lang.IllegalArgumentException: invalid flag: --release
my javac and java versions are 14, and I am able to run the build without any issues with gradlew… How did that --release option get there? is there a way to remove it?