我有一个自定义 Maven 插件,它利用 JDK 12 预览功能。我将插件设置编译--enable-preview为编译器参数,即
<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'
如何在插件执行中启用预览功能?
森栏
白衣非少年
MYYA
相关分类