maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Sand" <>
Subject RE: API to resolve an artifact in Maven3
Date Mon, 22 Jul 2013 20:30:16 GMT
Hi Ron - I'm not sure what you're telling me. I thought that the capability
to easily write custom plug-ins was part of the goal of Maven. If Maven
doesn't want people outside of Maven writing plug-ins, then you're right the
information I'm looking for isn't useful.

But the javadocs are published - they just aren't filled in. Examples are
published, but they're for Maven 2 and either don't work or are deprecated.
Basic tasks that *seem* to be within the scope of what Maven wants to do are
surprisingly difficult. That's frustrating. 

The questions I've asked on this this have been as specific and technical as
I could make them. I'm not trying to waste anyone's time or not respect the
work that others have volunteered. 


-----Original Message-----
From: Ron Wheeler [] 
Sent: Monday, July 22, 2013 3:11 PM
Subject: Re: API to resolve an artifact in Maven3

You are not using Maven; you are developing a custom plug-in.

That is a development activity so you should expect that it will be more
difficult than what other users need to do and you will need information
that is of no use to anyone else.

It appears that you are trying to extend Maven in a way that is outside what
Maven likes to do so you can expect that some information will be hard to
find outside the code.


On 22/07/2013 2:54 PM, Richard Sand wrote:
> Hey Russell - DependencyGraphBuilder seems to be for resolving the 
> dependencies that the project already has, i.e. in the 
> <project><dependencies> element. What I'm trying to do now is 
> configure additional dependencies used by my plugin at runtime outside 
> of the project dependencies.
> I've used a lot of open source projects but I cannot remember one as 
> opaque as Maven. I'm looking through maven-dependency-plugin now to 
> see if I can glean any insights. It seems that plugin used the same 
> technique you did in its DefaultArtifactsResolver utility class. I'm 
> going to check out the project from svn to see how its initializing.
> -----Original Message-----
> From: Russell Gold []
> Sent: Monday, July 22, 2013 7:22 AM
> To: Maven Users List
> Subject: Re: API to resolve an artifact in Maven3
> Hi Richard,
> Believe me, I share your frustration. Like many open-source projects, 
> Maven is woefully under-documented. I've spent a significant amount of 
> time over the past months researching how to do things for the course 
> I've been writing, and also for the plugins I'm writing.
> Mostly, I've been reading source code - especially the maven-supplied 
> plugins. The problem, of course, is figuring out what the "official" 
> and supported way of doing things is.
> To resolve artifacts, I wound up using MavenProject, ArtifactResolver, 
> ArtifactFactory, and both the local and remote repositories. I didn't 
> even see DefaultDependencyGraphBuilder. If that's easier, I may 
> consider revising my approach.
> Thanks,
> Russ
> On Jul 22, 2013, at 1:53 AM, Richard Sand <> wrote:
>> Hi Russel -
>> The use case is simple - I've written a plug-in which takes in as 
>> input a list of dependencies, just like any other plugin or the pom 
>> itself. So, given a String representation of an artifact, how do I 
>> resolve the artifact so I end up with a local File object I can load?
>> This API has seemed like total voodoo - I want to write a paper that 
>> demystifies how to write plugins for maven3. I think I need to find 
>> some time to sit with each of the principle author of maven3 and 
>> publish what I learn.
>> -Richard
>> -----Original Message-----
>> From: Russell Gold []
>> Sent: Sunday, July 21, 2013 7:52 AM
>> To: Maven Users List
>> Subject: Re: API to resolve an artifact in Maven3
>> Hi Richard,
>> Can you be more specific? What exactly is your goal?
>> - Russ
>> On Jul 20, 2013, at 11:02 PM, Richard Sand <> wrote:
>>> Can someone please share the secret of how to do dependency 
>>> resolution in Maven3? And specifically in 3.1?
>>> -Richard
>>> -----Original Message-----
>>> From: Richard Sand []
>>> Sent: Friday, July 19, 2013 3:45 PM
>>> To: 'Maven Users List'
>>> Subject: RE: API to resolve an artifact in Maven3
>>> +1 Anthony. The question is what is the preferred 3.x way of doing 
>>> +it, not
>>> how to do it the old way. Unless the official answer is "do it the 
>>> old way because..."
>>> -----Original Message-----
>>> From: Anthony Dahanne []
>>> Sent: Friday, July 19, 2013 2:32 PM
>>> To: Maven Users List
>>> Subject: Re: API to resolve an artifact in Maven3
>>> hello, I 'm slightly confused about your answer Igor.
>>> The other day I was wondering about how to keep a maven plugin doing 
>>> artifact resolution compatible with both maven 3.0 and 3.1 and 
>>> Robert answered me to use the maven dependency tree api :
>>> -
>>> o
>>> n-aeth
>>> er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_17686482
>>> Now I am using something like that :
>>>      Artifact enforceArtifact =
>>> defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtifact
>>> I
>>> d
>>> ,enfor
>>> ceVersion,"",enforceType);
>>>      MavenProject enforcePom =
>>> mavenProjectBuilder.buildFromRepository(
>>> enforceArtifact, remoteRepositories, localRepository);
>>>      DependencyNode rootNode =
>>> dependencyGraphBuilder.buildDependencyGraph(enforcePom, new 
>>> CumulativeScopeArtifactFilter(Arrays.asList(Artifact.SCOPE_COMPILE,
>>> Artifact.SCOPE_RUNTIME)));
>>> and that works pretty well (I used to think relying on aether 
>>> directly was the best approach, until this change of package made my 
>>> plugins not maven
>>> 3.1 compatible)
>>> Which approach would you consider the best then (when writing a 
>>> plugin doing dependency resolution) , using the Maven 2 API with 
>>> maven-compat or relying on maven-dependency-tree ?
>>> Thanks for your answer !
>>> Anthony
>>> On Fri, Jul 19, 2013 at 1:44 PM, <> wrote:
>>>> Please check next post
>>>> c
>>>> 7 A
>>>> It should helps you
>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <>
> wrote:
>>>>> Quick Q- what's the proper way to resolve an artifact in a Maven3
>>>> plug-in, e.g. where the artifact isn't already a managed dependency 
>>>> in the project.
>>>>> I found the Mojo Developer Cookbook (
>>>> but it gives the Maven2 technique, and the classes used are deprecated.
>>>>> -Richard

Ron Wheeler
Artifact Software Inc
skype: ronaldmwheeler
phone: 866-970-2435, ext 102

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message