Just a quick note.... Maven + dependencies + classpath

Just wanted to capture this for personal purpose…

How to find out/export the classpath from a maven project so that it can be used from scripts etc?

– Using the build-classpath goal of the Maven dependency plugin.

The parameter name maven.dep.cpFile given at the usage of this goal is deprecated and does not work. Its recommended to use the ouputFile parameter instead.

So some examples…

mvn dependency:build-classpath

prints the classpath in the console… and

mvn dependency:build-classpath -Dmdep.outputFile=cp.txt

puts the classpath in the file called cp.txt

Published 21 November 2008
comments powered by Disqus