on my development machine i'm actively working on perhaps 20 inter-dependent maven projects, most of which get published to ossrh from time to time, and i also depend on many other projects from maven central
i'd like to list the dependencies that have been installed locally as opposed to those that have been downloaded from a repository. i'm aware that mvn -U
will check remote repositories for snapshot dependencies, but in many cases my versions aren't -SNAPSHOT
is there a way to tell which dependencies have been installed locally ?
The Local Repository Maven's local repository is a directory on the local machine that stores all the project artifacts. When we execute a Maven build, Maven automatically downloads all the dependency jars into the local repository. Usually, this directory is named . m2.
Maven local repository keeps your project's all dependencies (library jars, plugin jars etc.). When you run a Maven build, then Maven automatically downloads all the dependency jars into the local repository. It helps to avoid references to dependencies stored on remote machine every time a project is build.
The local repository has files of name _remote.repositories in the artifact directories. They are not a public interface, but they might allow you to reverse engineer where the artifacts came from.
@nqzero came up with the expression
mvn dependency:list -DoutputAbsoluteArtifactFilename -DoutputFile=/dev/fd/2 2>&1 1>/dev/null | grep -o "/.*/" | xargs -Ixxx grep -L "jar>central=$" xxx_remote.repositories
that actually does the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With