0

I'm struggling with the following issue: I want to set up my ant for compiling Java source code. Everything works fine, but I also want to use the spotbugs / findpugs analyzing tool.

So in the manual is written:

 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>

Honestly, I don't know what they want from me. What is classname? I sat here for hours and didn't find a solution. Of course, spotbugs says the class cannot be found. What is precisely expected?

double-beep
  • 5,031
  • 17
  • 33
  • 41
wolfbiker1
  • 89
  • 4
  • The classname is the Java class that defines the new Ant task. If Ant is reporting that it can't find it, that means it doesn't exist in your classpath. Did you follow step 1 of the documentation and copy findbugs-ant.jar into your Ant installation's lib directory? http://findbugs.sourceforge.net/manual/anttask.html – CAustin Apr 01 '19 at 22:46
  • I am currently working on the same task. I believe you may have not copied the `spotbugs-ant.jar` file into your lib sub-directory of your Ant installation. Seen [here](https://spotbugs.readthedocs.io/en/stable/ant.html#installing-the-ant-task) in the instructions. Posted before seeing CAustin's comment. Same answer as his. – cbowling Apr 02 '19 at 16:57
  • Hey guys, wow, the problem that drives me crazy had an such banal reason. Thank you very much, i actually stored the wrong spotbugs file in the lib directory. So I still struggle with some problem according to the home directory, i hope that I can solve it by my self. Thanks :-) – wolfbiker1 Apr 03 '19 at 16:45

1 Answers1

1

Have you checked the official spotbugs document?

In your case, you need to add classpath attribute to let ant finds spotbugs-ant.jar. You also need to add <spotbugs> element to run spotbugs analysis.

Kengo TODA
  • 426
  • 4
  • 10