[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 using JRE, as shown in:
Although JDK is selected, an error is returned. After reading the error, it is found 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.