You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Richard Sand <rs...@idfconnect.com> on 2013/07/19 19:39:00 UTC

API to resolve an artifact in Maven3

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 (http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook) but it gives the Maven2 technique, and the classes used are deprecated.

-Richard



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


Re: API to resolve an artifact in Maven3

Posted by Barrie Treloar <ba...@gmail.com>.
On 23 July 2013 06:00, Richard Sand <rs...@idfconnect.com> wrote:
> 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.

Ron is essentially saying roughtly...

Number of Maven Committers = O(X)
Number of Maven Developers = O(10 * X)
Number of Maven Users = O(100+ * X)

So as you travel up the scope there are less and less people who
understand what is going on, and since there is less of them there is
also less time to actually do stuff.
And they spend that time getting stuff working rather than explaining
what is going on.

For most people that are writing a plugin they do not need dependency
resolution, in fact most Maven plugins themselves don't need it - they
can rely on Maven to have done that already for them.

The general documentation for writing a non-dependency plugin is ok
enough, but this could also be improved.

You are definitely right, and you are not alone in feeling frustrated,
that the documentation on how to do dependency resolution could be
improved - a lot.
Any improvement you would be willing to submit back would be most grateful.

Part of the problem is that once you have grokked this stuff you then
forget what the pain points were so that writing documentation to
illuminate the next person coming along is difficult; unless you
remembered to make a map as you were going along.  And there aren't
enough people like that.

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


Re: API to resolve an artifact in Maven3

Posted by Manfred Moser <ma...@simpligility.com>.
Thats what we plan to do for the android maven plugin as well.

> I hope some maven dev folks seeing  this discussion and provide guidance
> for you case.  For my case, very likely i will move directly mvn 3.1.x and
> stop support for 3.0 completely ( i have no need for maven 2 support )
>
> -D
>
>
> On Mon, Jul 22, 2013 at 6:11 PM, Richard Sand <rs...@idfconnect.com>
> wrote:
>
>> Hi Dan - no I really don't specifically need the maven3 API. In fact, I
>> only started asking when I got the compiler warnings that
>> ArtifactFactory
>> was deprecated, thus the conversation about what the proper technique
>> was.
>>
>> It sounds like the 3.1 API should expose more of the aether API through
>> an
>> interface and factory pattern if it wants to support these plug-ins
>> while
>> still moving off of the maven 2 approach. What do you think?
>>
>> -----Original Message-----
>> From: Dan Tran [mailto:dantran@gmail.com]
>> Sent: Monday, July 22, 2013 8:38 PM
>> To: Maven Users List
>> Subject: Re: API to resolve an artifact in Maven3
>>
>> Yes, I am also at a odd situation whether I need to have my custom
>> plugin
>> to support both maven 3 and 3.1 at the same time.
>>
>> Btw, maven 2 api should support most of the requirement,  do you have
>> specific needs for maven 3 artifact api?
>>
>> -D
>>
>>
>>
>>
>>
>> On Mon, Jul 22, 2013 at 4:57 PM, Anthony Dahanne
>> <an...@gmail.com>wrote:
>>
>> > On Mon, Jul 22, 2013 at 6:59 PM, Dan Tran <da...@gmail.com> wrote:
>> >
>> > > Eclipse aether is the api you need resolve your artifact for maven
>> 3.1.
>> >
>> >
>> >
>> > Yeah, and that would mean bye bye maven 2 and maven 3.0 support !
>> >
>> >
>> >
>> >
>> > >  I
>> > > think there are plenty of examples for you to base on. If you have
>> > > question, you can post it here at user group, there are plenty of
>> > > dev
>> > folks
>> > > here always trying to help out
>> > >
>> > > -D
>> > >
>> > >
>> > > On Mon, Jul 22, 2013 at 2:55 PM, Richard Sand <rs...@idfconnect.com>
>> > > wrote:
>> > >
>> > > > Ok good points, thanks Ron. I'll try what you suggested, and see
>> > > > if I
>> > can
>> > > > get some assistance on the developers list. I'm happy to volunteer
>> > > > to update some documentation around what I've learned writing this
>> > > > plugin.
>> > > >
>> > > > Best regards,
>> > > >
>> > > > Richard
>> > > >
>> > > >
>> > > > -----Original Message-----
>> > > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
>> > > > Sent: Monday, July 22, 2013 5:06 PM
>> > > > To: Richard Sand
>> > > > Cc: 'Maven Users List'
>> > > > Subject: Re: API to resolve an artifact in Maven3
>> > > >
>> > > > My point is that most of the people here are users and not
>> > > > interested
>> > in
>> > > > plug-in development or knowledgeable about plug-in development.
>> > > > Custom plug-ins are not required for development of standalone or
>> > > > web applications in Java most of the time.
>> > > >
>> > > > Most appear to be developed to support specific specific non-java
>> > > > activities. I use one developed as a front-end for DITA document
>> > > production
>> > > > to simplify the use of the DITA-OT. I use another to simplify the
>> > > packaging
>> > > > of applications into an installer using IzPack.
>> > > >
>> > > > These are pretty simple Maven plug-ins and likely do not include
>> > > > very
>> > > much
>> > > > coordination with or use of Maven internal methods.
>> > > >
>> > > > I am not sure if there is a better forum for you to get the kind
>> > > > of
>> > help
>> > > > that you need.
>> > > > The kind of information that you seem to need is probably known by
>> > > > the people who frequent the dev list but they are going to be
>> > > > pretty
>> > focused
>> > > on
>> > > > Maven development and may not welcome third-party development
>> > questions.
>> > > >
>> > > > You might get some help by offering to add documentation to the
>> > > > code in
>> > > the
>> > > > dev list in return for specific questions. Certainly you are doing
>> > > > a
>> > > level
>> > > > of research into the examples,  docs and code that could lead to
>> > > > useful updates to the docs or examples.
>> > > >
>> > > >
>> > > >
>> > > > Ron
>> > > >
>> > > >
>> > > > On 22/07/2013 4:30 PM, Richard Sand wrote:
>> > > > > 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.
>> > > > >
>> > > > > -Richard
>> > > > >
>> > > > >
>> > > > > -----Original Message-----
>> > > > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
>> > > > > Sent: Monday, July 22, 2013 3:11 PM
>> > > > > To: users@maven.apache.org
>> > > > > 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.
>> > > > >
>> > > > >
>> > > > > Ron
>> > > > >
>> > > > >
>> > > > > 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 [mailto:russ@gold-family.us]
>> > > > >> 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
>> > > > >> <rs...@idfconnect.com>
>> > > 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 [mailto:russ@gold-family.us]
>> > > > >>> 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
>> > > > >>> <rs...@idfconnect.com>
>> > > > 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 [mailto:rsand@idfconnect.com]
>> > > > >>>> 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 [mailto:anthony.dahanne@gmail.com]
>> > > > >>>> 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 :
>> > > > >>>>
>> > http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relyin
>> > > > >>>> g
>> > > > >>>> -
>> > > > >>>> o
>> > > > >>>> n-aeth
>> > > > >>>>
>> > er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_1768648
>> > > > >>>> 2
>> > > > >>>>
>> > > > >>>> Now I am using something like that :
>> > > > >>>>       Artifact enforceArtifact =
>> > > > >>>>
>> > defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtifac
>> > > > >>>> t
>> > > > >>>> 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, <ig...@gmail.com>
>> > wrote:
>> > > > >>>>
>> > > > >>>>> Please check next post
>> > > > >>>>>
>> > > > >>>>>
>> > http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%
>> > > > >>>>> 3
>> > > > >>>>> c
>> > > > >>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>> > > > >>>>> It should helps you
>> > > > >>>>>
>> > > > >>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <
>> > rsand@idfconnect.com>
>> > > > >> 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 (
>> > > > >>>>>
>> > http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
>> > > > >>>>> ) but it gives the Maven2 technique, and the classes used
>> > > > >>>>> are deprecated.
>> > > > >>>>>> -Richard
>> > > > >
>> > > > > --
>> > > > > Ron Wheeler
>> > > > > President
>> > > > > Artifact Software Inc
>> > > > > email: rwheeler@artifact-software.com
>> > > > > skype: ronaldmwheeler
>> > > > > phone: 866-970-2435, ext 102
>> > > > >
>> > > > >
>> > > > > ----------------------------------------------------------------
>> > > > > ----- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > > > > For additional commands, e-mail: users-help@maven.apache.org
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > > > --
>> > > > Ron Wheeler
>> > > > President
>> > > > Artifact Software Inc
>> > > > email: rwheeler@artifact-software.com
>> > > > skype: ronaldmwheeler
>> > > > phone: 866-970-2435, ext 102
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > ------------------------------------------------------------------
>> > > > --- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > > > For additional commands, e-mail: users-help@maven.apache.org
>> > > >
>> > > >
>> > >
>> >
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>


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


