2012-08-22 25 views
1

我使用mac並在我的一個pom文件中看到此錯誤。我用Google搜索周圍,並添加以下部分到pom.xml中:失蹤神器sun.jdk:工具:jar:1.6.0:系統

<profiles> 
    <profile> 
     <id>osx</id> 
     <activation> 
     <os> 
      <family>mac</family> 
     </os> 
     </activation> 
     <properties> 
     <toolsjar>${java.home}/../Classes/classes.jar</toolsjar> 
     </properties> 
    </profile> 
    </profiles> 

... 
<dependency> 
    <groupId>com.sun</groupId> 
    <artifactId>tools</artifactId> 
    <version>1.6.0</version> 
    <scope>system</scope> 
    <systemPath>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar</systemPath> 
</dependency> 
    ... 

然後,當我跑

mvn clean install -Posx 

我仍然得到了同樣的錯誤。請幫忙!

+0

你不應該在Mac上得到這個錯誤。參見[本討論](http://mail-archives.apache.org/mod_mbox/maven-users/201204.mbox/%[email protected].com%3E)。你能檢查你的pom是否有任何對'tools.jar'的引用嗎? – Raghuram

+0

在你的問題中,你引用了工件sun.jdk:tools:jar:1.6.0:system,但是你爲com.sun:tools:1.6.0添加了一個依賴項。那是對的嗎? – kothvandir

回答

1

使用以下命令將tools.jar從安裝的JDK位置安裝到Maven存儲庫。

$mvn install:install-file -DgroupId=sun.jdk -DartifactId=tools -Dpackaging=jar -Dversion=1.6 -Dfile=C:\Program Files\Java\jdk1.6.0_27\lib\tools.jar 

注意:確保JDK安裝路徑在上述命令中是正確的。

+0

缺少引號 – cproinger

+0

資格標記表示。 –

+0

-Dfile =「C:\ Program Files \ Java \ jdk1.6.0_27 \ lib \ tools.jar」 – cproinger