jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Building jbang with gradle wrapper fails on JDK16+

Open mikomatic opened this issue 3 years ago • 4 comments
trafficstars

Describe the bug

When performing the CONTRIBUTING.adoc action to build the project ./gradlew build, if the user is on JDK 16+, the build fails with a message:

General error during semantic analysis: Unsupported class file major version 61

This is because the gradle wrapper uses version 6.9 that is incompatible with JDK 16+ (https://docs.gradle.org/current/userguide/compatibility.html)

Expected behavior

  • The doc could specify the intented jdk version, to avoid this simple mistake (i could make a PR if you find this relevant)
  • Maybe migration version in gradle wrapper? (but maybe this is not planned)

mikomatic avatar Aug 21 '22 09:08 mikomatic

Personally I think we should upgrade the Gradle version but I think @maxandersen postponed this for compatibility reasons. But perhaps any problems that existed before have gone away in the meantime? Max?

quintesse avatar Aug 21 '22 12:08 quintesse

upvoting this. we're migrating to jdk17 and a few of our jbang scripts trigger a compilation error in IDEA or vscode when mounted as a gradle project.

currently jbang --version 0.97.0 uses gradle 7.1 wrapper

upgrading to gradle 7.3 solves these. see https://stackoverflow.com/questions/69801373/starting-from-which-version-gradle-supports-java-17

(yes I understand autogenerated .idea configuration uses <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" /> and <bytecodeTargetLevel target="11" /> but this is for the whole project and not gradle itself)

@maxandersen

laurentperez avatar Aug 24 '22 09:08 laurentperez

@laurentperez your issues is about gradle generated projects when using jbang edit ...we should fix that. the original issue is about jbangs own build. jbang does not and should not require java 17 thus the issue is less critical. I've tried moving to gradle 7 but the diff between gradle 6 and 7 breaks the builds and not sure how to fix it.

maxandersen avatar Sep 02 '22 14:09 maxandersen

Actuallly @laurentperez jbang does not add/generate any wrappers. That is your IDE choosing which gradle version to run with.

maxandersen avatar Sep 02 '22 14:09 maxandersen