该javac命令可以通过在命令行上指定该文件来配置文件@:
javac @compileargs
Run Code Online (Sandbox Code Playgroud)
我想在 Maven 中使用该语法,以便我可以在这样的文件中收集部分命令行参数,而不是 Maven 的 pom.xml.
Maven 编译器插件似乎没有特定的标签,所以我尝试了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>
Run Code Online (Sandbox Code Playgroud)
但随后javac抱怨:
javac: invalid flag: @compile-args
Usage: javac <options> <source files>
use --help for a list of possible options
Run Code Online (Sandbox Code Playgroud)
不过,如果我得到 Maven 正在执行的实际命令(使用-X)并称其为我自己的工作。
背景信息:maven-compiler 依赖于plexus 编译器。
如果构建过程被分叉,它将采用所有指定的参数并自行创建一个临时配置文件(请参阅代码)。参数文件还将包含用户定义的参数文件,但文档指出:
不支持使用 at 符号 (@) 递归解释文件。
这意味着无法从 Maven 引用选项文件。
| 归档时间: |
|
| 查看次数: |
1756 次 |
| 最近记录: |