I am trying to build a java extension for Wiremock...
# help
g
I am trying to build a java extension for Wiremock 3.5.4. When I try to run the wiremock server from the command line on a mac.
Copy code
java -cp merlin-wiremock-1.0-SNAPSHOT.jar:wiremock-standalone-3.5.4.jar  wiremock.Run --port 9999 --no-request-journal --global-response-templating --verbose > "stdout.log" --extensions MySpecialTransformer
I get this error UnsupportedClassVersionError: TitanDecryptTransformer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0 The jar for MySpecialTransformer was compiled using Java 17. I try to repackage using Java 11 (version 55) (clean package -DskipTests) but this fails in IntellliJ saying: Module my-wiremock SDK 11 is not compatible with the source version 17. Upgrade Module SDK in project settings to 17 or higher. Open project settings. I have changed all the InteliJ settings for the project described here. https://stackoverflow.com/questions/25878045/errorjava-invalid-source-release-8-in-intellij-what-does-it-mean/26009627#26009627 I still get the same error. Can anyone advise me how to build, package and run wiremock standalone with my custom java classes?
l
Not sure why that would be happening. It seems like you still have java 17. Could you run a
java --version
to see what version you are running or maybe try and remove intellij from the equation and running gradle from the command line ?
g
Hi and thanks. I am using maven not gradle. mvn clean package -DskipTests I have tried from the command line and get a similar error invalid target release: 17 I control the installed java version using sdk. java -version gives me openjdk version "11.0.22" 2024-01-16 LTS I am wondering what sets the target release version when I am compiling and packaging out side of Intellij...?
l
Do you have any
maven.compiler.source
or
maven.compiler.target
properties in your
pom.xml
?
g
That was it, IntelliJ must have set those automatically when I first created the project. It is working as expected now. Thank you!
l
No problem. Good luck with the extension
👍 1