[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Running findbugs within Maven

Posted on 2009-02-20
16
Medium Priority
?
1,567 Views
Last Modified: 2013-12-14
Dear all,

I'm trying to run findbugs from within a maven pom.xml file.

I can run the following maven command fine:

mvn findbugs:findbugs

and I get a successfull run.

But I would like to see something happening, like a report being produced or a warning for potential bugs.. just something.
[INFO] ------------------------------------------------------------------------
[INFO] Building MyCode
[INFO]    task-segment: [findbugs:findbugs]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing findbugs:findbugs
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [findbugs:findbugs]
[INFO]   No effort provided, using default effort.
[INFO]   Using normal threshold.
[INFO]   Using FindBugs Version: 1.2.1
[INFO]   Using normal threshold.
[INFO]   Using normal threshold.
[INFO]   Debugging is Off
[INFO]   No bug include filter.
[INFO]   No bug exclude filter.
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] ....................................... SUCCESS [8.937s]
[INFO] Shared ................................ SUCCESS [34.174s]
[INFO] Arkiv ................................. SUCCESS [6.375s]
[INFO] User Administration ................... SUCCESS [1.672s]
[INFO] Filpostkasse .......................... SUCCESS [2.110s]
[INFO] Webfaktura ............................ SUCCESS [34.423s]
[INFO] Common ................................ SUCCESS [22.830s]
[INFO] auth - WebSeal ........................ SUCCESS [5.578s]
[INFO] auth - BankId ......................... SUCCESS [4.141s]
[INFO] Branding .............................. SUCCESS [4.313s]
[INFO] Web Deployment test ................... SUCCESS [4.578s]
[INFO] Meny .................................. SUCCESS [6.657s]
[INFO] Mail .................................. SUCCESS [2.219s]
[INFO] Transhist ............................. SUCCESS [14.017s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 minutes 35 seconds
[INFO] Finished at: Fri Feb 20 09:55:40 CET 2009
[INFO] Final Memory: 46M/63M
[INFO] ------------------------------------------------------------------------

Open in new window

0
Comment
Question by:stephaneeybert
  • 8
  • 5
13 Comments
 

Author Comment

by:stephaneeybert
ID: 23705544
Hello,

I looked for more zones but could not find any.

I guess it's in the field of Java project automation.

Maven is cross platform Linux and Windows.

It is used to build software projects.

I can't think of anything more to tell you.

Sorry.

Thanks anyway.
0
 
LVL 92

Expert Comment

by:objects
ID: 23707067
whats your pom look like?

you need to specify the report details in the pom
http://mojo.codehaus.org/findbugs-maven-plugin/usage.html

0
 

Author Comment

by:stephaneeybert
ID: 23710958
Hi Savant,

Yes I'd seen that web page at the url you give.

But I couldn't figure out which value to specify in the xmlOutputDirectory property.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:stephaneeybert
ID: 23711028
Here is the result I get on my project when I run the command
mvn findbugs:findbugs

[INFO] Preparing findbugs:findbugs
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [findbugs:findbugs]
[INFO]   No effort provided, using default effort.
[INFO]   Using normal threshold.
[INFO]   Using FindBugs Version: 1.2.1
[INFO]   Using normal threshold.
[INFO]   Using normal threshold.
[INFO]   Using the xdoc format
[INFO]   No effort provided, using default effort.
[INFO]   Using normal threshold.
[INFO]   Using normal threshold.
[INFO]   Debugging is Off
[INFO]   No bug include filter.
[INFO]   No bug exclude filter.
[INFO] Printing Errors
[INFO] Printing Missing classes
[INFO] Printing Source Roots

And my pom.xml file plugin looks like:

            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>findbugs-maven-plugin</artifactId>
              <configuration>
                <threshold>Normal</threshold>
                <relaxed>true</relaxed>
                <xmlOutput>true</xmlOutput>
              </configuration>
            </plugin>
0
 
LVL 92

Expert Comment

by:objects
ID: 23716566
       directory location of findbugs xdoc xml report

0
 

Author Comment

by:stephaneeybert
ID: 23718520
Hi Savant,

Yepp I had seen that property only I don't know what to put in there.

It is an absolute path, relative to some project root..?

I guess I have to do some try and error..

Cheers
0
 
LVL 92

Expert Comment

by:objects
ID: 23718552
absolute is generally the safest, relative is typically relative to where it is being run

0
 

Author Comment

by:stephaneeybert
ID: 23718707
All right. Thanks. I shall try that.
0
 

Author Comment

by:stephaneeybert
ID: 23742720
Hello,

In fact I did not use the property xmlOutputDirectory and I could see the report anyway. I guess this property was not needed.

Thanks for the suggestion anyway.

Now I have an issue with my configuration of findbugs and maybe you would have an idea..

I'd like findbugs not to report the bugs of type UwF: Field not initialized in constructor (UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR)

http://findbugs.sourceforge.net/bugDescriptions.html#UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR

You would know how to configure findbugs so as it does not report these..?

Cheers
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 23750848
> In fact I did not use the property xmlOutputDirectory and I could see the report anyway. I guess this property was not needed.

depends if u are happy with default location or not

> You would know how to configure findbugs so as it does not report these..?

not sure if you can filter out specific bugs
the following option looks hopeful but it is not documented very well

        findbugs-exclude.xml


0
 

Author Comment

by:stephaneeybert
ID: 23753361
Yeah, there are the includeFilter and excludeFilter, but what to put in there.. I wonder how people can use findbugs with such a skinny doc..
0
 

Author Comment

by:stephaneeybert
ID: 23753368
Anyway, thanks for your kind suggestions, I can't have you wait any longer.
Cheers
0
 
LVL 92

Expert Comment

by:objects
ID: 23753444
yes its not documented real well, seems the way with a lot of maven plugins.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn how ViaSat reduced average response times for IT incidents from 10 minutes to 30 seconds.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question