Using Maven 2, is there a way I can list out the jar dependencies as just the file names?
mvn dependency:build-classpath
can list the jar
Here is an awk script to pipe mvn dependency:list:
mvn dependency:list | awk -f mvnfmt.awk
You can | sort if you want to sort by name, or | tr '\n' ':' to format it to a classpath.
mvnfmt.awk is:
BEGIN {
found = 0
}
/The following files have been resolved/ {
found = 1
next
}
/^\[INFO\] \$/ {
print "Empty " found
if (found != 0) found = 0
}
{
if (!found) next
n = split($0, a, " ")
if (n != 2) {
found = 0
next
}
split(a[2], a, ":")
print a[2] "-" a[4] "." a[3]
}
This command will generate the dependencies tree of your maven project:
$ mvn dependency:tree
I am sure that you will like the result :-)
Maven can build the classpath in your manifest automatically: http://maven.apache.org/guides/mini/guide-manifest.html
It's a configuration of the Maven archive plugin.