Does FindBugs Ant task require JAR?

FindBugs docs for Ant tasks are a bit confusing. I have traditionally always used FindBugs through the Eclipse plugin, where you simply select your project and click β€œFindBugs” to get the report.

Using the findbugs Ant task, there is a nested <class> element that:

A [n] is an additional nested element that determines which classes to parse.

Based on the examples I see, it looks like the FB actually requires you to JAR your project first before running the FB task on it.

Can someone confirm this and explain what a class element is? The description is rather vague for a novice like me to understand.

Secondly, and more importantly, the fact that my project is actually a Java web application (WAR) file.

So, if I am not mistaken, and if the FB should have a JAR for analysis, then my strategy would be to create a "temp JAR" of my project right inside the target <target name="findbugs"> and let it consist only of all my compiled Java classes. This will not execute and will simply match the FB and will be removed as part of a later build.

Am I really here? What is the standard working procedure for Java web application developers using FB in their Ant constructs? Thanks in advance!

+4
source share
1 answer

If you download FindBugs (in my case, version 2.0.1) and run gui from the included batch file, it limits the types of files that you can put into the project for analysis: inside the "New Project" dialog box, to "jar, war, ear supposedly sar. " So, in my opinion, zipping your .class files will be enough - after all, .jar is just the zip of your .class files in their folder structure, plus the manifest file.

However, if you open a folder with unencrypted source files, FindBugs will still try to perform the analysis.

[Refresh. I finally got the FindBugs ant task to work on my system. It definitely works on class files. It was a certain job to make it work, as there are some complex problems that require reading the source code to solve. For example, it is difficult to include your own banks, for example. To use log4j logging, some parameters that will help you are undocumented, and the minimum rank for an error message is quite high and cannot be reduced until I have tested it. If you have any problems, let me know, I am happy to help. ]

0
source

Source: https://habr.com/ru/post/1438155/


All Articles