I'm writing a Maven 3 plugin which builds plugins for another application. A plugin is basically a JAR file with some fancy manifests. The compiled classes need to be post-processed for the plugin to work with the production build of the host application. Unfortunately, the processed version of the plugin won't work with the debug build of the host. I therefore need to produce two artifacts: the raw classes with the classifier debug
and the post-processed version as the main artifact.
I've got a working Maven plugin which defines a new packaging type with its own lifecycle mappings. In order to create the debug
artifact, though, I need to call jar:jar
with the classifier
property set. I haven't been able to find a way to change the configuration for a Mojo execution from a lifecycle mapping. Is that even possible? Will I have to make everyone use a super POM provided with my plugin?
For reference, here's the relevant part of my components.xml
:
<?xml version="1.0" encoding="utf-8" ?>
<component-set>
<components>
<!-- snip other components, including ArtifactHandler -->
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>my-packaging</role-hint>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<lifecycles>
<lifecycle>
<id>default</id>
<phases>
<!-- snip other phases -->
<package>
org.apache.maven.plugins:maven-jar-plugin:jar
</package>
</phases>
</lifecycle>
</lifecycles>
</configuration>
</component>
</components>
</component-set>
I need the execution to be equivalent to this POM fragment:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>debug-jar</id>
<phase>package</phase>
<goal>jar</goal>
<configuration>
<classifier>debug</classifier>
</configuration>
</execution>
</executions>
</plugin>
I found one SO question that seems to be the same thing I'm looking for but it doesn't have any answers. This is the documentation that I used to create the lifecycle mapping in the first place. Heavy Googling hasn't turned up anything that seems related, but I'm having trouble coming up with sufficiently specific search terms.