Re: API to resolve an artifact in Maven3

Posted by Dan Tran <da...@gmail.com>.
I hope some maven dev folks seeing  this discussion and provide guidance
for you case.  For my case, very likely i will move directly mvn 3.1.x and
stop support for 3.0 completely ( i have no need for maven 2 support )

-D


On Mon, Jul 22, 2013 at 6:11 PM, Richard Sand <rs...@idfconnect.com> wrote:

> Hi Dan - no I really don't specifically need the maven3 API. In fact, I
> only started asking when I got the compiler warnings that ArtifactFactory
> was deprecated, thus the conversation about what the proper technique was.
>
> It sounds like the 3.1 API should expose more of the aether API through an
> interface and factory pattern if it wants to support these plug-ins while
> still moving off of the maven 2 approach. What do you think?
>
> -----Original Message-----
> From: Dan Tran [mailto:dantran@gmail.com]
> Sent: Monday, July 22, 2013 8:38 PM
> To: Maven Users List
> Subject: Re: API to resolve an artifact in Maven3
>
> Yes, I am also at a odd situation whether I need to have my custom plugin
> to support both maven 3 and 3.1 at the same time.
>
> Btw, maven 2 api should support most of the requirement,  do you have
> specific needs for maven 3 artifact api?
>
> -D
>
>
>
>
>
> On Mon, Jul 22, 2013 at 4:57 PM, Anthony Dahanne
> <an...@gmail.com>wrote:
>
> > On Mon, Jul 22, 2013 at 6:59 PM, Dan Tran <da...@gmail.com> wrote:
> >
> > > Eclipse aether is the api you need resolve your artifact for maven 3.1.
> >
> >
> >
> > Yeah, and that would mean bye bye maven 2 and maven 3.0 support !
> >
> >
> >
> >
> > >  I
> > > think there are plenty of examples for you to base on. If you have
> > > question, you can post it here at user group, there are plenty of
> > > dev
> > folks
> > > here always trying to help out
> > >
> > > -D
> > >
> > >
> > > On Mon, Jul 22, 2013 at 2:55 PM, Richard Sand <rs...@idfconnect.com>
> > > wrote:
> > >
> > > > Ok good points, thanks Ron. I'll try what you suggested, and see
> > > > if I
> > can
> > > > get some assistance on the developers list. I'm happy to volunteer
> > > > to update some documentation around what I've learned writing this
> > > > plugin.
> > > >
> > > > Best regards,
> > > >
> > > > Richard
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > > > Sent: Monday, July 22, 2013 5:06 PM
> > > > To: Richard Sand
> > > > Cc: 'Maven Users List'
> > > > Subject: Re: API to resolve an artifact in Maven3
> > > >
> > > > My point is that most of the people here are users and not
> > > > interested
> > in
> > > > plug-in development or knowledgeable about plug-in development.
> > > > Custom plug-ins are not required for development of standalone or
> > > > web applications in Java most of the time.
> > > >
> > > > Most appear to be developed to support specific specific non-java
> > > > activities. I use one developed as a front-end for DITA document
> > > production
> > > > to simplify the use of the DITA-OT. I use another to simplify the
> > > packaging
> > > > of applications into an installer using IzPack.
> > > >
> > > > These are pretty simple Maven plug-ins and likely do not include
> > > > very
> > > much
> > > > coordination with or use of Maven internal methods.
> > > >
> > > > I am not sure if there is a better forum for you to get the kind
> > > > of
> > help
> > > > that you need.
> > > > The kind of information that you seem to need is probably known by
> > > > the people who frequent the dev list but they are going to be
> > > > pretty
> > focused
> > > on
> > > > Maven development and may not welcome third-party development
> > questions.
> > > >
> > > > You might get some help by offering to add documentation to the
> > > > code in
> > > the
> > > > dev list in return for specific questions. Certainly you are doing
> > > > a
> > > level
> > > > of research into the examples,  docs and code that could lead to
> > > > useful updates to the docs or examples.
> > > >
> > > >
> > > >
> > > > Ron
> > > >
> > > >
> > > > On 22/07/2013 4:30 PM, Richard Sand wrote:
> > > > > 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.
> > > > >
> > > > > -Richard
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > > > > Sent: Monday, July 22, 2013 3:11 PM
> > > > > To: users@maven.apache.org
> > > > > 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.
> > > > >
> > > > >
> > > > > Ron
> > > > >
> > > > >
> > > > > 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 [mailto:russ@gold-family.us]
> > > > >> 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
> > > > >> <rs...@idfconnect.com>
> > > 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 [mailto:russ@gold-family.us]
> > > > >>> 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
> > > > >>> <rs...@idfconnect.com>
> > > > 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 [mailto:rsand@idfconnect.com]
> > > > >>>> 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 [mailto:anthony.dahanne@gmail.com]
> > > > >>>> 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 :
> > > > >>>>
> > http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relyin
> > > > >>>> g
> > > > >>>> -
> > > > >>>> o
> > > > >>>> n-aeth
> > > > >>>>
> > er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_1768648
> > > > >>>> 2
> > > > >>>>
> > > > >>>> Now I am using something like that :
> > > > >>>>       Artifact enforceArtifact =
> > > > >>>>
> > defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtifac
> > > > >>>> t
> > > > >>>> 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, <ig...@gmail.com>
> > wrote:
> > > > >>>>
> > > > >>>>> Please check next post
> > > > >>>>>
> > > > >>>>>
> > http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%
> > > > >>>>> 3
> > > > >>>>> c
> > > > >>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> > > > >>>>> It should helps you
> > > > >>>>>
> > > > >>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <
> > rsand@idfconnect.com>
> > > > >> 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 (
> > > > >>>>>
> > http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
> > > > >>>>> ) but it gives the Maven2 technique, and the classes used
> > > > >>>>> are deprecated.
> > > > >>>>>> -Richard
> > > > >
> > > > > --
> > > > > Ron Wheeler
> > > > > President
> > > > > Artifact Software Inc
> > > > > email: rwheeler@artifact-software.com
> > > > > skype: ronaldmwheeler
> > > > > phone: 866-970-2435, ext 102
> > > > >
> > > > >
> > > > > ----------------------------------------------------------------
> > > > > ----- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > > For additional commands, e-mail: users-help@maven.apache.org
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Ron Wheeler
> > > > President
> > > > Artifact Software Inc
> > > > email: rwheeler@artifact-software.com
> > > > skype: ronaldmwheeler
> > > > phone: 866-970-2435, ext 102
> > > >
> > > >
> > > >
> > > >
> > > > ------------------------------------------------------------------
> > > > --- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
Hi Dan - no I really don't specifically need the maven3 API. In fact, I only started asking when I got the compiler warnings that ArtifactFactory was deprecated, thus the conversation about what the proper technique was.

