badass-jlink-plugin icon indicating copy to clipboard operation
badass-jlink-plugin copied to clipboard

Version 2.24.2 fails with Unresolved reference: jvmArgs

Open kittylyst opened this issue 3 years ago • 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!

kittylyst avatar Oct 10 '21 16:10 kittylyst

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.

vewert avatar Oct 10 '21 20:10 vewert

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 avatar Oct 11 '21 06:10 kittylyst

@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.

siordache avatar Oct 19 '21 21:10 siordache