Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one determine the origin of a given Maven dependency?

Given a local Maven repository, can one determine the remote repository that is the source of a particular dependency? How?

like image 697
Derek Mahar Avatar asked May 20 '10 20:05

Derek Mahar


3 Answers

As mentioned by @Eugene, the origin of a dependency isn't stored anywhere so the only way to find this after the fact (if you're not behind a corporate repository) would be to purge the dependencies of a given project and to re-resolve them. The following goal of the Maven Dependency Plugin can do that:

mvn dependency:purge-local-repository -DreResolve=true

Note that reResolve is set to true by default, I just mentioned it for documentation purposes.

like image 53
Pascal Thivent Avatar answered Oct 10 '22 22:10

Pascal Thivent


Maven don't store such information. However if you purge your local repository and run your project build you can see the actual repository url when artifact is downloaded during Maven build.

However if you are using Maven repository manager like Nexus you can search artifact by its id, version, etc and then see artifact source in the search results.

like image 34
Eugene Kuleshov Avatar answered Oct 10 '22 20:10

Eugene Kuleshov


You could delete the dependency from your local repository and then see where it pulls from on your next build.

like image 29
digitaljoel Avatar answered Oct 10 '22 21:10

digitaljoel