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
**Please readuntil the end, for now I don't recommend the Maven toolchains as there appears to be a bug.**
521
-
522
520
Maven Toolchains can be used to configure the JDK's present on your machine and then select one to use in the `pom.xml` of the project.
523
521
524
522
First create a `toolchains.xml` located in *${user.home}/.m2/*
@@ -566,7 +564,6 @@ First create a `toolchains.xml` located in *${user.home}/.m2/*
566
564
```
567
565
568
566
Then in the `pom.xml` configure which JDK from the toolchains.xml you want to use:
569
-
570
567
```xml
571
568
<build>
572
569
<plugins>
@@ -593,18 +590,18 @@ Then in the `pom.xml` configure which JDK from the toolchains.xml you want to us
593
590
</build>
594
591
```
595
592
596
-
Unfortunately currently there seems to be a bug as building the project with the toolchain gives:
593
+
Make sure to update the Maven Compiler Plugin. When using an older version, combined with the Toolchains Plugin, the errors are not really detailed:
597
594
```shell script
598
595
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project broken: Compilation failure -> [Help 1]
599
596
```
600
597
601
-
While compiling without the toolchain gives the more descriptive error message:
598
+
When using a newer version of the Maven Compiler Plugin the error message provides more detailed information:
602
599
```shell script
603
-
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project broken: Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x21bd20ee) 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 @0x21bd20ee -> [Help 1]
600
+
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project lombok_broken: Compilation failure
601
+
[ERROR] java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @...) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironme
602
+
nt (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @...
604
603
```
605
604
606
-
So I don't recommend the usage of Maven Toolchains for upgrading to Java 16 or 17 at this point in time.
0 commit comments