我正在使用 maven 构建一个新项目。我的代码中有一些警告,用黄线下划线。我希望 maven 可以在控制台中报告这些警告。我怎样才能做到这一点?我可以只在命令中添加一些参数,例如 mvn -XXX clean compile 吗?
最佳答案
<showDeprecation>
Sets whether to show source locations where deprecated APIs are used.
- Default value is:
false
- User property is:
maven.compiler.showDeprecation
<showWarnings>
Set totrue
to show compilation warnings.
- Default value is:
false
- User property is:
maven.compiler.showWarnings
-- Maven Doku
就像 mvn clean install -Dmaven.compiler.showDeprecation=true -Dmaven.compiler.showWarnings=true
一样简单全部在一行中。
您甚至可以删除 =true
部分原因是,当您使用 -D
添加 Maven 参数时它会自动将其值设置为 true
,如果未设置为其他内容。
关于java - Maven如何在编译时显示代码警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42641823/