It sounds like the 3.1 API should expose more of the aether API through an interface and factory pattern if it wants to support these plug-ins while still moving off of the maven 2 approach. What do you think?

-----Original Message-----
From: Dan Tran [mailto:dantran@gmail.com] 
Sent: Monday, July 22, 2013 8:38 PM
To: Maven Users List
Subject: Re: API to resolve an artifact in Maven3

Yes, I am also at a odd situation whether I need to have my custom plugin to support both maven 3 and 3.1 at the same time.

Btw, maven 2 api should support most of the requirement,  do you have specific needs for maven 3 artifact api?

-D





On Mon, Jul 22, 2013 at 4:57 PM, Anthony Dahanne
<an...@gmail.com>wrote:

> On Mon, Jul 22, 2013 at 6:59 PM, Dan Tran <da...@gmail.com> wrote:
>
> > Eclipse aether is the api you need resolve your artifact for maven 3.1.
>
>
>
> Yeah, and that would mean bye bye maven 2 and maven 3.0 support !
>
>
>
>
> >  I
> > think there are plenty of examples for you to base on. If you have 
> > question, you can post it here at user group, there are plenty of 
> > dev
> folks
> > here always trying to help out
> >
> > -D
> >
> >
> > On Mon, Jul 22, 2013 at 2:55 PM, Richard Sand <rs...@idfconnect.com>
> > wrote:
> >
> > > Ok good points, thanks Ron. I'll try what you suggested, and see 
> > > if I
> can
> > > get some assistance on the developers list. I'm happy to volunteer 
> > > to update some documentation around what I've learned writing this 
> > > plugin.
> > >
> > > Best regards,
> > >
> > > Richard
> > >
> > >
> > > -----Original Message-----
> > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > > Sent: Monday, July 22, 2013 5:06 PM
> > > To: Richard Sand
> > > Cc: 'Maven Users List'
> > > Subject: Re: API to resolve an artifact in Maven3
> > >
> > > My point is that most of the people here are users and not 
> > > interested
> in
> > > plug-in development or knowledgeable about plug-in development.
> > > Custom plug-ins are not required for development of standalone or 
> > > web applications in Java most of the time.
> > >
> > > Most appear to be developed to support specific specific non-java 
> > > activities. I use one developed as a front-end for DITA document
> > production
> > > to simplify the use of the DITA-OT. I use another to simplify the
> > packaging
> > > of applications into an installer using IzPack.
> > >
> > > These are pretty simple Maven plug-ins and likely do not include 
> > > very
> > much
> > > coordination with or use of Maven internal methods.
> > >
> > > I am not sure if there is a better forum for you to get the kind 
> > > of
> help
> > > that you need.
> > > The kind of information that you seem to need is probably known by 
> > > the people who frequent the dev list but they are going to be 
> > > pretty
> focused
> > on
> > > Maven development and may not welcome third-party development
> questions.
> > >
> > > You might get some help by offering to add documentation to the 
> > > code in
> > the
> > > dev list in return for specific questions. Certainly you are doing 
> > > a
> > level
> > > of research into the examples,  docs and code that could lead to 
> > > useful updates to the docs or examples.
> > >
> > >
> > >
> > > Ron
> > >
> > >
> > > On 22/07/2013 4:30 PM, Richard Sand wrote:
> > > > 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.
> > > >
> > > > -Richard
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > > > Sent: Monday, July 22, 2013 3:11 PM
> > > > To: users@maven.apache.org
> > > > 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.
> > > >
> > > >
> > > > Ron
> > > >
> > > >
> > > > 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 [mailto:russ@gold-family.us]
> > > >> 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 
> > > >> <rs...@idfconnect.com>
> > 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 [mailto:russ@gold-family.us]
> > > >>> 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 
> > > >>> <rs...@idfconnect.com>
> > > 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 [mailto:rsand@idfconnect.com]
> > > >>>> 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 [mailto:anthony.dahanne@gmail.com]
> > > >>>> 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 :
> > > >>>>
> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relyin
> > > >>>> g
> > > >>>> -
> > > >>>> o
> > > >>>> n-aeth
> > > >>>>
> er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_1768648
> > > >>>> 2
> > > >>>>
> > > >>>> Now I am using something like that :
> > > >>>>       Artifact enforceArtifact =
> > > >>>>
> defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtifac
> > > >>>> t
> > > >>>> 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, <ig...@gmail.com>
> wrote:
> > > >>>>
> > > >>>>> Please check next post
> > > >>>>>
> > > >>>>>
> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%
> > > >>>>> 3
> > > >>>>> c
> > > >>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> > > >>>>> It should helps you
> > > >>>>>
> > > >>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <
> rsand@idfconnect.com>
> > > >> 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 (
> > > >>>>>
> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
> > > >>>>> ) but it gives the Maven2 technique, and the classes used 
> > > >>>>> are deprecated.
> > > >>>>>> -Richard
> > > >
> > > > --
> > > > Ron Wheeler
> > > > President
> > > > Artifact Software Inc
> > > > email: rwheeler@artifact-software.com
> > > > skype: ronaldmwheeler
> > > > phone: 866-970-2435, ext 102
> > > >
> > > >
> > > > ----------------------------------------------------------------
> > > > ----- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Ron Wheeler
> > > President
> > > Artifact Software Inc
> > > email: rwheeler@artifact-software.com
> > > skype: ronaldmwheeler
> > > phone: 866-970-2435, ext 102
> > >
> > >
> > >
> > >
> > > ------------------------------------------------------------------
> > > --- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>



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


Re: API to resolve an artifact in Maven3

Posted by Dan Tran <da...@gmail.com>.
Yes, I am also at a odd situation whether I need to have my custom plugin
to support both maven 3 and 3.1 at the same time.

Btw, maven 2 api should support most of the requirement,  do you have
specific needs for maven 3 artifact api?

-D





On Mon, Jul 22, 2013 at 4:57 PM, Anthony Dahanne
<an...@gmail.com>wrote:

