on ubuntu 18.04, the latest maven version from apt is still Apache Maven 3.6.0, which doesn’t support jdk17, and we will get the above titled error when executing mvn install.
to fix this, we need to manually download and install apache-maven-3.8.5.
cd /tmp
wget https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz
tar xvf apache-maven-3.8.5-bin.tar.gzcd /usr/share/maven
sudo cp /tmp/apache-maven-3.8.5/* .
now we have
$ mvn -version
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Maven home: /usr/share/maven
Java version: 17.0.3, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-1072-aws", arch: "amd64", family: "unix"
verify
git clone https://github.com/WebGoat/WebGoat/
cd WebGoat/
mvn clean install -DskipTests[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.203 s
[INFO] Finished at: 2022-05-14T01:56:47Z
[INFO] ------------------------------------------------------------------------
how to uninstall openjdk8 on Mac
My openJDK was installed in /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
I run into the following error when trying to uninstall it on Mac:
$brew uninstall adoptopenjdk8
Error: Cask adoptopenjdk8 exists in multiple taps:
homebrew/cask-versions/adoptopenjdk8
adoptopenjdk/openjdk/adoptopenjdk8
I fixed this with
brew uninstall adoptopenjdk/openjdk/adoptopenjdk8
==> Uninstalling Cask adoptopenjdk8
==> Uninstalling packages; your password may be necessary:
net.adoptopenjdk.8.jdk
Password:
==> Purging files for version 8,292:b10 of Cask adoptopenjdk8