I have a Mojo that needs to work with Maven 3.0.* and 3.1+

In the Mojo I have an Artifact and I need to resolve it's dependencies. How
can/should I do it?

If I can resolve the Artifact to a MavenProject then I can use
DependencyGraphBuilder (from maven-dependency-tree) to construct a graph of
the deps. But I'm struggling to make the Artifact to MavenProject
conversion happen.

I thought that If I could get a URL to the Artifact's POM file then I could
use DefaultMavenRuntime (maven-runtime) to resolve the URL into a
MavenProject. But

   1. I can't work out how to get a URL to the artifact's POM file (it
   needs to handle both reactor deps and repo deps)
   2. Even with a URL to the POM file, MavenRuntime#getProject) is
   returning null.

Can someone please point me in the right direction?
Am I even on the right path or is there a much more straight forward way of
getting the dependencies for the Artifact?

William

Reply via email to