Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spotbugs build issue

Built failed while creating aws-sdk-v2 jars due to spotbugs plugin.

Steps to reproduce the error: clone latest version of aws-sdk-java-v2 In terminal, go to directory and run mvn clean install

Error: Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:3.1.11:spotbugs (spotbugs) on project aws-sdk-java-pom: Execution spotbugs of goal com.github.spotbugs:spotbugs-maven-plugin:3.1.11:spotbugs failed: Unable to load the mojo 'spotbugs' in the plugin 'com.github.spotbugs:spotbugs-maven-plugin:3.1.11'. A required class is missing: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

I tried to rebuild the project by deleting spotbugs-maven-plugin but I that didn't solve the problem.

like image 647
Noura Avatar asked Nov 02 '25 06:11

Noura


2 Answers

I had no .mavenrc file yet, but recently had added Java 17 to test something via Home Brew. As a result, I started seeing this issue. I created a ~/.mavenrc and added the following to it:

JAVA_HOME=`/usr/libexec/java_home -v 1.8.0`

This allowed me to get back to using Java 8 with Maven just like my default Java version would be.

like image 53
jediwompa Avatar answered Nov 04 '25 20:11

jediwompa


I had a similar problem and it turned out my installation of Java 15 was the culprit. Once I got maven to use my standard java version (1.8 Corretto) I could build the project again. Use mvn -version to check which java it's currently using.

Personally I had to set JAVA_HOME in my .mavenrc file, setting it in my bash profile didn't help.

like image 33
cenedhryn Avatar answered Nov 04 '25 19:11

cenedhryn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!