Closed dantam74 closed 1 year ago
https://askubuntu.com/questions/1367854/when-compiling-a-project-maven-throws-an-error
you need to use a newer version of maven for jdk17.
Thanks. I can confirm that it works well on maven 3.9.5. Maven 3.6.3 is the distribution included version in both Ubuntu 20 and 22 so I'm making a small pull-request for the README.md
Running "mvn verify" is part of the setup-script and it creates paths and files needed later. Trying to run it using openjdk-1.17 causes an error as below:
daniel@daniel:~/github/idempiere-dev-setup/idempiere$ mvn verify [ERROR] Error executing Maven. [ERROR] java.lang.IllegalStateException: Unable to load cache item [ERROR] Caused by: Unable to load cache item [ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper [ERROR] Caused by: Exception com.google.inject.internal.cglib.core.$CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @69a10787 [in thread "main"] daniel@daniel:~/github/idempiere-dev-setup/idempiere$ mvn -version Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 17.0.8.1, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64 Default locale: sv_SE, platform encoding: UTF-8 OS name: "linux", version: "5.10.0-1008-oem", arch: "amd64", family: "unix"
Changing to Java 11 avoids the error (will give warning instead)
daniel@daniel:~/github/idempiere-dev-setup/idempiere$ mvn verify WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release [INFO] Scanning for projects... [INFO] Resolving target definition file:/home/daniel/github/idempiere-dev-setup/idempiere/org.idempiere.p2.targetplatform/org.idempiere.p2.targetplatform.target for environments=[linux/gtk/x86_64, win32/win32/x86_64, macosx/cocoa/x86_64], include source mode=honor, execution environment=StandardEEResolutionHints [executionEnvironment=OSGi profile 'JavaSE-11' { source level: 11, target level: 11}], remote p2 repository options=org.eclipse.tycho.p2.remote.RemoteAgent@38856d6e...