开发者

How to install commons-lang src to local repository?

开发者 https://www.devze.com 2023-01-14 07:14 出处:网络
I want to use the commons-lang by maven,but apache repository isn\'t ,I down commons-lang-src publish in local repository ,but is warning.

I want to use the commons-lang by maven,but apache repository isn't ,I down commons-lang-src publish in local repository ,but is warning.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test (default-test) on project commons-l开发者_开发技巧ang: There are test failures.

how to solve?


This is not the way to do it. As you can see in this maven mirror listing, the commons/lang sources are already available in all maven repositories that mirror central, so there is no need to build them yourself (BTW: if you build the project, you are installing the compiled binaries, not the sources, so even a success wouldn't have helped you).

Here's how to do it (Assuming you use eclipse):

  1. If you use m2eclipse, just right-click the project and select Maven -> Download Sources
  2. If you use the maven-eclipse-plugin see the page about adding sources to libs

If you don't use eclipse, I know there are similar plugins for NetBeans and IntelliJ Idea.


There are commons-lang binaries at repo1.maven.org.

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

Why don't use this?

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

Hope this will help you.


As an addition to @seanizer's answer, the command line solution is to use dependency:sources goal from the Maven Dependency Plugin:

dependency:sources tells Maven to resolve all dependencies and their source attachments, and displays the version.

So just run the following against your project on the command line

mvn dependency:sources

And maven will download the sources of dependencies, if they exist.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号