【问题标题】:missing artifact sun.jdk:tools:jar:1.6.0:system缺少工件 sun.jdk:tools:jar:1.6.0:system
【发布时间】:2012-08-17 09:43:16
【问题描述】:

我正在使用 mac,并在我的一个 pom 文件中看到了这个错误。我四处搜索并将以下部分添加到 pom.xml:

<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 上收到此错误。见this discussion。你能检查一下你的 pom 是否有任何对 tools.jar 的现有引用吗?
  • 在您的问题中,您引用了工件 sun.jdk:tools:jar:1.6.0:system,但您添加了对 com.sun:tools:1.6.0 的依赖项。对吗?

标签: maven pom.xml


【解决方案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 安装路径正确。

【讨论】:

  • -Dfile="C:\Program Files\Java\jdk1.6.0_27\lib\tools.jar"
猜你喜欢
  • 2018-04-16
  • 2014-12-12
  • 2012-01-12
  • 2012-02-18
  • 2014-01-04
  • 2013-07-12
  • 1970-01-01
  • 2015-05-08
  • 1970-01-01
相关资源
最近更新 更多