【发布时间】:2013-03-20 09:24:56
【问题描述】:
我是 Struts2 的新手。
每当我包含 Struts2 依赖项时,为什么我必须这样做?
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts.version}</version>
<exclusions>
<exclusion>
<artifactId>tools</artifactId>
<groupId>com.sun</groupId>
</exclusion>
</exclusions>
</dependency>
如果我不这样做,Eclipse Juno 在这一点上会给我错误。
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd
出现此错误:
Missing artifact com.sun:tools:jar:1.5.0
这是这样做的方法还是有更好的方法?
我注意到这个问题发生在 2.1.6 及更高版本。
【问题讨论】:
-
这很奇怪,我在几个项目中使用了 Struts 2,我不记得必须排除这个 com.sun.tools JAR...你使用的是什么版本的 Struts2?你是在命令行中使用 Maven 还是作为 Eclipse/Intellij 插件使用?
-
@PierreHenry 我正在使用 maven 插件。低于 2.1.6 的版本不会出现此错误。
-
如果你从命令行构建(没有排除),它是否也会给你这个“缺少工件”错误?
-
你可以在不排除任何东西的情况下解决这个问题:stackoverflow.com/a/19827445/363573