You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Johannes Schneider <js...@gmx.de> on 2014/07/28 10:12:04 UTC

Maven 3 Plugin Development with Repository Queries

Hi,
 
I am developing a plugin that needs to query the repositories. I'm using the Aether API because I thought that's the Maven 3 way to do it (cf. http://blog.sonatype.com/2011/01/how-to-use-aether-in-maven-plugins/) and because many of the Maven 2 methods are marked as deprecated. With Maven 3.0.5, everything works fine. But now, trying Maven 3.2.1 and 3.2.2, I get an exception:
------
Error injecting: com.dialogika.infport.plugins.helper.CheckParentMojo
java.lang.NoClassDefFoundError: org/sonatype/aether/artifact/Artifact
------
 
It is the injection of org.sonatype.aether.RepositorySystem that does not work anymore:
------
@Component
private RepositorySystem repoSystem;
------
 
First of all, I am of course interested in how to fix this problem, but, asking more generally: Is the Aether API still the way of how to resolve artifacts? Or should I better stick to the Maven 2 API (as most of the plugins out there still are, as I saw)?
 
And, in addition to this: Are there any good, up-to-date resources on how to write maven plugins? Some plugins I could use as a a reference? Many of the tutorials and examples seem to be quite out-dated and not going very deep into details.
 
Thanks in advance for your help!
 
Johannes

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


Re: Maven 3 Plugin Development with Repository Queries

Posted by Dan Tran <da...@gmail.com>.
Best not to directly deal with aether, but to use abstraction
like DependencyGraphBuilder which uses aether when under maven 3

-D


On Tue, Aug 5, 2014 at 5:21 AM, Johannes Schneider <js...@gmx.de> wrote:

> Hi!
>
> The plugins you are mentioning are still based on Maven 2. Neither have I
> found any plugin using aether and the Maven 3 api, nor seems any deeper
> documentation to be available. Maven 3 has been released years ago. I
> thought it would be worth trying its new API rather than sticking to the
> old compatibility layer...
>
> Anyway, I've been able to find out what the problem with my plugin is:
> Maven 3.2.2 seems to use another version of aether, namely the one with
> groupId org.eclipse.aether, not org.sonatype.aether as it was with Maven
> 3.0.5. That's "great": Now I have a plugin that either works with Maven
> 3.0.5 or with Maven 3.2.2. Fortunately, we can all use the same version in
> our dev team. So once we decide to upgrade to Maven 3.2.2, we do not need
> Maven 3.0.5 support anymore.
>
> Kind regards,
> Johannes
>
>
>
> > Gesendet: Montag, 28. Juli 2014 um 20:49 Uhr
> > Von: "Dan Tran" <da...@gmail.com>
> > An: "Maven Users List" <us...@maven.apache.org>
> > Betreff: Re: Maven 3 Plugin Development with Repository Queries
> >
> > I am interested on the query capability. However, I ended up to  use
> > maven-dependency-tree and maven-compat to resolve artifacts. Take a look
> at
> > maven-dependency-plugin, maven-report-info-plugin, license-maven-plugin
> for
> > various sample code.  However, those are not directly deal with aether
> >
> > -D
> >
> >
> > On Mon, Jul 28, 2014 at 1:12 AM, Johannes Schneider <js...@gmx.de>
> wrote:
> >
> > > Hi,
> > >
> > > I am developing a plugin that needs to query the repositories. I'm
> using
> > > the Aether API because I thought that's the Maven 3 way to do it (cf.
> > > http://blog.sonatype.com/2011/01/how-to-use-aether-in-maven-plugins/)
> and
> > > because many of the Maven 2 methods are marked as deprecated. With
> Maven
> > > 3.0.5, everything works fine. But now, trying Maven 3.2.1 and 3.2.2, I
> get
> > > an exception:
> > > ------
> > > Error injecting: com.dialogika.infport.plugins.helper.CheckParentMojo
> > > java.lang.NoClassDefFoundError: org/sonatype/aether/artifact/Artifact
> > > ------
> > >
> > > It is the injection of org.sonatype.aether.RepositorySystem that does
> not
> > > work anymore:
> > > ------
> > > @Component
> > > private RepositorySystem repoSystem;
> > > ------
> > >
> > > First of all, I am of course interested in how to fix this problem,
> but,
> > > asking more generally: Is the Aether API still the way of how to
> resolve
> > > artifacts? Or should I better stick to the Maven 2 API (as most of the
> > > plugins out there still are, as I saw)?
> > >
> > > And, in addition to this: Are there any good, up-to-date resources on
> how
> > > to write maven plugins? Some plugins I could use as a a reference?
> Many of
> > > the tutorials and examples seem to be quite out-dated and not going
> very
> > > deep into details.
> > >
> > > Thanks in advance for your help!
> > >
> > > Johannes
> > >
> > > ---------------------------------------------------------------------
> > > 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: Maven 3 Plugin Development with Repository Queries

Posted by Johannes Schneider <js...@gmx.de>.
Hi!

The plugins you are mentioning are still based on Maven 2. Neither have I found any plugin using aether and the Maven 3 api, nor seems any deeper documentation to be available. Maven 3 has been released years ago. I thought it would be worth trying its new API rather than sticking to the old compatibility layer...

Anyway, I've been able to find out what the problem with my plugin is: Maven 3.2.2 seems to use another version of aether, namely the one with groupId org.eclipse.aether, not org.sonatype.aether as it was with Maven 3.0.5. That's "great": Now I have a plugin that either works with Maven 3.0.5 or with Maven 3.2.2. Fortunately, we can all use the same version in our dev team. So once we decide to upgrade to Maven 3.2.2, we do not need Maven 3.0.5 support anymore.

Kind regards,
Johannes



> Gesendet: Montag, 28. Juli 2014 um 20:49 Uhr
> Von: "Dan Tran" <da...@gmail.com>
> An: "Maven Users List" <us...@maven.apache.org>
> Betreff: Re: Maven 3 Plugin Development with Repository Queries
>
> I am interested on the query capability. However, I ended up to  use
> maven-dependency-tree and maven-compat to resolve artifacts. Take a look at
> maven-dependency-plugin, maven-report-info-plugin, license-maven-plugin for
> various sample code.  However, those are not directly deal with aether
> 
> -D
> 
> 
> On Mon, Jul 28, 2014 at 1:12 AM, Johannes Schneider <js...@gmx.de> wrote:
> 
> > Hi,
> >
> > I am developing a plugin that needs to query the repositories. I'm using
> > the Aether API because I thought that's the Maven 3 way to do it (cf.
> > http://blog.sonatype.com/2011/01/how-to-use-aether-in-maven-plugins/) and
> > because many of the Maven 2 methods are marked as deprecated. With Maven
> > 3.0.5, everything works fine. But now, trying Maven 3.2.1 and 3.2.2, I get
> > an exception:
> > ------
> > Error injecting: com.dialogika.infport.plugins.helper.CheckParentMojo
> > java.lang.NoClassDefFoundError: org/sonatype/aether/artifact/Artifact
> > ------
> >
> > It is the injection of org.sonatype.aether.RepositorySystem that does not
> > work anymore:
> > ------
> > @Component
> > private RepositorySystem repoSystem;
> > ------
> >
> > First of all, I am of course interested in how to fix this problem, but,
> > asking more generally: Is the Aether API still the way of how to resolve
> > artifacts? Or should I better stick to the Maven 2 API (as most of the
> > plugins out there still are, as I saw)?
> >
> > And, in addition to this: Are there any good, up-to-date resources on how
> > to write maven plugins? Some plugins I could use as a a reference? Many of
> > the tutorials and examples seem to be quite out-dated and not going very
> > deep into details.
> >
> > Thanks in advance for your help!
> >
> > Johannes
> >
> > ---------------------------------------------------------------------
> > 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: Maven 3 Plugin Development with Repository Queries

Posted by Dan Tran <da...@gmail.com>.
I am interested on the query capability. However, I ended up to  use
maven-dependency-tree and maven-compat to resolve artifacts. Take a look at
maven-dependency-plugin, maven-report-info-plugin, license-maven-plugin for
various sample code.  However, those are not directly deal with aether

-D


On Mon, Jul 28, 2014 at 1:12 AM, Johannes Schneider <js...@gmx.de> wrote:

> Hi,
>
> I am developing a plugin that needs to query the repositories. I'm using
> the Aether API because I thought that's the Maven 3 way to do it (cf.
> http://blog.sonatype.com/2011/01/how-to-use-aether-in-maven-plugins/) and
> because many of the Maven 2 methods are marked as deprecated. With Maven
> 3.0.5, everything works fine. But now, trying Maven 3.2.1 and 3.2.2, I get
> an exception:
> ------
> Error injecting: com.dialogika.infport.plugins.helper.CheckParentMojo
> java.lang.NoClassDefFoundError: org/sonatype/aether/artifact/Artifact
> ------
>
> It is the injection of org.sonatype.aether.RepositorySystem that does not
> work anymore:
> ------
> @Component
> private RepositorySystem repoSystem;
> ------
>
> First of all, I am of course interested in how to fix this problem, but,
> asking more generally: Is the Aether API still the way of how to resolve
> artifacts? Or should I better stick to the Maven 2 API (as most of the
> plugins out there still are, as I saw)?
>
> And, in addition to this: Are there any good, up-to-date resources on how
> to write maven plugins? Some plugins I could use as a a reference? Many of
> the tutorials and examples seem to be quite out-dated and not going very
> deep into details.
>
> Thanks in advance for your help!
>
> Johannes
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>