Maven: Report using deprecated classes / methods

*爱你&永不变心* 提交于 2019-12-05 08:17:20
Eugene Kuleshov

Normally you see deprecation warnings in the IDE, but you can also add showDeprecation parameter to the Maven compiler plugin section. Then those warnings will be shown in the log.

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-compiler-plugin</artifactId>
     <version>3.1</version>
     <configuration>
         <showDeprecation>true</showDeprecation>
     </configuration>
 </plugin>

Then you can generate build report from that javac output using reporting plugins on CI server. For example Jenkins Warning Plugin.

Sonar includes an engine called squid, which according to an article I found, locates and reports on usage of deprecated methods. I haven't used Sonar yet (it's on my list of things to learn) but teammates of mine like it a lot.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!