[Maven package], the error is still reported, but another error is reported:
[Info] scanning for projects... [Info]
[Info] building struts 2 blank webapp 1.0-Snapshot [info]
[Info] Build failure [info]
[Info] total time: 0.547 s [info] finished at: Wed APR 13 13:09:48 CST 2011 [info] final memory: 2 m/4 m [info]
[Error] failed to execute goal on Project my_struts: cocould not resolve dependencies for project Ricki. Cheung. Struts: my_struts: War: 1.0-snapshot: cocould 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
After finding a solution on the Internet, some foreign users said that you can add the following dependency to 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>
However, I have tried it, but another foreign user said that I should change [windows]-[Preferences]-[Java]-[install jres] in eclipse to JDK instead of JRE, as shown in:
Although I checked JDK, I still reported an error. After reading the error, I found it in c: \ Program Files \ Java \ jre1.6.0 _ 01 /.. /lib/tools. jar cannot find tools: jar, which makes me a little confused. I have already chosen JDK. How can I find it in JRE,So I removed the JRE from [windows]-[Preferences]-[Java]-[install jres] and [Maven package] again..