Missing artifact com.sun:tools:jar 1.5.0
在使用m2eclipse插件時,在pom.xml中添加struts2-core.jar包後,需要依賴java運行時的tools.jar進行依賴。但是,此時eclipse無法讀取tools包,出現如下錯誤:
Missing artifact com.sun:tools:jar 1.5.0
解決辦法一:
手動配置pom.xml,添加一個dependency如下:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<systemPath>${JAVA_HOME}/../lib/tools.jar</systemPath>
</dependency>
即可!
如果辦法不能解決,試用第二種方法。
解決辦法二:
首先,查看錯誤列表windows->Show View->Problems,在有以上問題的同時,還會出現該錯誤。
The container ‘Maven Dependencies‘ references non existing library ‘C:\Documents and Settings\DELL\.m2\repository\com\sun\tools\1.5.0\tools-1.5.0.jar‘
所以將C:\Program Files\Java\jdk1.6.0_10\lib\目錄下的tools.jar拷貝到C:\Documents and Settings\DELL\.m2\repository\com\sun\tools\1.5.0\目錄下,並將tools.jar改名為tools-1.5.0.jar,並在pom.xml中作如下配置:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
即可!
更多:http://www.javaxxz.com/thread-72464-1-1.html
解決辦法三:下載jar到本地C:\Users\Administrator\Desktop\,導入到maven中
cmd中輸入:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.2.0 -Dpackaging=jar -Dfile=C:\Users\Administrator\Desktop\ojdbc14-10.2.0.2.0.jar
導入到maven本地庫中。重新運行下maven update就OK了。
Missing artifact com.sun:tools:jar 1.5.0