Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download sources for an specific JAR dependency of a Maven project

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:

  • Get source JARs from Maven repository
  • How to download sources for a jar with Maven?
  • http://tedwise.com/2010/01/27/maven-micro-tip-get-sources-and-javadocs/

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?

like image 518
Pablo Matias Gomez Avatar asked Jan 15 '15 19:01

Pablo Matias Gomez


1 Answers

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

like image 101
Pablo Matias Gomez Avatar answered Oct 20 '22 15:10

Pablo Matias Gomez