Home > Software design >  How to copy maven dependency list from Eclipse as text
How to copy maven dependency list from Eclipse as text

Time:10-08

In Eclipse, when I open my pom.xml file and go to the "Dependency Hierarchy" tab, it shows two windows: Dependency Hierarchy and Resolved Dependencies.

Is there a way to copy/paste or export the list of dependencies shown in the Resolved Dependencies window into a text file, or a way to have maven print out an equivalent list on the command line?

Background: our team has been told we need to provide a list of all our dependencies and their versions, and it'd be a lot faster if there's a way to easily get a textual list of them vs having to manually type out each dependency and its version one by one into a spreadsheet. We have a lot of services and they all have a ton of dependencies when you need to list out the entire dependency tree.

CodePudding user response:

You can try mvn dependency:tree -Doutput=<path_to_file> to get dependencies in a file.

CodePudding user response:

It's more than just a list, but if you generate a Site it's all nicely documented. Just run

mvn site:site

inside the directory of your POM. You'll find the Site under target/site.


Little suggestion:

If your company wants to track the dependencies of applications, you shouldn't rely on lists or the like. Have a look into things like the dependency-check-maven plugin to scan for vulnerabilities during development and SBOM to track dependencies later.

  • Related