maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <Joerg.Schai...@scalaris.com>
Subject Re: How to find out if a dependency is a Maven plugin?
Date Thu, 01 Jan 1970 00:00:00 GMT
Sascha Vogt wrote:

> Am 27.09.2012 15:07, schrieb Jörg Schaible:
>> Sascha Vogt 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!
>>> [snip]
>> 
>> 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.
> The idea was to have one Mojo extend another Mojo.

In M2, it is simply not reliable and should therefore never be done.

> There is also a
> maven-inherit-plugin out there
> (https://github.com/ops4j/org.ops4j.pax.construct/tree/master/maven-
inherit-plugin)
> which suffers from the same issue.

Yes, I complained about that before.

> What do you mean by different classloader model?

M3 uses isolated classloaders for the individual plugins.

M2 will load every plugin once and only once. If you plugin depends on 
plugin x in version 2.x, but it is used elsewhere in the reactor in version 
1.x, it depends on the build sequence, which version is actually used - 
point is that your plugin has absolutely no control over version of the 
depending plugin - never. The inherit-plugin is therefore the best candidate 
to break every big multi-project build in subtle ways. You have been warned!

- Jörg



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


Mime
View raw message