maven项目创建 tools.jar错误

创建 maven 项目

  pom.xml出错!

  运行时错误:

  12-7-26 下午05时01分20秒: Build errors for show; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project show: Could not resolve dependencies for project com.test:show:war:0.0.1-SNAPSHOT: Could not find artifact com.sun:tools:jar:1.5.0 at specified path D:\Program Files\Java\jre6/../lib/tools.jar
12-7-26 下午05时01分58秒: Maven Builder: AUTO_BUILD
12-7-26 下午05时02分22秒: Build errors for show; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project show: Could not resolve dependencies for project com.test:show:war:0.0.1-SNAPSHOT: Could not find artifact com.sun:tools:jar:1.5.0 at specified path D:\Program Files\Java\jre6/../lib/tools.jar
12-7-26 下午05时02分22秒: Maven Builder: FULL_BUILD requireFullBuild

 

解决方案:

在 pom.xml 添加

  <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId>
   <version>1.6.0</version> <scope>system</scope> <systemPath>D:/Program Files/Java/jdk1.6.0_11/lib/tools.jar</systemPath>
   </dependency>

重启 eclipse  在删除添加的代码 即可解决!

你可能感兴趣的:(maven)