others-How to solve Unable to parse configuration of mojo org.codehaus.mojo:findbugs-maven-plugin?

1. Introduction

In this post, I would demo how to solve the following error when you run mvn commands on a project with findbugs plugin:

[ERROR] Failed to execute goal org.codehaus.mojo:findbugs-maven-plugin:3.0.2:findbugs (findbugs) on project project1: Unable to parse configuration of mojo org.codehaus.mojo:findbugs-maven-plugin:3.0.2:findbugs for parameter pluginArtifacts: Cannot assign configuration entry 'pluginArtifacts' with value '${plugin.artifacts}' of type java.util.Collections.UnmodifiableRandomAccessList to property of type java.util.ArrayList -> [Help 1]

2. Environment

  • Maven 3.6.0+
  • findbugs-maven-plugin 3.0.2

3. The pom.xml

            Enables analysis which takes more memory but finds more bugs.
            If you run out of memory, changes the value of the effort element
            to 'Low'.
        <!-- Build fail if problems are found -->
        <!-- Reports all bugs (other values are medium and max) -->
        <!-- Produces XML report -->
        <!-- Configures the directory in which the XML report is created -->
            Ensures that FindBugs inspects source code when project is compiled.

4. How to solve this problem?

4.1 Downgrade your maven version

Because you are using 3.0.2 of findbugs-maven-plugin,it’s not compatible with maven 3.6.0+

Check your maven version by the following command:

➜  conf mvn --version
Apache Maven 3.6.0 ....
Maven home: /Users/bswen/tech/maven/apache-maven-3.6.0
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre

If you are using maven version greater than 3.6.0, you should downgrade the version of maven by downloading an old version from its official site.

The recommended version is 3.3.9.

4.2 Upgrade your findbugs-maven-plugin version

Upgrade your findbugs-maven-plugin to 3.0.4+, it’s compatible with your 3.6.0 maven installation.


5. Summary

Be careful if you want to use findbugs-maven-plugin with the latest version of maven.