maven - mvn compile: Unable to find package java.lang -
i have maven-compiler-plugin settings below:
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> <compilerarguments> <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath> </compilerarguments> </configuration> </plugin>
when executing mvn compile
, reports unable find package java.lang in classpath or bootclasspath
. find java.lang
package in /library/java/javavirtualmachines/jdk1.8/contents/home/jre/lib/rt.jar
:
java/lang/thread$uncaughtexceptionhandler.class java/lang/threadgroup.class java/lang/runnable.class java/lang/thread.class java/lang/ref/finalizer.class java/lang/ref/phantomreference.class java/lang/ref/finalreference.class java/lang/ref/weakreference.class java/lang/ref/softreference.class java/lang/ref/reference.class ......
i'm using oracle jdk 1.8 on os x 10.11.3. info should provide? problem jdk or project's maven setting?
edit:
export java_home=/library/java/javavirtualmachines/jdk1.8/contents/home
edit2:
different maven : unable find java.lang issue on os x, i'm using oracle jdk
edit3:
maven version
apache maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11t00:41:47+08:00) maven home: /usr/local/cellar/maven/3.3.9/libexec java version: 1.8.0_60, vendor: oracle corporation java home: /library/java/javavirtualmachines/jdk1.8.0_60.jdk/contents/home/jre default locale: en_us, platform encoding: utf-8 os name: "mac os x", version: "10.11.3", arch: "x86_64", family: "mac"
/library/java/javavirtualmachines/jdk1.8/contents/home
soft link /library/java/javavirtualmachines/jdk1.8.0_60.jdk/contents/home
shown in maven version info
<compilerarguments>
deprecated, that's not why it's not working. these types of arguments work if <fork>
set true
.
this works me:
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.8</source> <target>1.8</target> <fork>true</fork> <compilerargs> <arg>-bootclasspath</arg> <arg>${java.home}/lib/rt.jar${path.separator}${java.home}/lib/jce.jar</arg> </compilerargs> </configuration> </plugin>
Comments
Post a Comment