maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Dahanne <anthony.daha...@gmail.com>
Subject Re: API to resolve an artifact in Maven3
Date Fri, 19 Jul 2013 18:32:06 GMT
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, <igor.zapletnev@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" <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
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message