I need (ultimately) a list of URLs corresponding to elements in a project's
classpath, where that classpath has been sorted in dependency order.  (I
don't actually care if it's sorted "ascending" or "descending".)

I need this for a mojo that I'm working on that will be run as part of an
ear project's generate-resources phase.

(Running mvn dependency:list or mvn dependency:build-classpath on such a
project gets all the right jar files in there, but not in dependency order.
That is, if the ear project depends on A which depends on B which depends on
C, mvn dependency:list will return C before B.)

I've noticed that Surefire seems to get this exactly right.  If you look at
the classpath when you're running a unit test, you'll notice that all
dependencies are in that classpath and in proper topological order.  But I
can't see an easy way to inherit from or use Surefire simply for this
purpose, nor, frankly, would I want to.

What's the best/sanctioned way to get this information?

Thanks,
Laird

Reply via email to