I would like to provide a maven plugin with a custom <packaging>
that provides a complex lifecycle. As part of this lifecycle, I need to run the maven-compiler-plugin 2 times in different phases with different configurations. I would like to make this packaging as simple as possible to use. The goal would be that all a consumer of this plugin would have to do is select the new packaging and not have to do any plugin execution configuration:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>some.other.group</groupId>
<artifactId>something-useful</artifactId>
<version>1.0.0</version>
<packaging>my-maven-plugin-jar</packaging>
...
<build>
<plugins>
<plugin>
<groupId>my.group.id</groupId>
<artifactId>my-maven-plugin</artifactId>
<version>0.0.1</version>
<extensions>true</extensions
</plugin>
</plugin>
</build>
</project>
Then my custom lifecycle would bind the all the goals I needed including the compiler both times. The problem is, each compiler pass is compiling different source (using <includes> and <excludes>
into different destinations (using outputDirectory) and I cant find any way to configure them without doing so in the <executions>
sub-element of pom using my plugin. I could do this with an archetype, but it seems to me to be a little more elegant to do this with a custom packaging. Any suggestions?