3

当我尝试mvn clean install 显然无法找到运行时 jar 时,我遇到了以下问题,但我需要做什么?

错误日志:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
[parsing started /Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/src/main/java/com/ericsson/research/ag/ra/common/cthserverclient/IHttpClient.java]
[parsing completed 42ms]
[parsing started /Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/src/main/java/com/ericsson/research/ag/ra/common/cthserverclient/CTHWebSessionException.java]
[parsing completed 1ms]
[parsing started /Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/src/main/java/com/ericsson/research/ag/ra/common/cthserverclient/CTHServerSession.java]
[parsing completed 14ms]
[search path for source files: /Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/src/main/java,]
[search path for class files: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/rt.jar,/Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/target/classes,/Users/olgunkaya/.m2/repository/json/json-simple/1.1/json-simple-1.1.jar,.]
Fatal Error: Unable to find package java.lang in classpath or bootclasspath

[INFO] 1error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.696s
[INFO] Finished at: Mon Jun 11 07:54:00 EEST 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3:compile > (default-compile) on project ag.ra.common: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] [parsing started /Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/src/main/java/com/ericsson/research/ag/ra/common/cthserverclient/IHttpClient.java]
[ERROR] [parsing completed 42ms]
[ERROR] [parsing started /Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/src/main/java/com/ericsson/research/ag/ra/common/cthserverclient/CTHWebSessionException.java]
[ERROR] [parsing completed 1ms]
[ERROR] [parsing started /Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/src/main/java/com/ericsson/research/ag/ra/common/cthserverclient/CTHServerSession.java]
[ERROR] [parsing completed 14ms]
[ERROR] [search path for source files: /Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/src/main/java,]
[ERROR] [search path for class files: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/rt.jar,/Users/olgunkaya/workspace/CM2H/remoteaccess/osgi/ag.ra.common/target/classes,/Users/olgunkaya/.m2/repository/json/json-simple/1.1/json-simple-1.1.jar,.]
[ERROR] Fatal Error: Unable to find package java.lang in classpath or bootclasspath
4

1 回答 1

11

我想我找到了问题所在。

Apple 已将 rt.jar 更改为位于其中的 classes.jar。

<your_java_version>/System/Library/Frameworks/JavaVM.framework/Versions/ /Classes/classes.jar

我需要修改我的 pom.xml 以显示 classes.jar 的路径。

编辑:在一个多模块项目中。在 lib 目录中创建指向类 jar 的软链接要好得多。

sudo ln -s ../../Classes/classes.jar ./rt.jar

好吧sudo,因为写入/usr/libexec/java_home命令的结果,即您的 java 主目录,需要管理员权限。

于 2012-06-11T06:29:45.560 回答