我使用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
我仍然得到了同樣的錯誤。請幫忙!
你不應該在Mac上得到這個錯誤。參見[本討論](http://mail-archives.apache.org/mod_mbox/maven-users/201204.mbox/%[email protected].com%3E)。你能檢查你的pom是否有任何對'tools.jar'的引用嗎? – Raghuram
在你的問題中,你引用了工件sun.jdk:tools:jar:1.6.0:system,但是你爲com.sun:tools:1.6.0添加了一個依賴項。那是對的嗎? – kothvandir