GlowstoneMC / Glowstone

A fast, customizable and compatible open source server for Minecraft: Java Edition
https://glowstone.net
Other
1.9k stars 273 forks source link

Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.Processor (in unnamed module @0x18c23b6) #467

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

Trying to get setup to build Glowstone, using latest commit from git (4506e5d39af45c0579e067390f3cd9689fca2f47 Fri Apr 28 14:48:58 2017 -0400), hitting this error:

+ mvn package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Glowstone 2017.4.0.32-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-maven) @ glowstone ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ glowstone ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 47 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ glowstone ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 915 source files to Glowstone/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.252s
[INFO] Finished at: Sun Apr 30 00:06:22 PDT 2017
[INFO] Final Memory: 22M/73M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project glowstone: Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.Processor (in unnamed module @0x18c23b6) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x18c23b6 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Details on my setup:

Made these changes to pom.xml:

Glowstone $ git diff
diff --git a/pom.xml b/pom.xml
index 59e95088..3d1e51ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <lwjgl.version>3.1.1</lwjgl.version>
         <joml.version>1.9.2</joml.version>
-        <bukkit.version>1.11.2-R0.1-SNAPSHOT</bukkit.version>
+        <bukkit.version>1.11.2-R0.1-20170427.113750-21</bukkit.version>
         <protocol.version>1.11.2</protocol.version>
     </properties>

@@ -63,7 +63,7 @@
         <dependency>
             <groupId>com.flowpowered</groupId>
             <artifactId>flow-network</artifactId>
-            <version>1.1.0-SNAPSHOT</version>
+            <version>1.0.0</version>
         </dependency>
         <dependency>
             <groupId>jline</groupId>
@@ -89,12 +89,12 @@
         <dependency>
             <groupId>org.jetbrains.kotlin</groupId>
             <artifactId>kotlin-runtime</artifactId>
-            <version>1.1-SNAPSHOT</version>
+            <version>1.0.4</version>
         </dependency>
         <dependency>
             <groupId>org.jetbrains.kotlin</groupId>
             <artifactId>kotlin-reflect</artifactId>
-            <version>1.1-SNAPSHOT</version>
+            <version>1.0.4</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>

Download dependencies to ~/.m2:

curl http://ci.emc.gs/nexus/content/repositories/aikar-release/co/aikar/fastutil-lite/1.0/fastutil-lite-1.0.pom -o ~/.m2/repository/co/aikar/fastutil-lite/1.0/fastutil-lite-1.0.pom
curl http://ci.emc.gs/nexus/content/repositories/aikar-release/co/aikar/fastutil-lite/1.0/fastutil-lite-1.0.jar -o ~/.m2/repository/co/aikar/fastutil-lite/1.0/fastutil-lite-1.0.jar
curl https://repo.glowstone.net/repository/internal/net/glowstone/glowkit/1.11.2-R0.1-SNAPSHOT/glowkit-1.11.2-R0.1-20170427.113750-21.pom -o ~/.m2/repository/net/glowstone/glowkit/1.11.2-R0.1-SNAPSHOT/glowkit-1.11.2-R0.1-20170427.113750-21.pom
curl https://repo.glowstone.net/repository/internal/net/glowstone/glowkit/1.11.2-R0.1-SNAPSHOT/glowkit-1.11.2-R0.1-20170427.113750-21.jar -o ~/.m2/repository/net/glowstone/glowkit/1.11.2-R0.1-SNAPSHOT/glowkit-1.11.2-R0.1-20170427.113750-21.jar

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project glowstone: Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.Processor (in unnamed module @0x598bf4da) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x598bf4da -> [Help 1]

Any hints on how to proceed. I searched for this error and found https://groups.google.com/forum/#!topic/project-lombok/RwuLlENLCQY which said to ensure your $JAVA_HOME is set correctly, I set mine to the java 9 sdk as follows but still hit the error:

JAVA_HOME=`/usr/libexec/java_home -version 9` mvn package

https://github.com/GlowstoneMC/Glowstone/issues/467

mastercoms commented 7 years ago

Don't change the pom. We require those versions specifically (that's why those versions are in the pom), and that's why it's not compiling for you. That Stack Overflow answer is completely wrong.

You need at least Java 8 update 101 to compile Glowstone because that's when Let's Encrypt was added to the Java truststore. We use Let's Encrypt on our Maven server. So, just remove those pom changes you did and do the Maven build with your Java 8 build 131 installation.

satoshinm commented 7 years ago

In case anyone was having this same error, the solution is to (not apply the workarounds from StackOverflow) and just update to Maven 3.5.0 from http://maven.apache.org.

Older versions of Maven (at least 3.0.5 which I was using) do not support SNI, so cannot connect to repo.glowstone.net which requires SNI. After updating to Maven 3.5.0 and using Java 1.8.0_131 I was able to build Glowstone!


Posted a correct answer to StackOverflow: http://stackoverflow.com/questions/40048767/glowstone-install-maven-peer-not-authenticated-could-not-resolve-dependencies/43709473#43709473