我有一个自定义的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'
我该如何在插件执行中启用预览功能?