• Could not find artifact com.sun:tools:jar:1.5.0


    【maven package】,则依然报错,但报的是另外一个错误:
    [INFO] Scanning for projects…[INFO]                                          
    [INFO] Building Struts 2 Blank Webapp 1.0-SNAPSHOT[INFO]
    [INFO] BUILD FAILURE[INFO]
    [INFO] Total time: 0.547s[INFO] Finished at: Wed Apr 13 13:09:48 CST 2011[INFO] Final Memory: 2M/4M[INFO]
    [ERROR] Failed to execute goal on project my_struts: Could not resolve dependencies for project ricki.cheung.struts:my_struts:war:1.0-SNAPSHOT: Could not
    find artifact com.sun:tools:jar:1.5.0 at specified path C:\Program Files\Java\jre1.6.0_01/../lib/tools.jar -> [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

    后在网上查找解决方法,有外国网友说,在pom.xml添加如下依赖即可:
    <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>

    不过,我试过还是不行,另一个外国网友说,把eclipse中的【Windows】-【Preferences】-【Java】-【Install JREs】改为JDK,而不用JRE,如下图所示:
    Install JREs
    虽然我勾选了JDK,但还是报错,看了错误,发现在 C:\Program Files\Java\jre1.6.0_01/../lib/tools.jar无法找到tools:jar,这让我有点纳闷了,明明已经选了使用JDK了,怎么还去JRE那里找呢,于是我把【Windows】-【Preferences】-【Java】-【Install JREs】中的JRE给remove掉,再次【maven package】就OK了。

    作者:张锋
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。
    更多精彩文章可以观注
    微信公众号 soft张三丰

    微信交流群,添加群主微信,邀请入群
  • 相关阅读:
    如何用微软StreamInsight 处理和分析实时数据
    网站压力测试软件WebBench以及压测Jexus
    Xamarin 开源应用汇集
    微软开源 C++ REST SDK
    Visual Studio 2010/2012 Pro Power Tools
    深入浅出事件流处理NEsper(一)
    将Windows日志转换为Syslog
    事件流处理框架NEsper for .NET
    WCF技术剖析之二十一: WCF基本的异常处理模式[上篇]
    WCF技术剖析之二十一:WCF基本异常处理模式[下篇]
  • 原文地址:https://www.cnblogs.com/skyme/p/2146095.html
Copyright © 2020-2023  润新知