I’m currently trying to upgrade one of my projects to java 21. As far as I can see Lemur isn’t compatible with it. Giving errors like
SEVERE: Uncaught exception thrown in Thread[#31,jME3 Main,5,main]
BUG! exception in phase 'semantic analysis' in source unit 'Script1.groovy' Unsupported class file major version 65
at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:905)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:257)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngineImpl.java:336)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:181)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:188)
at com.simsilica.lemur.style.StyleLoader.compileApiResource(StyleLoader.java:109)
at com.simsilica.lemur.style.StyleLoader.compileApi(StyleLoader.java:89)
at com.simsilica.lemur.style.StyleLoader.<init>(StyleLoader.java:82)
at com.simsilica.lemur.style.StyleLoader.<init>(StyleLoader.java:62)
at com.simsilica.lemur.style.BaseStyles.loadStyleResources(BaseStyles.java:72)
at com.onemillionworlds.starlight.Starlight.initialiseStarStyle(Starlight.java:274)
at com.onemillionworlds.devtools.NonVrLevelLauncher.simpleInitApp(NonVrLevelLauncher.java:67)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:607)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:710)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:199)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:180)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:166)
I believe this is because Lemur uses quite an old version of groovy; 2.1.9.
Assuming I’m right; I wanted to ask if there were any plans to upgrade it?
Just to check, you said gradle but I’m talking about groovy? I must admit I don’t know much about how the lemur stylesheet compile works but I assumed it was separate from gradle; couldn’t a lemur project use maven, and then there wouldn’t be any gradle at all?
I tend to use the latest versions of libraries in my projects.
I’m using Lemur with Java 21 in my fork of the jme-vehicles repo.
To make this work, my build script specifies version 3.0.19 of Groovy:
(This script overrides what’s specified in Lemur POM.)
If you are getting that error then somewhere in YOUR build files you have an older groovy (the scripting language) dependency. Lemur will use whatever GROOVY you have in YOUR dependencies and does not directly specify a dependency of its own.
Yes, you’re right. I do have a groovy dependency in my build.gradle. Presumably put there when I first started using Lemur then forgotten about. Increasing its version indeed resolves the issue.