You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "James Gough (JIRA)" <ji...@apache.org> on 2019/06/02 20:42:00 UTC
[jira] [Commented] (MTOOLCHAINS-28) Toolchain does not respect fork
[ https://issues.apache.org/jira/browse/MTOOLCHAINS-28?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16854107#comment-16854107 ]
James Gough commented on MTOOLCHAINS-28:
----------------------------------------
[~madmax25] I'm going to start trying to recreate this issue. If you have a small project you can zip and attach to this issue that would be great, otherwise I'll try go with what is above.
> Toolchain does not respect fork
> -------------------------------
>
> Key: MTOOLCHAINS-28
> URL: https://issues.apache.org/jira/browse/MTOOLCHAINS-28
> Project: Maven Toolchains Plugin
> Issue Type: Bug
> Affects Versions: 1.1
> Environment: Java 11, JDK 1.8, Maven 3.5.0
> Reporter: Max Edmiston
> Priority: Major
>
> I am using maven-compiler-plugin with fork option, configured for Java 11 using the toolchain plugin. I have set my local environment to use JDK 1.8 by default. Forked process will use JDK 1.8, not Java 11, even with toolchain. I have tried this with and without the jdkToolchain xml tag in maven-compiler-plugin configuration.
> Relevant pom.xml:
>
> {code:xml}
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>${maven-compiler-plugin.version}</version>
> <configuration>
> <compilerId>groovy-eclipse-compiler</compilerId>
> <fork>true</fork>
> <compilerArguments>
> <javaAgentClass>lombok.launch.Agent</javaAgentClass>
> </compilerArguments>
> </configuration>
> <dependencies>
> <dependency>
> <groupId>org.codehaus.groovy</groupId>
> <artifactId>groovy-eclipse-compiler</artifactId>
> <version>${groovy-eclipse-compiler.version}</version>
> </dependency>
> <dependency>
> <groupId>org.codehaus.groovy</groupId>
> <artifactId>groovy-eclipse-batch</artifactId>
> <version>${groovy-eclipse-batch.version}</version>
> </dependency>
> <dependency>
> <groupId>org.projectlombok</groupId>
> <artifactId>lombok</artifactId>
> <version>1.18.6</version>
> </dependency>
> </dependencies>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-toolchains-plugin</artifactId>
> <version>1.1</version>
> <executions>
> <execution>
> <goals>
> <goal>toolchain</goal>
> </goals>
> </execution>
> </executions>
> <configuration>
> <toolchains>
> <jdk>
> <version>11</version>
> <vendor>openjdk</vendor>
> </jdk>
> </toolchains>
> </configuration>
> </plugin>
> {code}
>
> toolchains.xml:
> {code:xml}
> <?xml version="1.0" encoding="UTF8"?>
> <toolchains>
> <toolchain>
> <type>jdk</type>
> <provides>
> <version>11</version>
> <vendor>openjdk</vendor>
> </provides>
> <configuration>
> <jdkHome>/Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk/Contents/Home/</jdkHome>
> </configuration>
> </toolchain>
> </toolchains>
> {code}
> Sample error:
> {code:java}
> [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) ---
> [INFO] Toolchain in maven-compiler-plugin: JDK[/Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk/Contents/Home/]
> [INFO] Changes detected - recompiling the module!
> [INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files
> [INFO] Compiling in a forked process using /Users/max.edmiston/.m2/repository/org/codehaus/groovy/groovy-eclipse-batch/2.5.4-01/groovy-eclipse-batch-2.5.4-01.jar
> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR :
> [INFO] -------------------------------------------------------------
> [ERROR] Failure executing groovy-eclipse compiler:
> ----------
> 1. ERROR in ***Test.java (at line 39)
> ***.stream().findFirst().orElseThrow();
> ^^^^^^^^^^^
> The method orElseThrow(Supplier<? extends X>) in the type Optional<Thing> is not applicable for the arguments ()
> ...
> ----------
> 5 problems (5 errors)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)