You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jörg Schaible <jo...@scalaris.com> on 2011/06/01 08:40:05 UTC

Re: Classpath for Maven Plugin

Karl Heinz Marbaise wrote:

> Hi Jörg,
> 
> first thanks for your answer...
> 
>>> <plugin>
>>>     <groupId>com.soebes.maven.plugins.mlv</groupId>
>>>     <artifactId>maven-license-verifier-plugin</artifactId>
>>>     <version>0.4</version>
>>>     <dependencies>
>>>       <dependency>
>>>         <groupId>YouCompanyPackage.licenses</groupId>
>>>         <artifactId>licenses</artifactId>
>>>         <version>6</version>
>>>       </dependency>
>>>     </dependencies>
>>>     <configuration>
>>>       <verbose>true</verbose>
>>>     </configuration>
>>> </plugin>
>>>
>> Not really possible for M2, since every plugin is loaded only once i.e.
>> if you have configured this plugin two times with different deps in the
>> reactor, the classpath is fixed with the first execution, ignoring the
>> deps in the second.
> The plugin is intended for M3 (may be some support for M2 not sure about
> that, may be i have to make the decision some time)...
> 
> 
> Currently my intention is to a load a resource (one or later more xml
> files) from that dependency which is given via the plugin dependency ...
> 
>> M3 will use separate classloders. If that artifact is of type jar, you
>> may simply load any content as resource.
> Do i have to access this class loader in a special way or can i use the
> usual way via this.getClass().getResourceAs..().. from within the Mojo
> i'm working on...?
> 
> The current solution i'm using is via this.getClass()...see here:
> https://github.com/khmarbaise/Maven-License-Verifier-
Plugin/blob/master/src/main/java/com/soebes/maven/plugins/mlv/AbstractLicenseVerifierPlugIn.java#L267

AFAICS this should work.  However, I avoid this situation normally since we 
still use M2 for production. Therefore is my expertise rather brittle for 
the M3 case.

- Jörg


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