javac
命令可以通过在命令行上使用@
指定该文件来配置文件:
javac @compileargs
我想在Maven中使用该语法,因此我可以在这样的文件中收集部分命令行参数,而不是Maven的pom.xml
。
Maven编译器插件does not seem to have是一个特定标记,所以我尝试了compilerArgs
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<compilerArgs>
<arg>@compile-args</arg>
</compilerArgs>
<fork>true</fork>
</configuration>
</plugin>
然后javac
抱怨:
javac: invalid flag: @compile-args
Usage: javac <options> <source files>
use --help for a list of possible options
如果我得到Maven正在执行的实际命令(使用-X
)并自己调用它,它会起作用。
我最近遇到了与spaces in compiler options类似的问题,所以我假设一个类似的过程在这里搞砸了我。
答案 0 :(得分:4)
背景信息:maven编译器取决于plexus compiler。
如果构建过程被分叉,它将获取所有指定的参数并自己创建一个临时配置文件(参见the code)。参数文件还将包含用户定义的参数文件,但documentation指出:
不支持使用at符号(@)递归解释文件。
这意味着无法从Maven引用选项文件。