[Comment Edited] (SUREFIRE-720) Toolchain is ignored

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Comment Edited] (SUREFIRE-720) Toolchain is ignored

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/SUREFIRE-720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16395154#comment-16395154 ]

Volkert de Buisonjé edited comment on SUREFIRE-720 at 3/12/18 12:33 PM:
------------------------------------------------------------------------

[~tibor17] I encountered this issue when I had the *forkCount* parameter configured in the configuration section. I've reproduced this in versions 2.20.1 and 2.21.0 of the Maven Surefire Plugin, running Maven itself on JDK 8 and requiring a JDK 9 toolchain in the POM.

The following appears in the log after the build phase, seemingly confirming that Surefire is acknowledging and will use the configured toolchain:
{code:java}
[INFO] Toolchain in maven-surefire-plugin: JDK[/usr/java/jdk-9.0.1]{code}
Yet the build fails with an *UnsupportedClassVersionError*, since the test class that Surefire tries to run was compiled with JDK 9 (1.9), yet Surefire tries to run it using the JDK version on which Maven itself is running, which is JDK 8. With the forkCount parameter, Surefire seems to be behaving as if there are no Toolchains configured in the POM at all.

Presumably, there is a bug in Maven causing forkCount to fork from the process (and JDK) running Maven, instead of spawning a JVM using the JDK specified as the required toolchain and forking from there.

Just in case, I'm sharing the entire Maven Surefire configuration from our project below.
{code:xml}
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <useSystemClassLoader>false</useSystemClassLoader>
        <perCoreThreadCount>false</perCoreThreadCount>
        <forkCount>2.0C</forkCount> <!-- FIXME: this option apparently breaks toolchains. -->
        <reuseForks>true</reuseForks>
        <threadCount>20</threadCount>
    </configuration>
</plugin>{code}
Should this issue be reopend, or would you like me to create a separate issue for this instead?

Thank you in advance for looking into this.


was (Author: volkert):
[~tibor17] I encountered this issue when I had the *forkCount* parameter configured in the configuration section. I've reproduced this in versions 2.20.1 and 2.21.0 of the Maven Surefire Plugin, running Maven itself on JDK 8 and requiring a JDK 9 toolchain in the POM.

The following appears in the log after the build phase, seemingly confirming that Surefire is acknowledging and will use the configured toolchain:
{code:java}
[INFO] Toolchain in maven-surefire-plugin: JDK[/usr/java/jdk-9.0.1]{code}
Yet the build fails with an *UnsupportedClassVersionError*, since the test class that Surefire tries to run was compiled with JDK 9 (1.9), yet Surefire tries to run it using the JDK version on which Maven itself is running, which is JDK 8. With the forkCount parameter, Surefire seems to be behaving as if there are no Toolchains configured in the POM at all.

Presumably, there is a bug in Maven causing forkCount to fork from the process (and JDK) running Maven, instead of spawning a JVM using the JDK specified as the required toolchain and forking from there.

Just in case, I'm sharing the entire Maven Surefire configuration from our project below.
{code:java}
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <useSystemClassLoader>false</useSystemClassLoader>
        <perCoreThreadCount>false</perCoreThreadCount>
        <forkCount>2.0C</forkCount> <!-- FIXME: this option breaks toolchains. -->
        <reuseForks>true</reuseForks>
        <threadCount>20</threadCount>
    </configuration>
</plugin>{code}
Should this issue be reopend, or would you like me to create a separate issue for this instead?

Thank you in advance for looking into this.

> Toolchain is ignored
> --------------------
>
>                 Key: SUREFIRE-720
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-720
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.7, 2.7.1, 2.7.2, 2.8
>         Environment: Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
> Maven home: C:\Users\alex\Software\apache-maven-3.0.3\bin\..
> Java version: 1.6.0_19, vendor: Sun Microsystems Inc.
> Java home: C:\Users\alex\Software\jdk1.6.0_19\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
>            Reporter: Jun
>            Assignee: Tibor Digana
>            Priority: Major
>             Fix For: 2.9
>
>         Attachments: SurefireToolchains.zip
>
>
> The following debug output demonstrates the problem:
> ...
> [INFO] Toolchain in compiler-plugin: JDK[C:/Users/alex/Software/jdk1.5.0_22]
> ...
> [INFO] Toolchain in surefire-plugin: JDK[C:/Users/alex/Software/jdk1.5.0_22]
> [WARNING] Toolchains are ignored, 'executable' parameter is set to C:\Users\alex\Software\jdk1.6.0_19\jre\bin\java
> Forking command line: cmd.exe /X /C "C:\Users\alex\Software\jdk1.6.0_19\jre\bin\java -jar
> ...
> Compiler plugin uses proper JDK, while Surefire falls back to default. The problem is not reproducible with Surefire 2.6 and 2.5.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)