ref: https://maven.apache.org/guides/plugin/guide-java-plugin-development.html
This is my reference material for writing maven plugins. All of this code was autogenerated via the below command.
mvn archetype:generate \
-DgroupId=sample.plugin \
-DartifactId=hello-world-maven-plugin \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-plugin
Put this plugin into your local .m2 repo.
mvn install
Then add it to the plugins section of a consumer project and build (e.g. ~/dev/tmp/java-maven-demo
).
<plugin>
<groupId>sample.plugin</groupId>
<artifactId>hello-world-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
</plugin>
Then call the plugin on the command line from that project.
mvn hello-world:deploy