> On Mon, Jul 22, 2013 at 6:59 PM, Dan Tran <da...@gmail.com> wrote:
>
> > Eclipse aether is the api you need resolve your artifact for maven 3.1.
>
>
>
> Yeah, and that would mean bye bye maven 2 and maven 3.0 support !
>
>
>
>
> >  I
> > think there are plenty of examples for you to base on. If you have
> > question, you can post it here at user group, there are plenty of dev
> folks
> > here always trying to help out
> >
> > -D
> >
> >
> > On Mon, Jul 22, 2013 at 2:55 PM, Richard Sand <rs...@idfconnect.com>
> > wrote:
> >
> > > Ok good points, thanks Ron. I'll try what you suggested, and see if I
> can
> > > get some assistance on the developers list. I'm happy to volunteer to
> > > update
> > > some documentation around what I've learned writing this plugin.
> > >
> > > Best regards,
> > >
> > > Richard
> > >
> > >
> > > -----Original Message-----
> > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > > Sent: Monday, July 22, 2013 5:06 PM
> > > To: Richard Sand
> > > Cc: 'Maven Users List'
> > > Subject: Re: API to resolve an artifact in Maven3
> > >
> > > My point is that most of the people here are users and not interested
> in
> > > plug-in development or knowledgeable about plug-in development.
> > > Custom plug-ins are not required for development of standalone or web
> > > applications in Java most of the time.
> > >
> > > Most appear to be developed to support specific specific non-java
> > > activities. I use one developed as a front-end for DITA document
> > production
> > > to simplify the use of the DITA-OT. I use another to simplify the
> > packaging
> > > of applications into an installer using IzPack.
> > >
> > > These are pretty simple Maven plug-ins and likely do not include very
> > much
> > > coordination with or use of Maven internal methods.
> > >
> > > I am not sure if there is a better forum for you to get the kind of
> help
> > > that you need.
> > > The kind of information that you seem to need is probably known by the
> > > people who frequent the dev list but they are going to be pretty
> focused
> > on
> > > Maven development and may not welcome third-party development
> questions.
> > >
> > > You might get some help by offering to add documentation to the code in
> > the
> > > dev list in return for specific questions. Certainly you are doing a
> > level
> > > of research into the examples,  docs and code that could lead to useful
> > > updates to the docs or examples.
> > >
> > >
> > >
> > > Ron
> > >
> > >
> > > On 22/07/2013 4:30 PM, Richard Sand wrote:
> > > > 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.
> > > >
> > > > -Richard
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > > > Sent: Monday, July 22, 2013 3:11 PM
> > > > To: users@maven.apache.org
> > > > 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.
> > > >
> > > >
> > > > Ron
> > > >
> > > >
> > > > 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 [mailto:russ@gold-family.us]
> > > >> 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 <rs...@idfconnect.com>
> > 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 [mailto:russ@gold-family.us]
> > > >>> 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 <rs...@idfconnect.com>
> > > 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 [mailto:rsand@idfconnect.com]
> > > >>>> 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 [mailto:anthony.dahanne@gmail.com]
> > > >>>> 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 :
> > > >>>>
> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relyin
> > > >>>> g
> > > >>>> -
> > > >>>> o
> > > >>>> n-aeth
> > > >>>>
> er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_1768648
> > > >>>> 2
> > > >>>>
> > > >>>> Now I am using something like that :
> > > >>>>       Artifact enforceArtifact =
> > > >>>>
> defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtifac
> > > >>>> t
> > > >>>> 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, <ig...@gmail.com>
> wrote:
> > > >>>>
> > > >>>>> Please check next post
> > > >>>>>
> > > >>>>>
> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%
> > > >>>>> 3
> > > >>>>> c
> > > >>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> > > >>>>> It should helps you
> > > >>>>>
> > > >>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <
> rsand@idfconnect.com>
> > > >> 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 (
> > > >>>>>
> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
> > > >>>>> ) but it gives the Maven2 technique, and the classes used are
> > > >>>>> deprecated.
> > > >>>>>> -Richard
> > > >
> > > > --
> > > > Ron Wheeler
> > > > President
> > > > Artifact Software Inc
> > > > email: rwheeler@artifact-software.com
> > > > skype: ronaldmwheeler
> > > > phone: 866-970-2435, ext 102
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Ron Wheeler
> > > President
> > > Artifact Software Inc
> > > email: rwheeler@artifact-software.com
> > > skype: ronaldmwheeler
> > > phone: 866-970-2435, ext 102
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>

Re: API to resolve an artifact in Maven3

Posted by Anthony Dahanne <an...@gmail.com>.
On Mon, Jul 22, 2013 at 6:59 PM, Dan Tran <da...@gmail.com> wrote:

> Eclipse aether is the api you need resolve your artifact for maven 3.1.



Yeah, and that would mean bye bye maven 2 and maven 3.0 support !




>  I
> think there are plenty of examples for you to base on. If you have
> question, you can post it here at user group, there are plenty of dev folks
> here always trying to help out
>
> -D
>
>
> On Mon, Jul 22, 2013 at 2:55 PM, Richard Sand <rs...@idfconnect.com>
> wrote:
>
> > Ok good points, thanks Ron. I'll try what you suggested, and see if I can
> > get some assistance on the developers list. I'm happy to volunteer to
> > update
> > some documentation around what I've learned writing this plugin.
> >
> > Best regards,
> >
> > Richard
> >
> >
> > -----Original Message-----
> > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > Sent: Monday, July 22, 2013 5:06 PM
> > To: Richard Sand
> > Cc: 'Maven Users List'
> > Subject: Re: API to resolve an artifact in Maven3
> >
> > My point is that most of the people here are users and not interested in
> > plug-in development or knowledgeable about plug-in development.
> > Custom plug-ins are not required for development of standalone or web
> > applications in Java most of the time.
> >
> > Most appear to be developed to support specific specific non-java
> > activities. I use one developed as a front-end for DITA document
> production
> > to simplify the use of the DITA-OT. I use another to simplify the
> packaging
> > of applications into an installer using IzPack.
> >
> > These are pretty simple Maven plug-ins and likely do not include very
> much
> > coordination with or use of Maven internal methods.
> >
> > I am not sure if there is a better forum for you to get the kind of help
> > that you need.
> > The kind of information that you seem to need is probably known by the
> > people who frequent the dev list but they are going to be pretty focused
> on
> > Maven development and may not welcome third-party development questions.
> >
> > You might get some help by offering to add documentation to the code in
> the
> > dev list in return for specific questions. Certainly you are doing a
> level
> > of research into the examples,  docs and code that could lead to useful
> > updates to the docs or examples.
> >
> >
> >
> > Ron
> >
> >
> > On 22/07/2013 4:30 PM, Richard Sand wrote:
> > > 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.
> > >
> > > -Richard
> > >
> > >
> > > -----Original Message-----
> > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > > Sent: Monday, July 22, 2013 3:11 PM
> > > To: users@maven.apache.org
> > > 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.
> > >
> > >
> > > Ron
> > >
> > >
> > > 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 [mailto:russ@gold-family.us]
> > >> 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 <rs...@idfconnect.com>
> 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 [mailto:russ@gold-family.us]
> > >>> 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 <rs...@idfconnect.com>
> > 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 [mailto:rsand@idfconnect.com]
> > >>>> 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 [mailto:anthony.dahanne@gmail.com]
> > >>>> 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 :
> > >>>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relyin
> > >>>> g
> > >>>> -
> > >>>> o
> > >>>> n-aeth
> > >>>> er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_1768648
> > >>>> 2
> > >>>>
> > >>>> Now I am using something like that :
> > >>>>       Artifact enforceArtifact =
> > >>>> defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtifac
> > >>>> t
> > >>>> 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, <ig...@gmail.com> wrote:
> > >>>>
> > >>>>> Please check next post
> > >>>>>
> > >>>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%
> > >>>>> 3
> > >>>>> c
> > >>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> > >>>>> It should helps you
> > >>>>>
> > >>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com>
> > >> 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 (
> > >>>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
> > >>>>> ) but it gives the Maven2 technique, and the classes used are
> > >>>>> deprecated.
> > >>>>>> -Richard
> > >
> > > --
> > > Ron Wheeler
> > > President
> > > Artifact Software Inc
> > > email: rwheeler@artifact-software.com
> > > skype: ronaldmwheeler
> > > phone: 866-970-2435, ext 102
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Ron Wheeler
> > President
> > Artifact Software Inc
> > email: rwheeler@artifact-software.com
> > skype: ronaldmwheeler
> > phone: 866-970-2435, ext 102
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>

Re: API to resolve an artifact in Maven3

Posted by Dan Tran <da...@gmail.com>.
if all you need is from that example, then i think maven 2 artifact
resolver should work just fine and it is compatible with maven 2 and 3

-Dan


On Mon, Jul 22, 2013 at 7:44 PM, Richard Sand <rs...@idfconnect.com> wrote:

