Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export maven dependency list to CSV

I would like to export a dependency list for a maven project to a CSV or TSV file.

I know that I can generate a dependency list as part of the "mvn site:site" command, but it is in a very inconvenient format for my needs.

I need a simple CSV file with at least these fields: name, version, download URL, license name, license URL

Is there any existing tool that makes that easy?

like image 810
Enwired Avatar asked Oct 25 '25 09:10

Enwired


1 Answers

I require name and version and this is the solution for me.

Unix offers multiple tools to deal with text. On Windows, open git bash and execute following command:

mvn -o dependency:list | grep ":.*:.*:compile" | sed "s/\[INFO\]    \([^:]*\):\([^:]*\):jar:\([^:]*\):compile/\1;\2;\3/" | sort -u

This outputs the compile dependencies as follows:

ch.qos.logback;logback-classic;1.1.1
ch.qos.logback;logback-core;1.1.1
com.fasterxml.jackson.core;jackson-annotations;2.8.6
like image 167
koppor Avatar answered Oct 27 '25 01:10

koppor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!