Given a local Maven repository, can one determine the remote repository that is the source of a par开发者_运维知识库ticular dependency? How?
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.
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.
You could delete the dependency from your local repository and then see where it pulls from on your next build.
精彩评论