gpt4 book ai didi

maven - 构建 Jenkins 插件时如何获取编译器警告

转载 作者:行者123 更新时间:2023-12-01 18:30:22 28 4
gpt4 key购买 nike

我正在编写一个 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

祝你好运!

关于maven - 构建 Jenkins 插件时如何获取编译器警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23770278/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com