Failed to build with gradle6.5

Failed to build spotbugs using gradle6.5 under windows, please help to see how to deal with it, thank you

Don’t use an own Gradle version to run a Gradle build.
Virtually any Gradle project out there should have the Gradle wrapper files checked into VCS.
There are some that don’t have them because of company restrictions like not being allowed to check in a JAR file or similar and there are some that don’t have them because the creators just don’t know it better. The former is a valid reason, probably all other reasons are void and imho just a bug of the project if it does not incluede the wrapper files.
The wrapper files make sure you are running the build with the Gradle version the build is designed for and known to be working with as expected.
You should practically never need an installed Gradle version on your computer just to run an existing Gradle build.
I even use existing Gradle builds to bootstrap new Gradle builds so never have Gradle installed locally.

Thank you for your reply. The gradlew.bat in the execution project can be compiled successfully, but the
gradlew.bat build cannot be packaged.

What do the kanji in front of --release say? As you don’t post text but screenshots, I cannot translate. I guess it says that this is option not supported. If that’s the case, then that build seems to use --release 8 to build Java 8 compatible classes instead of using the Java toolchains feature. But Java 8 does not yet support this option. Consider complaining to the build authors that they either don’t set that option of running on Java 8 as it is not necessary, or that they use Java toolchains instead. In the meantime, run Gradle with a newer Java version, in the --version output you see that you run on Java 8.

Thank you for your reply.
When I pack with jdk11 or 17, this error will be reported. When using jdk8 to package, although it will report an error, you can type out a package, but it won’t work. The version of spotbugs I use is 4.3.0. So which jdk version should be used for packaging, I can’t understand.

Well, as I said, you should complain to the build authors that the build is not Java version agnostic and that it also is not documented which version is expected. Hopefully they can also tell you which version to use. @KengoTODA can you chime in here and help?

1 Like

Thanks @Vampire, we have a progress at Failed to build under windows · Issue #1889 · spotbugs/spotbugs · GitHub and I hope it can provide a solution for their case.

1 Like

Thank you for your reply. It has been successfully compiled and packaged. Previously, it was not possible to package because my friend changed the code to adapt to jdk8. It was not completely changed. Now after switching to jdk11, it can be compiled and packaged normally. For trouble, express my deep apologies.