beryx/badass-jlink-plugin

Version 2.24.2 fails with Unresolved reference: jvmArgs

Closed this issue · 3 comments

When trying to build a Java 17 / Panama project, the new version 2.24 fails with this error:

Script compilation error:

  Line 41:     jvmArgs = listOf("--add-modules", "jdk.incubator.foreign", "--enable-native-access=ALL-UNNAMED")
               ^ Unresolved reference: jvmArgs

Simple sample project that demonstrates this problem: https://github.com/kittylyst/panama-example

If I revert to version 2.23 ./gradlew clean build will work fine, but then the jlink target fails due to the classfile version being too high.

Any ideas? Oh, and many thanks for your work on this plugin - it's super useful!

I had a similar issue and I found I had to use:

getJvmArgs(project) instead of jvmArgs

e.g. getJvmArgs(project).add("-Dlog4j.configurationFile=log4j2.xml")

I'm not sure why the syntax change
Hopefully that helps.

Thanks @vewert - I tried that and now I'm getting the same problem for both versions:

Execution failed for task ':jlink'.
> BUG! exception in phase 'semantic analysis' in source unit 'SimpleTemplateScript1.groovy' Unsupported class file major version 61

@beryx - should this actually work? Does the plugin support Java 17 yet?

@kittylyst @vewert The jvmArgs issue was a regression introduced in 2.24.2. It's fixed in release 2.24.3.

@kittylyst Use Gradle 7.2 to get rid of the Unsupported class file major version 61 error.