Introduction
This is a Maven 2 and 3 extension of maven-plugin-plugin that allows writing Annotated Plug-in Mojos using JDK 1.5+ annotations instead of doclet comments.
This has a couple of substantial benefits over using JavaDoc-style annotations:
- You will get compile-time checks for your plugin metadata.
- You can use annotations on interface/class getter methods instead of field annotations, which allows for greater flexibility in your plugin object model - injection inheritance being the most important one.
- Since JDK 1.5 annotations are supported in most IDEs, you will benefit from code-completion and syntactic checks.
Enjoy!
Prerequisites
- JDK 5.0 or later
- Maven 2.2.0 or later, Maven 3.0-beta-1 or later
- maven-plugin-plugin 2.6 or later
Configuration
To use the plugin add Artifactory plugins repository and the plugin configuration to your pom.xml.
Use -Pjfrog-plugins on the first execution to download the plugin.
Using Mojo Annotations
NOTE
This plugin relies on JDK 1.5 and uses the Annotation Processing Tool (APT). It is required to run Maven with JDK 1.5 or later (set your JAVA_HOME to point to the JDK not the JRE).
Simple example
Element description is taken either from the element's JavaDoc comment or from a "description" attribute on appropriate annotations.
Getter Methods Annotations
You can also use field annotations on getter methods, either in interfaces or regular classes.
For example:
Links
- Git Repository: https://github.com/JFrogDev/maven-anno-mojo
- Issue Management: http://issues.jfrog.org/jira/browse/ANMJ