我有一个自定义的Maven插件,该插件利用了JDK 12预览功能。我将插件设置--enable-preview
编译为编译器arg,即
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<compilerArg>--enable-preview</compilerArg>
</compilerArgs>
</configuration>
</plugin>
当我想执行插件时,我将这样的插件添加到POM中:
<plugin>
<groupId>my.group</groupId>
<artifactId>my-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>my-goal</goal>
</goals>
</execution>
</executions>
</plugin>
但这失败了:
Preview features are not enabled for MyPluginMojo. Try running with '--enable-preview'
如何在插件执行中启用预览功能?
答案 0 :(得分:0)
对我来说,我必须在以下位置的构建目录中添加一个配置文件:
.mvn/jvm.config
包含:
-enable-preview