sheenobu dot net

2022-12-30 - Using AbstractMavenLifecycleParticipant

I have been experimenting with Java OSGI some more and wanted to see how maven build extensions work.

I could never get the example here working so I chased around the internet until I got a working example.

Caveats: the "new" way seems to be defining sisu components so you may want to include sisu-maven-plugin and @Named @Bean as well (via the example linked above). But I could never get it working.

@Component(role = AbstractMavenLifecycleParticipant.class, hint = "...")
public class MyLifecycleParticipant extends AbstractMavenLifecycleParticipant {

}
<plugin>
    <groupId>org.codehaus.plexus</groupId>
    <artifactId>plexus-component-metadata</artifactId>
    <version>...</version>
    <executions>
        <execution>
            <goals>
                <goal>generate-metadata</goal>
                <goal>generate-test-metadata</goal>
            </goals>
        </execution>
    </executions>
</plugin>
← Back to /snippets