Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7510197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:09:28+00:00 2026-05-29T23:09:28+00:00

Update for the impatient: it’s simple, use package.- for sub-package scanning instead of package.*

  • 0

Update for the impatient: it’s simple, use package.- for sub-package scanning instead of package.*, as-per martoe’s answer below!

I cannot seem to get onlyAnalyze working for my multi-module project: regardless of what package (or pattern) I set, maven-findbugs-plugin doesn’t evaluate sub-packages as I’d expect from passing it packagename.*.

To prove either myself or the plugin at fault (though I always assume it’s the former!), I setup a small Maven project with the following structure:

pom.xml
src/
    main/java/acme/App.java
    main/java/acme/moo/App.java
    main/java/no_detect/App.java

which is very simple!

The POM has the following findbugs configuration:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>2.4.0</version>
            <executions>
                <execution>
                    <phase>verify</phase>
                    <goals><goal>findbugs</goal><goal>check</goal></goals>
                </execution>
            </executions>
            <configuration>
                <debug>true</debug>
                <effort>Max</effort>
                <threshold>Low</threshold>
                <onlyAnalyze>acme.*</onlyAnalyze>
            </configuration>
        </plugin>
    </plugins>
</build>

and every App.java has the following code with two obvious violations:

package acme;
import java.io.Serializable;

public class App implements Serializable
{
    private static final class NotSer {
        private String meh = "meh";
    }

    private static final NotSer ns = new NotSer();// Violation: not serializable field

    public static void main( String[] args )
    {
        ns.meh = "hehehe";// Vilation: unused
        System.out.println( "Hello World!" );
    }
}

Note that no_detect.App has the same content as above, but my expectation is that it wouldn’t be evaluated by findbugs because I have the “onlyAnalyze” option set to acme.* which I assume would evaluate acme.App and acme.moo.App and nothing else.

I now execute a mvn clean install to clean, build, test, run findbugs, package, install, which produces the following findbugs report (snipped for brevity) and results in a build failure which is expected because acme.App and acme.moo.App:

<BugInstance category='BAD_PRACTICE' type='SE_NO_SERIALVERSIONID' instanceOccurrenceMax='0'>
<ShortMessage>Class is Serializable, but doesn't define serialVersionUID</ShortMessage>
<LongMessage>acme.App is Serializable; consider declaring a serialVersionUID</LongMessage>
<Details>
  &lt;p&gt; This field is never read.&amp;nbsp; Consider removing it from the class.&lt;/p&gt;
</Details>
<BugPattern category='BAD_PRACTICE' abbrev='SnVI' type='SE_NO_SERIALVERSIONID'><ShortDescription>Class is Serializable, but doesn't define serialVersionUID</ShortDescription><Details>
<BugCode abbrev='UrF'><Description>Unread field</Description></BugCode><BugCode abbrev='SnVI'><Description>Serializable class with no Version ID</Description></BugCode>

To summarise: only acme.App is analysed, acme.moo.App isn’t (bad) and neither is no_detect.App (good).

I tried with two wildcards in the onlyAnalyze option but that produces a successful build but with a findbugs error (Dangling meta character '*' etc).

I tried with onlyAnalyze set to acme.*,acme.moo.* which analyzes all the expected classes (acme.App and acme.moo.App) which means it “works” but not as I expect; i.e. I have to explicitly declare all parent-packages for the classes I want to analyze: that could get large and difficult to maintain on a multi-module project!

Do I have to define every package I want analyzed, or can I declare a wildcard/regex pattern that will do what I want?

I’d rather not use the inclusion/exclusion XML because that requires far more setup and reasoning that I don’t currently have time for…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:09:30+00:00Added an answer on May 29, 2026 at 11:09 pm

    To cite the Findbugs manual: “Replace .* with .- to also analyze all subpackages”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: Solved, with code I got it working, see my answer below for the
UPDATE - No need to answer this now, I have solved below. Hi, I'm
Update: Now that it's 2016 I'd use PowerShell for this unless there's a really
UPDATE: IParcelable apparently cannot currently be implemented in Mono for Android . In the
UPDATE: Thanks for the answers! I can't seem to figure it out, even with
[update: I am using MySQL 4.1.25 ] I think this must be a simple
UPDATE - I'm probably being daft, see my last update below. I just did
UPDATE : Answer at the bottom. Hi Guys, How to initialize an 'array of
Update Mr Wizard's answer gives pixel-perfect results, but it is Windows-only and destroys the
UPDATE 11/18/2011 Check the accepted answer. It works and its a life saver! Hey

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.