天天看點

maven2內建struts2開發遇到的問題

最近到用eclipse通過maven2內建ssh開發, 當添加struts2-core的依賴時報了如下錯誤, 還在疑惑中...

[ERROR] Failed to execute goal on project Prjssh: [color=darkred]Could not resolve dependencies for project com.fei.ssh:Prjssh:war:1.0-SNAPSHOT: Could not find artifact com.sun:tools:jar:1.5.0 at specified path C:\Program Files\Java\jre6/../lib/tools.jar ->[/color] [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

着實讓我google了幾天, 問題幾天前解決了, 是因為java 運作環境(jre)的問題, 在java的安裝目錄下面有兩個j一樣的jre, 但是eclipse啟動的時候用的C:\Program Files\Java\jdk1.6.0_21\jre, 而工程build path用的是C:\Program Files\Java\jre6, 雖然他們一樣,但是互相引用不到, 把它們設定一至的就可以把問題解決