缺少工件com.sun:工具:jar:1.5.0 maven

HkF*_*718 13 artifact maven

我在我的web项目中使用maven这是我的pom.xml看起来如何使用eclipse juno,使用apache tomcat 7,我运行windows xp OS,"C:\ Program Files\Java\jdk1.6.0_23\lib"是在我的工具罐子is.i试图在pom.xml中硬编码,但它在告诉着硬code.tried下面的使用配置文件仍然同样的错误"缺少神器的com.sun:工具:罐子:1.5.0"请请帮助我自谷歌搜索1周以来一直受够了

    </dependencies>
<profiles>
    <profile>
      <id>default-tools.jar</id>
      <activation>
        <property>
          <name>java.vendor</name>
          <value>Sun Microsystems Inc.</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>1.5.0</version>
          <scope>system</scope>
          <systemPath>${java.home}/../lib/tools.jar</systemPath>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

</project>


 I:\eclipse-jee-juno-RC3-win32\workspace\MYProject>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MYProject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.594s
[INFO] Finished at: Sat Feb 23 20:49:53 GMT+05:30 2013
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MYProject: Could not resolve dependencies for project MYProject:MYProject:war:0.0.1-SNAPSHOT: Failure to find com.sun:tools:jar:1
.5.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
'cmd' is not recognized as an internal or external command,
operable program or batch file.
I:\eclipse-jee-juno-RC3-win32\workspace\MYProject>
Run Code Online (Sandbox Code Playgroud)

小智 11

它与maven或pom无关.您正试图从eclipse运行maven,因此您需要确保在eclipse中正确配置JDK.我认为eclipse中提到的JDK版本并没有安装.因此,在eclipse中进行更改并将JRE系统库指向已安装的JDK路径.


小智 0

你能试一下吗

    <dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>1.5.0</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

或者尝试使用以下信息添加新的依赖项

组 ID:com.sun

工件 ID:工具

版本:1.5.0

这对我有用。