> Date: Fri, 20 Jun 2014 08:29:10 +1000
> Subject: Re: Resolving the dependencies for an Artifact
> From: william.fergu...@xandar.com.au
> To: dev@maven.apache.org
>
> Hi Robert,
>
> Use case is within the android-maven-plugin we need to generate artefacts
> for AAR (Android archive) dependencies when building a project.
>
> When doing so we need to provide the dependencies of the AAR (not the
> project) into the generation tool. We can readily retrieve the deps for the
> AAR by looking through the dependency graph of the project until we find
> the AAR that then collect deps from there on.
>
> This works fine for project (A) that has a dependency on B and C.
> But if A has dep on B & C and B also has a dep on C then it breaks because
> Maven's dependency resolution (for A, ie the project) will ignore the B->C
> dep because A->C is more direct. So when we look for the deps of B we never
> see C.
>
> NB maven-dependency-plugin uses maven-dependency-tree for its resolution,
> which is where I've taken most of my lead so far.
>
> It gets down to the context in which the resolution is being done. I need
> the context to be B instead of A and in order to do that I need to get the
> MavenProject for B. And this is where I am stuck.
MG>If I understand a prioritised dependency shortcut of A->B then B->C (instead
of A->C)?
MG>put this on the Jason's wishlist for Maven 4.x!
MG>does anyone know if Maven has ability to reorder the dependency graph?
>
> William
>
>
> On Fri, Jun 20, 2014 at 4:44 AM, Robert Scholte <rfscho...@apache.org>
> wrote:
>
> > Hi William,
> >
> > most of the time it's not necessary to find a specific file like this, so
> > I'm wondering what the usecase is.
> >
> > If you're hitting an issue, think of a plugin which might have the same
> > issue and have a look at its code.
> > In this case I'm thinking of the maven-dependency-plugin, especially the
> > code for dependency:tree.
> > Or use the org.apache.maven.project.ProjectBuilder
> >
> > thanks,
> > Robert
> >
> > Op Thu, 19 Jun 2014 00:01:52 +0200 schreef William Ferguson <
> > william.fergu...@xandar.com.au>:
> >
> > I asked on maven-users but didn't get any viable responses. So I'm hoping
> >> someone here can help.
> >>
> >> --------------------------
> >> 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 artifacts and repo artifacts)
> >> 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
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> > For additional commands, e-mail: dev-h...@maven.apache.org
> >
> >