An artifact built by Maven can be declared as a Maven plugin by specifying the packaging as maven-plugin
in the pom.xml
.
<packaging>maven-plugin</packaging>
You need to declare a dependency on the plugin API and annotations.
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.3.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.5</version>
<scope>provided</scope>
</dependency>
You need to add a plugin to generate the metadata.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5</version>
</plugin>