【发布时间】:2013-02-08 12:26:54
【问题描述】:
我在我的 web 项目中使用 maven 这就是我的 pom.xml 的样子 我使用 eclipse juno,使用 apache tomcat 7,我正在运行 windows xp OS,“C:\Program Files\Java\jdk1.6.0_23\lib”是我的工具 jar 所在的位置。我尝试在 pom.xml 中对其进行硬编码,但它正在告诉无法硬编码。使用配置文件尝试以下仍然相同的错误“缺少工件 com.sun:tools:jar:1.5.0”请帮助我受够了 1 周的谷歌搜索
</dependencies>
<profiles>
<profile>
<id>default-tools.jar</id>
<activation>
<property>
<name>java.vendor</name>
<value>Sun Microsystems Inc.</value>
</property>
</activation>
<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>
</profile>
</profiles>
</project>
I:\eclipse-jee-juno-RC3-win32\workspace\MYProject>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MYProject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.594s
[INFO] Finished at: Sat Feb 23 20:49:53 GMT+05:30 2013
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MYProject: Could not resolve dependencies for project MYProject:MYProject:war:0.0.1-SNAPSHOT: Failure to find com.sun:tools:jar:1
.5.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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
'cmd' is not recognized as an internal or external command,
operable program or batch file.
I:\eclipse-jee-juno-RC3-win32\workspace\MYProject>
【问题讨论】:
-
您发布的日志似乎与您描述的问题无关。在清理阶段出现错误。文件
Company.hbm.xml可能正在被其他进程使用。 -
@ben75 你说得对,我已经解决了这个问题,现在我遇到了 com.sun:tools:jar 问题你可以检查我是否编辑了我的帖子
-
您的系统路径看起来很可疑。我认为它的 ${java.home}/lib/tools.jar。顺便提一句。你的 JAVA_HOME 设置正确了吗?
-
确保您的 ${java.home} 是 C:\Program Files\Java\jdk1.6.0_23\jre。如果您的 java.home 有问题,您可以尝试在 systemPath 元素中硬编码完整路径:C:\Program Files\Java\jdk1.6.0_23\lib\tools.jar
-
对我有帮助的快速解决方案是将 JRE 指向 JDK 文件夹中可用的那个。