Score:6

When compiling a project, Maven throws an error

in flag

OS Linux - Ubuntu 20.04.2 LTS When compiling a project, Maven throws an error

[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper

java -version

openjdk version "17" 2021-09-14 LTS
OpenJDK Runtime Environment (build 17+35-LTS)
OpenJDK 64-Bit Server VM (build 17+35-LTS, mixed mode, sharing)

mvn -version

Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 17, vendor: BellSoft, runtime: /usr/lib/jvm/bellsoft-java17-amd64
Default locale: ru_RU, platform encoding: UTF-8
OS name: "linux", version: "5.11.0-37-generic", arch: "amd64", family: "unix"

java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home'

java.home = /usr/lib/jvm/bellsoft-java17-amd64
in flag
There are many Linuxes. Which distro and version are you running?
Score:1
rs flag

Same issue i also faced.And i got the solution. Update latest maven version which is 3.8.3. With latest maven it is working.

mvn -v
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: /opt/maven
Java version: 17, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "5.10.0-1051-oem", arch: "amd64", family: "unix"
Score:1
us flag

I faced the same issue. Sadly I just could update to 3.6.3 via the package manager so I installed it manually. Steps to install on ubuntu below:

Maven 3.3+ requires JDK 1.7 or above to be installed.

Download Apache Maven. I installed 3.8.4, you can check for the newest version here: https://maven.apache.org/download.cgi

We save the archive to /tmp

$ TMP_MAVEN_VERSION=3.8.4
$ wget https://apache.org/dist/maven/maven-3/$TMP_MAVEN_VERSION/binaries/apache-maven-$TMP_MAVEN_VERSION-bin.tar.gz -P /tmp

Then unzip it to /opt and remove the archive

$ sudo tar xf /tmp/apache-maven-*.tar.gz -C /opt
$ sudo rm /tmp/apache-maven-*-bin.tar.gz

Next we create a sym-link

$ sudo ln -s /opt/apache-maven-$TMP_MAVEN_VERSION /opt/maven

Lastly we set up the env

$ sudo echo "export JAVA_HOME=/usr/lib/jvm/default-java
export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}" >> /etc/profile.d/maven.sh

To use it without restarting we make it executable and run in

$ sudo chmod +x /etc/profile.d/maven.shsource /etc/profile.d/maven.sh
$ source /etc/profile.d/maven.sh

Now you can verify that it is properly installed

$ mvn -v
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /opt/maven
Java version: 11.0.13, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.11.0-1022-aws", arch: "amd64", family: "unix"

derived by

Score:-1
br flag

As of 2021/10/25, maven is not supporting Java 17.

Create vi ~/.mavenrc file and give any version lower than 17.

export JAVA_HOME=/usr/lib/jvm/java-16-openjdk-amd64/

Digao avatar
gb flag
it didn't work here...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.