Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Help with Findbugs and automated tests

2008-11-06
2013-02-05
  • Hi Guys,

    Great job on this piece of software, congratulations! 

    I trying to find an way to activate the Findbugs using a Test class.
    This way I can force the team to solve all problems that findbugs reports in order to make the build pass.

    I have a draft of this class:
    public class FindBugTester {
    public static void main(String[] args) throws Exception {
    System.setProperty ("findbugs.home", "c:\\temp\\");
    String args2[] = new String[] {"-outputFile", "c:\\temp\\test.txt", "C:\\work\\exam\\target\\classes\\"};
    FindBugs2.main(args2);
    }
    }

    But I'm getting the error:
    Exception in thread "main" java.lang.AssertionError: no analysis passes
    at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:806)
    at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:219)
    at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:1531)
    at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:987)
    at org.examcity.util.findbugs.FindBugTester.main(FindBugTester.java:20)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

    The version that I'm using is:
    <dependency>
    <groupId>net.sourceforge.findbugs</groupId>
    <artifactId>findbugs</artifactId>
    <version>1.3.2</version>
    <type>jar</type>
    </dependency>

    Any ideas?

    Thank you!