在确保火力和故障安全的情况下运行启用了预览功能的测试时出现问题
我正在尝试将一个项目迁移到Java 12,使用.--enable-preview
我在编译器设置中添加了:--enable-preview
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>12</release>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
</configuration>
</plugin>
并且还在 argLine 中添加了它,以确保火力和故障安全:
<properties>
<argLine>--enable-preview</argLine>
</properties>
并在以下情况下做一个结果:mvn clean verify
[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]
我还尝试将 argLine 直接添加到 surefire/failureafe 配置中,但结果是相同的。
我在这里错过了什么?
我是肯定火/故障安全中的错误吗?
编辑2:Surefire和故障安全配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<forkCount>2</forkCount>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<forkCount>2</forkCount>
</configuration>
</plugin>
编辑3:最小的工作示例在这里:https://github.com/krzyk/lombok-jdk10-example
项目失败,但当我删除它时可以工作。--enable-preview