11

We are using Maven to build our projects and Nexus as repository manager.

Is there a way to know where an artifact is a dependency of another artifact?

For example, we want to know which of the artifacts in our Release repository have a dependency on commons-io 1.2, or version x.y of our framework2, or ...

Koohoolinn
  • 1,427
  • 6
  • 20
  • 29
  • Possible duplicate of [How to generate a graph of the dependency between all modules of a Maven project?](https://stackoverflow.com/questions/4084669/how-to-generate-a-graph-of-the-dependency-between-all-modules-of-a-maven-project) – Tomas Bjerre Jan 23 '18 at 14:31

3 Answers3

3

mvn dependency:tree should help you get this info.

Raghuram
  • 51,854
  • 11
  • 110
  • 122
  • This will only get the info for the project we run the command for. We want for a certain artifact to know where it is used as a dependency in all artifacts of our "Release" repository. – Koohoolinn Jan 14 '11 at 07:22
2

Have you looked at the Maven Site plugin in conjunction with the dependencies and dependencies-convergence report from the Maven Project Info Reports plugin?

This will generate an html report that shows all the artifacts that the project uses and what other artifacts that are dependent on that artifact.

jgifford25
  • 2,164
  • 1
  • 14
  • 17
  • The result doesn't respect the scope of the dependencies, i.e. test scoped dependencies are listed next to compile and runtime dependencies making the result not really helpful. Any idea to improve that? Documentation doesn't list parameters for that. Full feature solution with all scopes would be nice, but real compile dependencies would be enough for the moment. – jan Feb 06 '14 at 08:50
1

The Maven client will only tell you the dependencies of a single project. I'd recommend using Sonar as part of your build process. It's primarily used for source code analysis, but it will also report usage of a particular library by other projects in the same Sonar database.

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185