Quantcast

How to resolve maven dependencies inside the maven plugin?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to resolve maven dependencies inside the maven plugin?

Artem Mironov
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Wayne Fay
> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...