Hi Sascha,

Sascha Vogt wrote:

> Hi all,
> 
> I currently have a small issue with upgrading to Maven 3 and a custom
> mojo I wrote.
> 
> I need to find out if the dependency is a Maven plugin. With Maven 2.x
> one could check the type by comparing Artifact.getType() to
> "maven-plugin". With Maven 3 this returns now "jar" instead of
> "maven-plugin".
> Is there any other way to find out if a dependency is a Maven plugin?
> Any pointers to the API would be greatly appreciated!
> 
> E.g. up to Maven 3 this code did work:
> 
> MavenProject prj = ...
> for(Iterator i = prj.getDependencyArtifacts().iterator(); i.hasNext();)
> {
>    Artifact artifact = (Artifact) i.next();
>    if( "maven-plugin".equals( artifact.getType() ) ) {
>       //do some specific stuff
>    }
> }

Why do you want to know? In M2 a plugin should never be a dependency of 
another one anyway, because you will face all kind of unexpected effects due 
to the different classloader model.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to