在执行 "perform eclipse" 命令时,出现了 com.sun:tools:jar:1.4.2 丢失的错误提示。

5
当我在Roo中运行“perform eclipse”时,会得到以下结果:
roo> perform eclipse
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building bugzter
[INFO]    task-segment: [eclipse:clean, eclipse:eclipse]
[INFO] ------------------------------------------------------------------------
[INFO] [eclipse:clean {execution: default-cli}]
[INFO] Deleting file: .project
[INFO] Deleting file: .classpath
[INFO] Deleting file: .wtpmodules
[INFO] Deleting file: .component
[INFO] Deleting file: org.eclipse.wst.common.component
[INFO] Deleting file: org.eclipse.wst.common.project.facet.core.xml
[INFO] Deleting file: org.eclipse.jdt.core.prefs
[INFO] Deleting file: org.eclipse.ajdt.ui.prefs
[INFO] Preparing eclipse:eclipse
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.sun:tools:jar:1.4.2

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
      1) org.codehaus.mojo:aspectj-maven-plugin:maven-plugin:1.0
      2) com.sun:tools:jar:1.4.2

----------
1 required artifact is missing.

for artifact: 
  org.codehaus.mojo:aspectj-maven-plugin:maven-plugin:1.0

from the specified remote repositories:
  com.springsource.repository.bundles.release (http://repository.springsource.com/maven/bundles/release),
  com.springsource.repository.bundles.external (http://repository.springsource.com/maven/bundles/external),
  central (http://repo1.maven.org/maven2),
  codehaus.org (http://repository.codehaus.org),
  com.springsource.repository.bundles.milestone (http://repository.springsource.com/maven/bundles/milestone),
  com.springsource.repository.bundles.snapshot (http://repository.springsource.com/maven/bundles/snapshot),
  snapshots (http://snapshots.repository.codehaus.org)

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Wed Jul 28 20:57:52 CEST 2010
[INFO] Final Memory: 30M/298M
[INFO] ------------------------------------------------------------------------

尝试下载了tools-1.4.2.jar工具并运行mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file,但这并没有解决问题。我使用的是ubuntu 10.04和maven 2.2。有什么建议吗?
5个回答

5

将系统环境参数JAVA_HOME重新指向JDK(1.5+)目录而不是JRE。


4
根据Spring Source Roo和缺失的com.sun:tools:jar:1.4.2所述:

If you are trying to get the latest version of SpringSource ROO working, with an x64 Java JDK, such as the latest JDK 1.6 update 20, there is unfortunately a missing tools.jar from the default lib\ directory of the JDK (tut tut tut Sun/Oracle). This will prevent Roo from working and therefore prevent Maven compilation. You would probably see an error similar to this:

Error message: Missing:
----------
1) com.sun:tools:jar:1.4.2

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

----------
1 required artifact is missing.

To correct this error, install an additional x86 JDK, repoint the JAVA_HOME and the PATH to the new JDK and restart the mvn process


我想知道是否值得检查1.6更新21,看看他们是否添加了它。可能不会。 - Powerlord
@R.Bemrose:检查一下肯定是值得的,但我太懒了,不想在我的32位平台上安装64位JDK。 - Pascal Thivent
我得记住,当我回家的时候...我在那里安装了一个64位的Java 6u21 JDK;尽管是为Windows。 - Powerlord

1
在pom.xml文件中添加此依赖项。 在<systemPath>属性中,您需要编写JDK lib路径。
    <dependency>  
          <groupId>com.sun</groupId> 
           <artifactId>tools</artifactId>
        <version>1.4.2</version>
        <scope>system</scope>
        <systemPath>C:/Program Files/Java/jdk1.6.0_30/lib/tools.jar</systemPath>
    </dependency> 

1

我以为我已经将java_home设置为jdk,但我猜在Slackware中,jre和jdk都安装在同一个文件夹中。两者都安装导致了这个问题。我卸载了两个,并重新安装了jdk(为了安全起见),问题得到解决。


0

我之前也遇到了类似的问题,以下是我的解决方法。

在命令提示符中进入JDK安装路径下的lib目录。执行以下命令来安装tools.jar:$mvn install:install-file -DgroupId=sun.jdk -DartifactId=tools -Dpackaging=jar -Dversion=1.6 -Dfile=tools.jar

http://parameshk.blogspot.in


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接