I have a maven project which needs
import com.sun.tools.classfile.Dependencies;
I can build it successfully in IntelliJ. But when I build it outside using "mvn clean install". I got the error "Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ... package com.sun.tools.classfile
does not exist".
Package com.sun.tools.classfile
belongs to $JAVA_HOME/lib/tools.jar. and it exists under that directory. Seems that Intellij can find it but maven build could not find it. Anyone knows why it could happen?
My machine is Macbook pro. Here are the java version and maven verion on my box.
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)
mvn -version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /Users/wuming/apache-maven-3.8.1
Java version: 1.8.0_292, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
Thanks