Your wish...

http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook




On 11/10/06, Wayne Fay <[EMAIL PROTECTED]> wrote:
This is the kind of stuff that needs to land in a Maven Plugin
Developers doc/wiki/etc somewhere...

Wayne

On 11/10/06, Sebastien Brunot <[EMAIL PROTECTED]> wrote:
> Thanks for your help tom, I now have all the information I needed.
>
> Sebastien
>
> -----Original Message-----
> From: Tom Huybrechts [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 10, 2006 5:26 PM
> To: Maven Users List
> Subject: Re: Resolving project dependencies
>
> This works for me:
>
> Artifact pomArtifact = this.factory.createArtifact( groupId, artifactId,
> version, "", "pom" ); MavenProject pomProject =
> mavenProjectBuilder.buildFromRepository(
> pomArtifact, this.remoteRepos, this.local ); Set artifacts =
> pomProject.createArtifacts( this.factory, null, null);
> ScopeArtifactFilter filter = new
> ScopeArtifactFilter(DefaultArtifact.SCOPE_RUNTIME);
> ArtifactResolutionResult arr = resolver.resolveTransitively(artifacts,
> pomArtifact, local, remoteRepos, source, filter); Set result =
> arr.getArtifacts();
>
>
> On 11/10/06, Sebastien Brunot <[EMAIL PROTECTED]> wrote:
> > What I'm doing exactly is as following:
> >
> > 1) I create an Artifact object using groupId, artifactId and version
> > provided in the plugin configuration (the type is always "pom")
> > 2) Using this artifact, I create a MavenProject object (with the
> > buildFromRepository(...) method of a MavenProjectBuilder instance)
> > 3) At this step, I want that a call to getArtifacts or
> > getDependenciesArtifact returns the list of dependencies (non
> > transitive or transitive) => in fact, it does not: getArtifacts
> > returns an empty set while getDependenciesArtifact returns null.
> >
> > I've discovered the createArtifacts method of MavenProject thanks to
> > your code, and it seems to create the set of (non transitive)
> > dependencies artifact I was looking for. But what about transitive
> > dependencies ? Do I have to take each artifact in the set returned by
> > createArtifacts and "resolve" it recursively to get the "transitive"
> > set of dependencies ? If yes, which method do I use knowing that I
> > have an Artifact object and I want its set of artifact dependencies ?
> >
> > Thanks for your help,
> >
> > Sebastien
> >
> > -----Original Message-----
> > From: Mark Hobson [mailto:[EMAIL PROTECTED]
> > Sent: Friday, November 10, 2006 4:53 PM
> > To: Maven Users List
> > Subject: Re: Resolving project dependencies
> >
> > On 10/11/06, Sebastien Brunot <[EMAIL PROTECTED]> wrote:
> > > I'm not sure I undestand your question, but I want to get a list of
> > > all the artifact that correspond to a dependency declared in the
> > > MavenProject POM, with or without transitivity depending on a
> > > parameter set in my plugin configuration. Without transitivity is
> > > mandatory, with transitivity is optional.
> >
> > I believe that: project.getArtifacts() returns all the project's
> > dependencies, including transitive ones; and
> > project.getDependencyArtifacts() only returns the immediate
> > dependencies declared in the project's pom.
> >
> > Although you say you're trying to resolve the dependencies of a
> > dependency in a project?  As soon as you start traversing deeper than
> > the first level of dependencies in the pom, you need to start
> > resolving them yourself.  I've recently extracted code to do this into
>
> > a shared component that's currently sitting in JIRA, see:
> >
> > http://jira.codehaus.org/browse/MNG-2654
> >
> > Mark
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to