我正在编写一个 Jenkins 插件,但对 Java 和 Maven 都是新手。
当我在 intelliJ 中构建插件时,我收到了我期望看到的所有编译器警告(例如弃用警告),但我找不到通过命令行进行编译的方法来显示这些警告(例如使用 mvn hpi:hpi / mvn 编译)
我尝试将以下几行添加到 Maven 设置文件的 maven-compiler-plugin 部分,但无济于事:
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
这样做的最终目的是在 jenkins 上编译插件并将警告输入到警告插件中。
您可以尝试的两个建议:
1) 添加编译器参数 -Xlint:all:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
2.) 尝试通过命令行传递参数,如下所示:
mvn clean install -Dmaven.compiler.showDeprecation=true
祝你好运!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)