Thanks Curtis,

that method (#getArtifactsInTopologicalOrder) is not far from my own code
(they both use DependecyGraphBuilder to resolve the deps). But the first
parameter of that method is the MavenProject for which you want the
resolved dependencies, and that is the piece I am missing. I have an
Artifact and if I could convert it into a MavenProject then that approach
should work.

So if I can't resolve the dependencies for an Artifact directly, then
resolving an Artifact into it's MavenProject would be enough to get me
moving forward.

William


On Tue, Jun 17, 2014 at 7:55 AM, Curtis Rueden <ctrue...@wisc.edu> wrote:

> Hi William,
>
> > Am I even on the right path or is there a much more straight forward
> > way of getting the dependencies for the Artifact?
>
> My naive impression, having dabbled with writing Maven plugins without
> spending too much time doing it, is that there is a lot of copying and
> pasting going on. Find a plugin that does close to what you want, and steal
> blocks of code. As such, unfortunately, it may very well be that there is
> not an especially straightforward way.
>
> Anyway, your question reminds me of something similar (IIUC?) asked and
> answered by Laird Nelson awhile back:
>
>
> http://mail-archives.apache.org/mod_mbox/maven-users/201401.mbox/%3CCAHNdxu==eJv-fuX8aAuVvzrhkEAXsy=rv2aforz+xumtlkz...@mail.gmail.com%3E
>
>
> https://github.com/ljnelson/maven-artifacts/blob/master/src/main/java/com/edugility/maven/Artifacts.java#L80
>
> Maybe that code is helpful?
>
> Or if not, apologies for the noise.
>
> Regards,
> Curtis
>
>
> On Mon, Jun 16, 2014 at 4:40 PM, William Ferguson <
> william.fergu...@xandar.com.au> wrote:
>
> > I'm not looking for the dependencies of the current project.
> > I'm looking for the dependencies of a given artifact.
> >
> > Perhaps I'm not reading maven-dependecy-tree:build-classpath correctly,
> but
> > I don't see how it can be configured to provide that.
> >
> >
> > On Tue, Jun 17, 2014 at 4:32 AM, james northrup <
> northrup.ja...@gmail.com>
> > wrote:
> >
> > > what's not clear is how build-classpath doesn't give you the deps you
> > want.
> > >
> > >
> > >
> > > On Mon, Jun 16, 2014 at 1:23 AM, William Ferguson <
> > > william.fergu...@xandar.com.au> wrote:
> > >
> > > > Thanks James, but perhaps I wasn't clear.
> > > >
> > > > I need to be able to resolve the dependencies for a given artifact
> from
> > > > within my Mojo (ie within my plugin). That's the problem I am trying
> to
> > > > solve.
> > > >
> > > > William
> > > >
> > > >
> > > > On Mon, Jun 16, 2014 at 5:38 PM, james northrup <
> > > northrup.ja...@gmail.com>
> > > > wrote:
> > > >
> > > > > mvn dependency:build-classpath is tricky in my experience but i
> have
> > at
> > > > > least one script in guithub using it to launch a java service
> > withoutr
> > > > > maven assembly plugin or untoward grepping.
> > > > >
> > > > > https://github.com/jnorthrup/RelaxFactory/blob/master/bin/run.sh
> > > > >
> > > > >
> > > > > On Mon, Jun 16, 2014 at 12:21 AM, William Ferguson <
> > > > > william.fergu...@xandar.com.au> wrote:
> > > > >
> > > > > > Anyone?
> > > > > >
> > > > > >
> > > > > > On Sun, Jun 15, 2014 at 12:49 PM, William Ferguson <
> > > > > > william.fergu...@xandar.com.au> wrote:
> > > > > >
> > > > > > > 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
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Jim Northrup  *  (408) 837-2270 *
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Jim Northrup  *  (408) 837-2270 *
> > >
> >
>

Reply via email to