这是我的 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>
问题在于构建过程正常,但当测试被启动时,会出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on project foo-project: Execution default-test of goal 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 (class file version 57.65535). Try running with '--enable-preview' -> [Help 1]
我应该在pom.xml中插入什么内容以使用启用预览模式来执行测试?
谢谢。