Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove SuppressFBWarnings annotations from released jar-s?

As you might know, SuppressFBWarnings annotations are retained in the class files, but aren't needed on runtime, so FindBugs doesn't become a runtime dependency of your project. Unfortunately, those reatined annotations cause compilation warnings like this for Gradle users who use the project as dependency:

warning: Cannot find annotation method 'value()' in type
'SuppressFBWarnings': class file for
edu.umd.cs.findbugs.annotations.SuppressFBWarnings not found

Note that Maven users don't get any warnings (with the default javac configuration). But of course I can't ignore Gradle users.

So it seems I have to remove those annotations from the release builds somehow. But I can't find any existing solution, which is strange. How do others deal with this problem?

like image 630
ddekany Avatar asked May 24 '16 19:05

ddekany


1 Answers

With Gradle, you can get rid of such warnings from released Jars via,

compileOnly 'com.google.code.findbugs:annotations:3.0.1'
like image 143
Firewall_Sudhan Avatar answered Oct 17 '22 11:10

Firewall_Sudhan