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

Tibor Digana commented on SUREFIRE-1652:
----------------------------------------

[~krzyk]
> I don't understand why `argLine` doesn't work in this case?

+explanation:+
The {{argLine}} does what it has to do without any issue.
The plugin runs JUnit filter which finally selects relevant classes to run in 
one or multiple JVMs.
So the JUnit engine runs twice. Once in plugin JVM, and second in the forked 
JVM.

Due to the classes are compiled with different version than the version of Java 
runtime in Maven, this fails because Java in Maven does not understand it. 
Although version in forked JVM is totally fine and understands the the classes 
compiled by {{javac}} because {{javac}} and forked JVM start with the same 
option {{--enable-preview}}.
It is the same sa if you compiled your sources with Java 12 by 
{{maven-compiler-plugin}} using the toolchain and run the whole Maven build 
with Java 11. So the classes would be compiled with higher {{major version}} 
than JRE could understand in Maven process.

We have a wish to rework providers and perform the filtering inside of the 
forked JVM but this is very compilicate change and still questionary.

> surefire/failsafe fails with --enable-preview in java 12
> --------------------------------------------------------
>
>                 Key: SUREFIRE-1652
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1652
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Failsafe Plugin, Maven Surefire Plugin
>    Affects Versions: 3.0.0-M3
>            Reporter: Krzysztof Krason
>            Assignee: Tibor Digana
>            Priority: Blocker
>
> Minimal example: [https://github.com/krzyk/lombok-jdk10-example]
>  
> When I run the build `mvn clean verify` in the above repository I get 
> following error:
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) 
> on project lombok-jdk10: Execution default-test of goal 
> org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test failed: 
> java.lang.UnsupportedClassVersionError: Preview features are not enabled for 
> com/kirela/lombok/BarTest (class file version 56.65535). Try running with 
> '--enable-preview' -> [Help 1]
>  
> Tests work when I remove `--enable-preview` from compiler OR when I remove 
> "forkCount" from surefire (and failsafe) configuration.
> As I understand argLine property should be used in all forks, but appears to 
> be ignored, there is no difference if I use it as a property or as a 
> configuration paramater in surefire/failsafe.
>  
> This bug makes using Java 12 with preview features unusable with 
> surefire/failsafe.
>  



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

Reply via email to