我在尝试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
答案 0 :(得分:11)
我想我发现了这个问题。
Apple已将rt.jar更改为位于。
的classes.jar /System/Library/Frameworks/JavaVM.framework/Versions / <your_java_version>
/类别/ classes.jar
我需要修改我的pom.xml以向它显示classes.jar的路径。
编辑:在一个多重项目中。创建lib目录中类jar的软链接要好得多。
sudo ln -s ../../Classes/classes.jar ./rt.jar
好sudo
因为写入/usr/libexec/java_home
命令的结果,这是您的java主目录,需要管理员权限。