Hi,

Maven supports an own extension mechanism described in 
https://maven.apache.org/pom.html#Extensions. I was under the expresseion 
that it can be used to inject new components into the Plexus container that 
are available for any other plugin (as long as they set the extensions flag 
to true).

However, I failed to use this mechanism to declare new components to handle 
mar artifacts (Axis 2 modules). I added a jar file as extension containing a 
single file in META-INF/plexus/components.xml with the following content:

========================= %< =====================
<component-set>
  <components>
    <component>
      <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
      <role-hint>mar</role-hint>
      
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
      <configuration>
        <type>mar</type>
        <extension>mar</extension>
        <packaging>jar</packaging>
        <addedToClasspath>true</addedToClasspath>
        <includesDependencies>true</includesDependencies>
      </configuration>
    </component>
    <component>
      <role>org.codehaus.plexus.archiver.UnArchiver</role>
      <role-hint>mar</role-hint>
      
<implementation>org.codehaus.plexus.archiver.zip.ZipUnArchiver</implementation>
      <instantiation-strategy>per-lookup</instantiation-strategy>
    </component>
  </components>
</component-set>
========================= %< =====================

Then I tried to use the UnArchiver component with the maven dependency 
plugin (goal: unpack-dependencies) to extract the contents of a dependency 
declared as:

========================= %< =====================
  <dependency>
    <groupId>org.apache.axis2</groupId>
    <artifactId>ping</artifactId>
    <version>1.6.4</version>
    <type>mar</mar>
    <scope>compile</scope>
  </dependency>
========================= %< =====================

However, the goal fails, it claims it does not know about a proper 
UnArchiver for artifacts of type 'mar'.

In contrast, if I declare the jar file with the plexus component descriptor 
as direct dependency of the dependency plugin, the descriptor is found and 
the mar file can be unpacked (independent of the setting for the extensions 
flag).

Why is the new component descriptor not considered if declared as extension? 
I wonder if the behavior is right or did I stumble over a subtile bug in 
Maven (3.3.9)?

Cheers,
Jörg


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

Reply via email to