You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 7, 2019. It is now read-only.
Obviously, the findbugs failed, and it printed out the reason:
[INFO] Dead store to a in org.rainbow.test.BugController.test() [org.rainbow.test.BugController] At BugController.java:[line 5] DLS_DEAD_LOCAL_STORE
Then, I wanted to ignore this bug. After reading the Filter File Doc, I just wrote the following exclude-file (named excludeFilter.xml, showed in the project structure):
I thought the bug should be ignored, but unfortunately, it was still there.
And then I ran the command again with -X option to see the detail:
mvn clean compile -X
The following is a snippet from the output of the above command:
[INFO] --- findbugs-maven-plugin:3.0.4:check (check) @ fb-test ---
[DEBUG] Configuring mojo org.codehaus.mojo:findbugs-maven-plugin:3.0.4:check from plugin realm ClassRealm[plugin>org.codehaus.mojo:findbugs-maven-plugin:3.0.4, parent: sun.misc.Launcher$AppClassLoader@d16e5d6]
[DEBUG] Configuring mojo 'org.codehaus.mojo:findbugs-maven-plugin:3.0.4:check' with basic configurator -->
[DEBUG] (s) classFilesDirectory = /home/rainbow/workspace/study/fb-test/target/classes
[DEBUG] (s) compileSourceRoots = [/home/rainbow/workspace/study/fb-test/src/main/java]
[DEBUG] (s) debug = false
[DEBUG] (s) effort = default
[DEBUG] (s) excludeFilterFile = /home/rainbow/workspace/study/fb-test/etc/excludeFilter.xml
[DEBUG] (s) failOnError = true
[DEBUG] (s) findbugsXmlOutput = true
[DEBUG] (s) findbugsXmlOutputDirectory = /home/rainbow/workspace/study/fb-test/target
[DEBUG] (s) fork = true
[DEBUG] (s) includeTests = false
[DEBUG] (s) localRepository = id: local
We can see that the check execution goal got the configuration excludeFilterFile, but it still printed out the bug:
[DEBUG] Executing findbugs:check
[DEBUG] Here goes...............Executing findbugs:check
[INFO] BugInstance size is 1
[INFO] Error size is 0
[INFO] Total bugs: 1
[INFO] Dead store to a in org.rainbow.test.BugController.test() [org.rainbow.test.BugController] At BugController.java:[line 5] DLS_DEAD_LOCAL_STORE
[INFO]
And at last, I tried to move the configuration to be outside of the execution node, as following:
Note:
Configurations inside the <executions> tag differ from those that are outside <executions> in that they cannot be used from a direct command line invocation.
Instead they are only applied when the lifecycle phase they are bound to are invoked.
Alternatively, if you move a configuration section outside of the executions section,
it will apply globally to all invocations of the plugin.
But I think the command mvn clean compile does not match the case of 'direct command line invocation'.
rainbow702
changed the title
findbugs-maven-plugin ignore the configuration inside the <execution> node
findbugs-maven-plugin ignores the configuration inside the <execution> node
Mar 21, 2017
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The following is my project structure:
The content of BugController.java is:
The pom.xml is like the following at the beginning:
Then, I ran the command:
Obviously, the findbugs failed, and it printed out the reason:
Then, I wanted to ignore this bug. After reading the Filter File Doc, I just wrote the following exclude-file (named excludeFilter.xml, showed in the project structure):
And I added a configuration to the plugin execution as following:
Then I ran the command again:
I thought the bug should be ignored, but unfortunately, it was still there.
And then I ran the command again with -X option to see the detail:
The following is a snippet from the output of the above command:
[INFO] --- findbugs-maven-plugin:3.0.4:check (check) @ fb-test --- [DEBUG] Configuring mojo org.codehaus.mojo:findbugs-maven-plugin:3.0.4:check from plugin realm ClassRealm[plugin>org.codehaus.mojo:findbugs-maven-plugin:3.0.4, parent: sun.misc.Launcher$AppClassLoader@d16e5d6] [DEBUG] Configuring mojo 'org.codehaus.mojo:findbugs-maven-plugin:3.0.4:check' with basic configurator --> [DEBUG] (s) classFilesDirectory = /home/rainbow/workspace/study/fb-test/target/classes [DEBUG] (s) compileSourceRoots = [/home/rainbow/workspace/study/fb-test/src/main/java] [DEBUG] (s) debug = false [DEBUG] (s) effort = default [DEBUG] (s) excludeFilterFile = /home/rainbow/workspace/study/fb-test/etc/excludeFilter.xml [DEBUG] (s) failOnError = true [DEBUG] (s) findbugsXmlOutput = true [DEBUG] (s) findbugsXmlOutputDirectory = /home/rainbow/workspace/study/fb-test/target [DEBUG] (s) fork = true [DEBUG] (s) includeTests = false [DEBUG] (s) localRepository = id: local
We can see that the check execution goal got the configuration excludeFilterFile, but it still printed out the bug:
[DEBUG] Executing findbugs:check [DEBUG] Here goes...............Executing findbugs:check [INFO] BugInstance size is 1 [INFO] Error size is 0 [INFO] Total bugs: 1 [INFO] Dead store to a in org.rainbow.test.BugController.test() [org.rainbow.test.BugController] At BugController.java:[line 5] DLS_DEAD_LOCAL_STORE [INFO]
And at last, I tried to move the configuration to be outside of the execution node, as following:
And the plugin worked fine, and the bug was ignored.
So, my question is: Is the way of configuration I tried a bug? Or, I misconfigured something? Or, I misunderstood the configuration of maven plugin?
The text was updated successfully, but these errors were encountered: