Maven: Report using deprecated classes / methods

笑着哭i 提交于 2019-12-22 05:25:22

问题


I want to know if there is any kind of report on maven that show's me the classes and methods that I'm using that is deprecated.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/11331270/maven-report-using-deprecated-classes-methods

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