> Just closing the loop, the eclipse aether project has a maven example
> showing how to do exactly what I need to do...
>
> So many hours spent searching for this...!!!
>
>
> http://git.eclipse.org/c/aether/aether-demo.git/tree/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/examples/maven/ResolveArtifactMojo.java
>
>
> -----Original Message-----
> From: Dan Tran [mailto:dantran@gmail.com]
> Sent: Monday, July 22, 2013 6:59 PM
> To: Maven Users List
> Subject: Re: API to resolve an artifact in Maven3
>
> Eclipse aether is the api you need resolve your artifact for maven 3.1.  I
> think there are plenty of examples for you to base on. If you have
> question, you can post it here at user group, there are plenty of dev folks
> here always trying to help out
>
> -D
>
>
> On Mon, Jul 22, 2013 at 2:55 PM, Richard Sand <rs...@idfconnect.com>
> wrote:
>
> > Ok good points, thanks Ron. I'll try what you suggested, and see if I
> > can get some assistance on the developers list. I'm happy to volunteer
> > to update some documentation around what I've learned writing this
> > plugin.
> >
> > Best regards,
> >
> > Richard
> >
> >
> > -----Original Message-----
> > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > Sent: Monday, July 22, 2013 5:06 PM
> > To: Richard Sand
> > Cc: 'Maven Users List'
> > Subject: Re: API to resolve an artifact in Maven3
> >
> > My point is that most of the people here are users and not interested
> > in plug-in development or knowledgeable about plug-in development.
> > Custom plug-ins are not required for development of standalone or web
> > applications in Java most of the time.
> >
> > Most appear to be developed to support specific specific non-java
> > activities. I use one developed as a front-end for DITA document
> > production to simplify the use of the DITA-OT. I use another to
> > simplify the packaging of applications into an installer using IzPack.
> >
> > These are pretty simple Maven plug-ins and likely do not include very
> > much coordination with or use of Maven internal methods.
> >
> > I am not sure if there is a better forum for you to get the kind of
> > help that you need.
> > The kind of information that you seem to need is probably known by the
> > people who frequent the dev list but they are going to be pretty
> > focused on Maven development and may not welcome third-party development
> questions.
> >
> > You might get some help by offering to add documentation to the code
> > in the dev list in return for specific questions. Certainly you are
> > doing a level of research into the examples,  docs and code that could
> > lead to useful updates to the docs or examples.
> >
> >
> >
> > Ron
> >
> >
> > On 22/07/2013 4:30 PM, Richard Sand wrote:
> > > 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.
> > >
> > > -Richard
> > >
> > >
> > > -----Original Message-----
> > > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > > Sent: Monday, July 22, 2013 3:11 PM
> > > To: users@maven.apache.org
> > > 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.
> > >
> > >
> > > Ron
> > >
> > >
> > > 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 [mailto:russ@gold-family.us]
> > >> 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 <rs...@idfconnect.com>
> 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 [mailto:russ@gold-family.us]
> > >>> 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 <rs...@idfconnect.com>
> > 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 [mailto:rsand@idfconnect.com]
> > >>>> 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 [mailto:anthony.dahanne@gmail.com]
> > >>>> 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 :
> > >>>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-rely
> > >>>> in
> > >>>> g
> > >>>> -
> > >>>> o
> > >>>> n-aeth
> > >>>> er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_17686
> > >>>> 48
> > >>>> 2
> > >>>>
> > >>>> Now I am using something like that :
> > >>>>       Artifact enforceArtifact =
> > >>>> defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtif
> > >>>> ac
> > >>>> t
> > >>>> I
> > >>>> d
> > >>>> ,enfor
> > >>>> ceVersion,"",enforceType);
> > >>>>       MavenProject enforcePom =
> > >>>> mavenProjectBuilder.buildFromRepository(
> > >>>> enforceArtifact, remoteRepositories, localRepository);
> > >>>>       DependencyNode rootNode =
> > >>>> dependencyGraphBuilder.buildDependencyGraph(enforcePom, new
> > >>>> CumulativeScopeArtifactFilter(Arrays.asList(Artifact.SCOPE_COMPIL
> > >>>> E,
> > >>>> 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, <ig...@gmail.com> wrote:
> > >>>>
> > >>>>> Please check next post
> > >>>>>
> > >>>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox
> > >>>>> /%
> > >>>>> 3
> > >>>>> c
> > >>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> > >>>>> It should helps you
> > >>>>>
> > >>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand"
> > >>>>> <rs...@idfconnect.com>
> > >> 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 (
> > >>>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbo
> > >>>>> ok
> > >>>>> ) but it gives the Maven2 technique, and the classes used are
> > >>>>> deprecated.
> > >>>>>> -Richard
> > >
> > > --
> > > Ron Wheeler
> > > President
> > > Artifact Software Inc
> > > email: rwheeler@artifact-software.com
> > > skype: ronaldmwheeler
> > > phone: 866-970-2435, ext 102
> > >
> > >
> > > --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Ron Wheeler
> > President
> > Artifact Software Inc
> > email: rwheeler@artifact-software.com
> > skype: ronaldmwheeler
> > phone: 866-970-2435, ext 102
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
Just closing the loop, the eclipse aether project has a maven example showing how to do exactly what I need to do...

So many hours spent searching for this...!!!

http://git.eclipse.org/c/aether/aether-demo.git/tree/aether-demo-maven-plugin/src/main/java/org/eclipse/aether/examples/maven/ResolveArtifactMojo.java


-----Original Message-----
From: Dan Tran [mailto:dantran@gmail.com] 
Sent: Monday, July 22, 2013 6:59 PM
To: Maven Users List
Subject: Re: API to resolve an artifact in Maven3

Eclipse aether is the api you need resolve your artifact for maven 3.1.  I think there are plenty of examples for you to base on. If you have question, you can post it here at user group, there are plenty of dev folks here always trying to help out

-D


On Mon, Jul 22, 2013 at 2:55 PM, Richard Sand <rs...@idfconnect.com> wrote:

> Ok good points, thanks Ron. I'll try what you suggested, and see if I 
> can get some assistance on the developers list. I'm happy to volunteer 
> to update some documentation around what I've learned writing this 
> plugin.
>
> Best regards,
>
> Richard
>
>
> -----Original Message-----
> From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> Sent: Monday, July 22, 2013 5:06 PM
> To: Richard Sand
> Cc: 'Maven Users List'
> Subject: Re: API to resolve an artifact in Maven3
>
> My point is that most of the people here are users and not interested 
> in plug-in development or knowledgeable about plug-in development.
> Custom plug-ins are not required for development of standalone or web 
> applications in Java most of the time.
>
> Most appear to be developed to support specific specific non-java 
> activities. I use one developed as a front-end for DITA document 
> production to simplify the use of the DITA-OT. I use another to 
> simplify the packaging of applications into an installer using IzPack.
>
> These are pretty simple Maven plug-ins and likely do not include very 
> much coordination with or use of Maven internal methods.
>
> I am not sure if there is a better forum for you to get the kind of 
> help that you need.
> The kind of information that you seem to need is probably known by the 
> people who frequent the dev list but they are going to be pretty 
> focused on Maven development and may not welcome third-party development questions.
>
> You might get some help by offering to add documentation to the code 
> in the dev list in return for specific questions. Certainly you are 
> doing a level of research into the examples,  docs and code that could 
> lead to useful updates to the docs or examples.
>
>
>
> Ron
>
>
> On 22/07/2013 4:30 PM, Richard Sand wrote:
> > 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.
> >
> > -Richard
> >
> >
> > -----Original Message-----
> > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > Sent: Monday, July 22, 2013 3:11 PM
> > To: users@maven.apache.org
> > 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.
> >
> >
> > Ron
> >
> >
> > 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 [mailto:russ@gold-family.us]
> >> 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 <rs...@idfconnect.com> 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 [mailto:russ@gold-family.us]
> >>> 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 <rs...@idfconnect.com>
> 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 [mailto:rsand@idfconnect.com]
> >>>> 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 [mailto:anthony.dahanne@gmail.com]
> >>>> 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 :
> >>>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-rely
> >>>> in
> >>>> g
> >>>> -
> >>>> o
> >>>> n-aeth
> >>>> er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_17686
> >>>> 48
> >>>> 2
> >>>>
> >>>> Now I am using something like that :
> >>>>       Artifact enforceArtifact =
> >>>> defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtif
> >>>> ac
> >>>> t
> >>>> I
> >>>> d
> >>>> ,enfor
> >>>> ceVersion,"",enforceType);
> >>>>       MavenProject enforcePom =
> >>>> mavenProjectBuilder.buildFromRepository(
> >>>> enforceArtifact, remoteRepositories, localRepository);
> >>>>       DependencyNode rootNode =
> >>>> dependencyGraphBuilder.buildDependencyGraph(enforcePom, new 
> >>>> CumulativeScopeArtifactFilter(Arrays.asList(Artifact.SCOPE_COMPIL
> >>>> E,
> >>>> 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, <ig...@gmail.com> wrote:
> >>>>
> >>>>> Please check next post
> >>>>>
> >>>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox
> >>>>> /%
> >>>>> 3
> >>>>> c
> >>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> >>>>> It should helps you
> >>>>>
> >>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" 
> >>>>> <rs...@idfconnect.com>
> >> 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 (
> >>>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbo
> >>>>> ok
> >>>>> ) but it gives the Maven2 technique, and the classes used are 
> >>>>> deprecated.
> >>>>>> -Richard
> >
> > --
> > Ron Wheeler
> > President
> > Artifact Software Inc
> > email: rwheeler@artifact-software.com
> > skype: ronaldmwheeler
> > phone: 866-970-2435, ext 102
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
> >
>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



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


Re: API to resolve an artifact in Maven3

Posted by Dan Tran <da...@gmail.com>.
Eclipse aether is the api you need resolve your artifact for maven 3.1.  I
think there are plenty of examples for you to base on. If you have
question, you can post it here at user group, there are plenty of dev folks
here always trying to help out

-D


On Mon, Jul 22, 2013 at 2:55 PM, Richard Sand <rs...@idfconnect.com> wrote:

> Ok good points, thanks Ron. I'll try what you suggested, and see if I can
> get some assistance on the developers list. I'm happy to volunteer to
> update
> some documentation around what I've learned writing this plugin.
>
> Best regards,
>
> Richard
>
>
> -----Original Message-----
> From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> Sent: Monday, July 22, 2013 5:06 PM
> To: Richard Sand
> Cc: 'Maven Users List'
> Subject: Re: API to resolve an artifact in Maven3
>
> My point is that most of the people here are users and not interested in
> plug-in development or knowledgeable about plug-in development.
> Custom plug-ins are not required for development of standalone or web
> applications in Java most of the time.
>
> Most appear to be developed to support specific specific non-java
> activities. I use one developed as a front-end for DITA document production
> to simplify the use of the DITA-OT. I use another to simplify the packaging
> of applications into an installer using IzPack.
>
> These are pretty simple Maven plug-ins and likely do not include very much
> coordination with or use of Maven internal methods.
>
> I am not sure if there is a better forum for you to get the kind of help
> that you need.
> The kind of information that you seem to need is probably known by the
> people who frequent the dev list but they are going to be pretty focused on
> Maven development and may not welcome third-party development questions.
>
> You might get some help by offering to add documentation to the code in the
> dev list in return for specific questions. Certainly you are doing a level
> of research into the examples,  docs and code that could lead to useful
> updates to the docs or examples.
>
>
>
> Ron
>
>
> On 22/07/2013 4:30 PM, Richard Sand wrote:
> > 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.
> >
> > -Richard
> >
> >
> > -----Original Message-----
> > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > Sent: Monday, July 22, 2013 3:11 PM
> > To: users@maven.apache.org
> > 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.
> >
> >
> > Ron
> >
> >
> > 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 [mailto:russ@gold-family.us]
> >> 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 <rs...@idfconnect.com> 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 [mailto:russ@gold-family.us]
> >>> 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 <rs...@idfconnect.com>
> 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 [mailto:rsand@idfconnect.com]
> >>>> 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 [mailto:anthony.dahanne@gmail.com]
> >>>> 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 :
> >>>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relyin
> >>>> g
> >>>> -
> >>>> o
> >>>> n-aeth
> >>>> er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_1768648
> >>>> 2
> >>>>
> >>>> Now I am using something like that :
> >>>>       Artifact enforceArtifact =
> >>>> defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtifac
> >>>> t
> >>>> 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, <ig...@gmail.com> wrote:
> >>>>
> >>>>> Please check next post
> >>>>>
> >>>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%
> >>>>> 3
> >>>>> c
> >>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> >>>>> It should helps you
> >>>>>
> >>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com>
> >> 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 (
> >>>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
> >>>>> ) but it gives the Maven2 technique, and the classes used are
> >>>>> deprecated.
> >>>>>> -Richard
> >
> > --
> > Ron Wheeler
> > President
> > Artifact Software Inc
> > email: rwheeler@artifact-software.com
> > skype: ronaldmwheeler
> > phone: 866-970-2435, ext 102
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
> >
>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
Ok good points, thanks Ron. I'll try what you suggested, and see if I can
get some assistance on the developers list. I'm happy to volunteer to update
some documentation around what I've learned writing this plugin.

Best regards,

Richard


-----Original Message-----
From: Ron Wheeler [mailto:rwheeler@artifact-software.com] 
Sent: Monday, July 22, 2013 5:06 PM
To: Richard Sand
Cc: 'Maven Users List'
Subject: Re: API to resolve an artifact in Maven3

My point is that most of the people here are users and not interested in
plug-in development or knowledgeable about plug-in development.
Custom plug-ins are not required for development of standalone or web
applications in Java most of the time.

Most appear to be developed to support specific specific non-java
activities. I use one developed as a front-end for DITA document production
to simplify the use of the DITA-OT. I use another to simplify the packaging
of applications into an installer using IzPack.

These are pretty simple Maven plug-ins and likely do not include very much
coordination with or use of Maven internal methods.

I am not sure if there is a better forum for you to get the kind of help
that you need.
The kind of information that you seem to need is probably known by the
people who frequent the dev list but they are going to be pretty focused on
Maven development and may not welcome third-party development questions.

You might get some help by offering to add documentation to the code in the
dev list in return for specific questions. Certainly you are doing a level
of research into the examples,  docs and code that could lead to useful
updates to the docs or examples.



Ron


On 22/07/2013 4:30 PM, Richard Sand wrote:
> 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.
>
> -Richard
>
>
> -----Original Message-----
> From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> Sent: Monday, July 22, 2013 3:11 PM
> To: users@maven.apache.org
> 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.
>
>
> Ron
>
>
> 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 [mailto:russ@gold-family.us]
>> 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 <rs...@idfconnect.com> 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 [mailto:russ@gold-family.us]
>>> 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 <rs...@idfconnect.com> 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 [mailto:rsand@idfconnect.com]
>>>> 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 [mailto:anthony.dahanne@gmail.com]
>>>> 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 :
>>>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relyin
>>>> g
>>>> -
>>>> o
>>>> n-aeth
>>>> er-be-compatible-with-maven-3-0-x-and-3-1-x#comment25769765_1768648
>>>> 2
>>>>
>>>> Now I am using something like that :
>>>>       Artifact enforceArtifact =
>>>> defaultArtifactFactory.createArtifact(enforceGroupId,enforceArtifac
>>>> t
>>>> 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, <ig...@gmail.com> wrote:
>>>>
>>>>> Please check next post
>>>>>
>>>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%
>>>>> 3
>>>>> c
>>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>>>>> It should helps you
>>>>>
>>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com>
>> 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 (
>>>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
>>>>> ) but it gives the Maven2 technique, and the classes used are 
>>>>> deprecated.
>>>>>> -Richard
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>


--
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102




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


Re: API to resolve an artifact in Maven3

Posted by Ron Wheeler <rw...@artifact-software.com>.
My point is that most of the people here are users and not interested in 
plug-in development or knowledgeable about plug-in development.
Custom plug-ins are not required for development of standalone or web 
applications in Java most of the time.

Most appear to be developed to support specific specific non-java 
activities. I use one developed as a front-end for DITA document 
production to simplify the use of the DITA-OT. I use another to simplify 
the packaging of applications into an installer using IzPack.

These are pretty simple Maven plug-ins and likely do not include very 
much coordination with or use of Maven internal methods.

I am not sure if there is a better forum for you to get the kind of help 
that you need.
The kind of information that you seem to need is probably known by the 
people who frequent the dev list but they are going to be pretty focused 
on Maven development and may not welcome third-party development questions.

You might get some help by offering to add documentation to the code in 
the dev list in return for specific questions. Certainly you are doing a 
level of research into the examples,  docs and code that could lead to 
useful updates to the docs or examples.


Ron


On 22/07/2013 4:30 PM, Richard Sand wrote:
> 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.
>
> -Richard
>
>
> -----Original Message-----
> From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> Sent: Monday, July 22, 2013 3:11 PM
> To: users@maven.apache.org
> 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.
>
>
> Ron
>
>
> 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 [mailto:russ@gold-family.us]
>> 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 <rs...@idfconnect.com> 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 [mailto:russ@gold-family.us]
>>> 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 <rs...@idfconnect.com> 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 [mailto:rsand@idfconnect.com]
>>>> 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 [mailto:anthony.dahanne@gmail.com]
>>>> 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 :
>>>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying
>>>> -
>>>> 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, <ig...@gmail.com> wrote:
>>>>
>>>>> Please check next post
>>>>>
>>>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3
>>>>> c
>>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>>>>> It should helps you
>>>>>
>>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com>
>> 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 (
>>>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
>>>>> but it gives the Maven2 technique, and the classes used are deprecated.
>>>>>> -Richard
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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


RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
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. 

-Richard


-----Original Message-----
From: Ron Wheeler [mailto:rwheeler@artifact-software.com] 
Sent: Monday, July 22, 2013 3:11 PM
To: users@maven.apache.org
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.


Ron


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 [mailto:russ@gold-family.us]
> 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 <rs...@idfconnect.com> 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 [mailto:russ@gold-family.us]
>> 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 <rs...@idfconnect.com> 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 [mailto:rsand@idfconnect.com]
>>> 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 [mailto:anthony.dahanne@gmail.com]
>>> 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 :
>>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying
>>> -
>>> 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, <ig...@gmail.com> wrote:
>>>
>>>> Please check next post
>>>>
>>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3
>>>> c
>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>>>> It should helps you
>>>>
>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com>
> 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 (
>>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
>>>> but it gives the Maven2 technique, and the classes used are deprecated.
>>>>> -Richard
>>


--
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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




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


Re: API to resolve an artifact in Maven3

Posted by Ron Wheeler <rw...@artifact-software.com>.
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.


Ron


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 [mailto:russ@gold-family.us]
> 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 <rs...@idfconnect.com> 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 [mailto:russ@gold-family.us]
>> 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 <rs...@idfconnect.com> 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 [mailto:rsand@idfconnect.com]
>>> 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 [mailto:anthony.dahanne@gmail.com]
>>> 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 :
>>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-
>>> 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,enforceArtifactI
>>> 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, <ig...@gmail.com> wrote:
>>>
>>>> Please check next post
>>>>
>>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c
>>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>>>> It should helps you
>>>>
>>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com>
> 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 (
>>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
>>>> but it gives the Maven2 technique, and the classes used are deprecated.
>>>>> -Richard
>>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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


RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
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 [mailto:russ@gold-family.us] 
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 <rs...@idfconnect.com> 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 [mailto:russ@gold-family.us]
> 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 <rs...@idfconnect.com> 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 [mailto:rsand@idfconnect.com]
>> 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 [mailto:anthony.dahanne@gmail.com]
>> 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 :
>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-
>> 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,enforceArtifactI
>> 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, <ig...@gmail.com> wrote:
>> 
>>> Please check next post
>>> 
>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c
>>> 7 A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>>> It should helps you
>>> 
>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com>
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 (
>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
>>> but it gives the Maven2 technique, and the classes used are deprecated.
>>>> 
>>>> -Richard
>>>> 
>>>> 
>>>> 
>>>> -------------------------------------------------------------------
>>>> -
>>>> - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>> 
>>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
> 
> -----------------
> Come read my webnovel, Take a Lemon <http://www.takealemon.com>, and 
> listen to the Misfile radio play
<http://www.gold-family.us/audio/misfile.html>!
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

-----------------
Come read my webnovel, Take a Lemon <http://www.takealemon.com>, and listen
to the Misfile radio play <http://www.gold-family.us/audio/misfile.html>!







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


Re: API to resolve an artifact in Maven3

Posted by Russell Gold <ru...@gold-family.us>.
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 <rs...@idfconnect.com> 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 [mailto:russ@gold-family.us] 
> 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 <rs...@idfconnect.com> 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 [mailto:rsand@idfconnect.com]
>> 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 [mailto:anthony.dahanne@gmail.com]
>> 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 :
>> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-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,enforceArtifactId
>> ,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, <ig...@gmail.com> wrote:
>> 
>>> Please check next post
>>> 
>>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7
>>> A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>>> It should helps you
>>> 
>>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com> 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 (
>>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
>>> but it gives the Maven2 technique, and the classes used are deprecated.
>>>> 
>>>> -Richard
>>>> 
>>>> 
>>>> 
>>>> --------------------------------------------------------------------
>>>> - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>> 
>>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
> 
> -----------------
> Come read my webnovel, Take a Lemon <http://www.takealemon.com>, and listen
> to the Misfile radio play <http://www.gold-family.us/audio/misfile.html>!
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

-----------------
Come read my webnovel, Take a Lemon <http://www.takealemon.com>, 
and listen to the Misfile radio play <http://www.gold-family.us/audio/misfile.html>!





RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
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 [mailto:russ@gold-family.us] 
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 <rs...@idfconnect.com> 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 [mailto:rsand@idfconnect.com]
> 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 [mailto:anthony.dahanne@gmail.com]
> 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 :
> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-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,enforceArtifactId
> ,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, <ig...@gmail.com> wrote:
> 
>> Please check next post
>> 
>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7
>> A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>> It should helps you
>> 
>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com> 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 (
>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
>> but it gives the Maven2 technique, and the classes used are deprecated.
>>> 
>>> -Richard
>>> 
>>> 
>>> 
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>> 
>> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

-----------------
Come read my webnovel, Take a Lemon <http://www.takealemon.com>, and listen
to the Misfile radio play <http://www.gold-family.us/audio/misfile.html>!







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


Re: API to resolve an artifact in Maven3

Posted by Russell Gold <ru...@gold-family.us>.
Hi Richard,

Can you be more specific? What exactly is your goal?

- Russ

On Jul 20, 2013, at 11:02 PM, Richard Sand <rs...@idfconnect.com> 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 [mailto:rsand@idfconnect.com] 
> 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 [mailto:anthony.dahanne@gmail.com]
> 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 :
> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-on-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,enforceArtifactId,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, <ig...@gmail.com> wrote:
> 
>> Please check next post
>> 
>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7A
>> BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>> It should helps you
>> 
>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com> 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 (
>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
>> but it gives the Maven2 technique, and the classes used are deprecated.
>>> 
>>> -Richard
>>> 
>>> 
>>> 
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>> 
>> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

-----------------
Come read my webnovel, Take a Lemon <http://www.takealemon.com>, 
and listen to the Misfile radio play <http://www.gold-family.us/audio/misfile.html>!





RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
Hi Oliver - the problem is that little or none of the code is javadoc'ed and
the only tutorials to be found are from Maven2. Its hard enough trying to
decipher my own code... :)

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?

I'll be happy to help contribute to documenting how this is done. Right now
I appreciate all the help I can get to finish this plugin and move onto such
things!

-Richard

-----Original Message-----
From: Olivier Lamy [mailto:olamy@apache.org] 
Sent: Sunday, July 21, 2013 7:56 AM
To: Maven Users List
Subject: Re: API to resolve an artifact in Maven3

there is nothing magic :-)
All what we are doing in open source this mean you can access without
restriction to the sources.
Give us more details on what you want to do?

2013/7/21 Richard Sand <rs...@idfconnect.com>:
> 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 [mailto:rsand@idfconnect.com]
> 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 [mailto:anthony.dahanne@gmail.com]
> 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 :
> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-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,enforceArtifactId
> ,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, <ig...@gmail.com> wrote:
>
>> Please check next post
>>
>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7
>> A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>> It should helps you
>>
>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com> 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 (
>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
>> but it gives the Maven2 technique, and the classes used are deprecated.
>> >
>> > -Richard
>> >
>> >
>> >
>> > -------------------------------------------------------------------
>> > -
>> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>



--
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy

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




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


Re: API to resolve an artifact in Maven3

Posted by Olivier Lamy <ol...@apache.org>.
there is nothing magic :-)
All what we are doing in open source this mean you can access without
restriction to the sources.
Give us more details on what you want to do?

2013/7/21 Richard Sand <rs...@idfconnect.com>:
> 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 [mailto:rsand@idfconnect.com]
> 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 [mailto:anthony.dahanne@gmail.com]
> 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 :
> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-on-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,enforceArtifactId,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, <ig...@gmail.com> wrote:
>
>> Please check next post
>>
>> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7A
>> BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
>> It should helps you
>>
>> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com> 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 (
>> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
>> but it gives the Maven2 technique, and the classes used are deprecated.
>> >
>> > -Richard
>> >
>> >
>> >
>> > --------------------------------------------------------------------
>> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>



-- 
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy

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


RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
Ok great, than you Bapiste. Without reading this source, I'd never even have found the shared dependency plug-in. These docs have been really frustrating. I'm not going to sit and complain, I'm volunteering to work on them and help make some high leven guides to steer people like me in the right direction with the proper recipes, examples etc. That is, once I have my brain wrapped around it myself!

So the animals I want are:

- DefaultDependencyGraphBuilder, which I can annotate as a component to instantiate, and should handle M2,M3,M3.1
- ArtifactRepository localRepository, which I can load as a @Parameter with defaultValue = "${localRepository}".


If I have a configuration parameter for my plugin which is a list of dependencies unrelated to the project dependencies, e.g. 

<configuration>
	<dependencies>
		<dependentartifact>
			<name>
			<grouppid>
			<artifactid>
 		</dependentartifact>

Will I end up with a Set<Artifacts> dependencies? And then use the two classes above to resolve the artifacts?




-----Original Message-----
From: bmathus@gmail.com [mailto:bmathus@gmail.com] On Behalf Of Baptiste MATHUS
Sent: Sunday, July 21, 2013 8:24 AM
To: Maven Users List
Subject: RE: API to resolve an artifact in Maven3

See
http://svn.codehaus.org/mojo/trunk/mojo/extra-enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforceBytecodeVersion.javaand
the dependency builder part.

Cheers
Le 21 juil. 2013 05:03, "Richard Sand" <rs...@idfconnect.com> a écrit :

> 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 [mailto:rsand@idfconnect.com]
> 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 [mailto:anthony.dahanne@gmail.com]
> 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 :
>
> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-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,enforceArtifactId
> ,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, <ig...@gmail.com> wrote:
>
> > Please check next post
> >
> > http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c
> > 7A BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> > It should helps you
> >
> > On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com>
> 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 (
> > http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
> > but it gives the Maven2 technique, and the classes used are deprecated.
> > >
> > > -Richard
> > >
> > >
> > >
> > > ------------------------------------------------------------------
> > > --
> > > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



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


RE: API to resolve an artifact in Maven3

Posted by Baptiste MATHUS <ml...@batmat.net>.
See
http://svn.codehaus.org/mojo/trunk/mojo/extra-enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/EnforceBytecodeVersion.javaand
the dependency builder part.

Cheers
Le 21 juil. 2013 05:03, "Richard Sand" <rs...@idfconnect.com> a écrit :

> 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 [mailto:rsand@idfconnect.com]
> 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 [mailto:anthony.dahanne@gmail.com]
> 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 :
>
> http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-on-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,enforceArtifactId,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, <ig...@gmail.com> wrote:
>
> > Please check next post
> >
> > http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7A
> > BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> > It should helps you
> >
> > On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com>
> 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 (
> > http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
> > but it gives the Maven2 technique, and the classes used are deprecated.
> > >
> > > -Richard
> > >
> > >
> > >
> > > --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
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 [mailto:rsand@idfconnect.com] 
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 [mailto:anthony.dahanne@gmail.com]
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 :
http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-on-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,enforceArtifactId,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, <ig...@gmail.com> wrote:

> Please check next post
>
> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7A
> BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> It should helps you
>
> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com> 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 (
> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook)
> but it gives the Maven2 technique, and the classes used are deprecated.
> >
> > -Richard
> >
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>



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




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


RE: API to resolve an artifact in Maven3

Posted by Richard Sand <rs...@idfconnect.com>.
+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 [mailto:anthony.dahanne@gmail.com] 
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 :
http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-on-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,enforceArtifactId,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, <ig...@gmail.com> wrote:

> Please check next post
>
> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7A
> BC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> It should helps you
>
> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com> 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 (
> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook) 
> but it gives the Maven2 technique, and the classes used are deprecated.
> >
> > -Richard
> >
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>



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


Re: API to resolve an artifact in Maven3

Posted by Anthony Dahanne <an...@gmail.com>.
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 :
http://stackoverflow.com/questions/17685441/can-a-maven-mojo-relying-on-aether-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,enforceArtifactId,enforceVersion,"",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, <ig...@gmail.com> wrote:

> Please check next post
>
> http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7ABC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
> It should helps you
>
> On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com> 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 (
> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook) but
> it gives the Maven2 technique, and the classes used are deprecated.
> >
> > -Richard
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>

Re: API to resolve an artifact in Maven3

Posted by ig...@gmail.com.
Please check next post
http://mail-archives.apache.org/mod_mbox/maven-users/201307.mbox/%3c7ABC22E9-32C5-44F6-BDB3-117414907DB8@gmail.com%3e
It should helps you

On Jul 19, 2013, at 9:39 PM, "Richard Sand" <rs...@idfconnect.com> 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 (http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook) but it gives the Maven2 technique, and the classes used are deprecated.
> 
> -Richard
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>