这是我的 pom.xml:
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>13</source>
<target>13</target>
<release>13</release>
<compilerArgs>
--enable-preview
</compilerArgs>
</configuration>
</plugin>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<reuseForks>false</reuseForks>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
问题是构建正常,但是当测试启动时,我得到:
[错误] 无法在项目 foo-project 上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test):执行目标 org.apache.maven 的默认测试.plugins:maven-surefire-plugin:3.0.0-M4:test failed:java.lang.UnsupportedClassVersionError: Preview features are not enabled for it/project/MyTest(类文件版本 57.65535)。尝试使用 '--enable-preview' -> [帮助 1] 运行
我必须在 pom.xml 中插入什么来执行启用预览模式的测试?
谢谢。