21

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?

2 Answers 2

41

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.