1

我想使用 maven 的 commons-lang,但是 apache 存储库不是,我在本地存储库中发布 commons-lang-src,但是是警告。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test (default-test) on project commons-lang: There are test failures.

怎么解决?

4

3 回答 3

3

这不是这样做的方法。正如您在这个 maven 镜像列表中看到的那样,commons/lang 源已经在镜像中心的所有 maven 存储库中可用,因此无需自己构建它们(顺便说一句:如果您构建项目,您正在安装已编译的二进制文件,而不是来源,所以即使是成功也不会帮助你)。

下面是如何做到这一点(假设你使用 eclipse):

  1. 如果您使用m2eclipse,只需右键单击项目并选择Maven -> Download Sources
  2. 如果您使用maven-eclipse-plugin,请参阅有关向库添加源的页面

如果你不使用 eclipse,我知道 NetBeans 和 IntelliJ Idea 有类似的插件。

于 2010-08-30T10:36:44.880 回答
2

repo1.maven.org 上有 commons-lang 二进制文件。

http://repo1.maven.org/maven2/commons-lang/commons-lang/

为什么不使用这个?

<dependency>
  <groupId>commons-lang</groupId>
  <artifactId>commons-lang</artifactId>
  <version>2.5</version>
</dependency>

希望这会帮助你。

于 2010-08-30T10:38:53.287 回答
1

作为@seanizer答案的补充,命令行解决方案是使用dependency:sources来自Maven Dependency Plugin的目标:

dependency:sources告诉 Maven 解析所有依赖项及其源附件,并显示版本。

因此,只需在命令行上对您的项目运行以下命令

mvn dependency:sources

并且 Maven 将下载依赖项的来源,如果它们存在的话。

于 2010-08-30T21:48:17.853 回答