You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Artem Mironov <ja...@gmail.com> on 2012/02/27 07:14:42 UTC

How to resolve maven dependencies inside the maven plugin?

Hi All.
I need to get all dependencies(including transitive) for project inside my
maven plugin.
Im trying to use ArtifactResolver:

*ArtifactResolutionRequest request = new ArtifactResolutionRequest()
       .setArtifact( project.getArtifact() )
       .setArtifactDependencies( project.getDependencyArtifacts() )
       .setLocalRepository( localRepository )
       .setManagedVersionMap( project.getManagedVersionMap() )
       .setForceUpdate(false)
       .setResolveTransitively(true)
       .setOffline(true);
ArtifactResolutionResult result = artifactResolver.resolve(request);*
*
*
That code takes ~10*min* and successfully resolve all dependencies.
When i just run *mvn *for that project it takes ~4*sec* for all - resolve
dependencies, compile and package jar.

How maven itself resolve transitive dependencies and where difference with
my code? Why that can take so much time?

P.S. Project is a child in some depth of multimodule project.

-- 
Cheers,
Artem.

Re: How to resolve maven dependencies inside the maven plugin?

Posted by Wayne Fay <wa...@gmail.com>.
> I need to get all dependencies(including transitive) for project inside my
> maven plugin.

This is covered by the documentation:
http://maven.apache.org/developers/mojo-api-specification.html

Search for "requiresDependencyResolution" and you will find it right away.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org