Pet*_*sik 14 java compilation maven
有没有办法如何通过命令行将编译器参数传递给Maven?我知道我可以指定它compiler-plugin但我也想从命令行运行Xlint.所以我尝试了类似的东西
mvn clean install -DskipTests=true -DcompilerArgument=-Xlint:deprecation
Run Code Online (Sandbox Code Playgroud)
但没有成功.
Paŭ*_*ann 28
对于这个具体情况(弃用警告),实际上有一个属性可以从命令行使用:
mvn clean install -Dmaven.compiler.showDeprecation=true
Run Code Online (Sandbox Code Playgroud)
与compilerArgument解决方案相反,这在maven进程中使用编译器时也有效,而不仅仅是在使用fork = true时.
同样有用的属性是maven.compiler.showWarnings.
Evg*_*eev 19
您可以像这样定义编译器插件:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgument>${compilerArgument}</compilerArgument>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
然后从命令行传递参数:
mvn -DcompilerArgument=-Xlint:deprecation compile
Run Code Online (Sandbox Code Playgroud)
如果你没有通过-DcompilerArgument,它将不会破坏构建,因为编译器插件参数中的'compilerArgument'将为空并被忽略.
| 归档时间: |
|
| 查看次数: |
8803 次 |
| 最近记录: |