20

I want to do this because when I try to download the sources for a dependency with Eclipse it just does nothing and I want to know what's going on.

I read some posts and articles:

But none of these shows how to do this for a single dependency..

If I do it for all the dependecies in my project it may take a while and it is not what I want.

I want to execute a command like this:

mvn dependency:sources

But applied to only one of the project dependencies.

Is this possible?

Pablo Matias Gomez
  • 6,614
  • 7
  • 38
  • 72

2 Answers2

38

I just found out how to do this in the plugin's documentation:

http://maven.apache.org/plugins/maven-dependency-plugin/sources-mojo.html

I solved this using the following command:

mvn dependency:sources -DincludeGroupIds=com.example.api.agents -DincludeArtifactIds=api-agent-spark

Pablo Matias Gomez
  • 6,614
  • 7
  • 38
  • 72
0

If you use m2e (official maven support in Eclipse) you can change preferences to automatically download source and javadoc in your repository.

Link between downloaded jar and Java Editor is transparent.

You can see in the screenshot of "New checksum settings" that there are two checkboxes to download javadoc and source code. http://tools.jboss.org/blog/2014-07-08-m2e-1_5-improvements.html

Jabberwock
  • 256
  • 3
  • 7