You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Add maven enforcer rule for JDK version, as 12+ fails
Before:
```
[ERROR] Tests run: 8, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.040 s <<< FAILURE! -- in cz.habarta.typescript.generator.NamingTest
[ERROR] cz.habarta.typescript.generator.NamingTest.testCombinations -- Time elapsed: 0.032 s <<< ERROR!
java.lang.NoSuchMethodError: 'void sun.misc.Unsafe.ensureClassInitialized(java.lang.Class)'
at com.oracle.truffle.api.library.LibraryFactory.ensureLibraryInitialized(LibraryFactory.java:384)
```
Now, if you are not running Java 11:
```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.5.0:enforce (enforce-java-version) on project typescript-generator:
[ERROR] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion failed with message:
[ERROR] Detected JDK version 23.0.1 (JAVA_HOME=/opt/homebrew/Cellar/openjdk/23.0.1/libexec/openjdk.jdk/Contents/Home) is not in the allowed range [11,12).
```
Fixing it by appending the correct `JAVA_HOME`:
```
➤ JAVA_HOME=(/usr/libexec/java_home --version 11) mvn clean install
...
[INFO] BUILD SUCCESS
...
```
0 commit comments