Javac 提供以下非标准选项(来自“javac -X”命令行帮助):
-Xplugin:"name args" Name and optional arguments for a plug-in to be run
Run Code Online (Sandbox Code Playgroud)
但是,Maven 不处理该格式。例如,以下内容不起作用:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-Xplugin:"Manifold static"</arg>
</compilerArgs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我尝试了几种不同的变体,并尝试用“=”替换空格,但仍然没有效果。有解决方法吗?
注意我正在使用带有 Java 8 的Manifold javac 插件。复制很简单..创建一个依赖于 manifold-all jar 的 pom:
<dependency>
<groupId>systems.manifold</groupId>
<artifactId>manifold-all</artifactId>
<version>0.9-alpha</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
您实际上不需要任何源,这只是为了证明 Maven 不会接受-Xplugin:"Manifold static"javac 参数。
另请注意,Java 9 似乎已更改了格式-Xplugin,不再需要引号。请参阅有关此内容的Java 9 文档。