Hi,

I'd like to put another patch up for discussion. I have attached [1] and [2] to the Jira issue. These patches provide (yet another :-) extension to use JDK 1.5+ annotations for Mojos. The consist of the annotations [1] and a new descriptor extractor [2] that uses QDOX 1.6.3.

The main features are:

1. Multi-Mojo annotations. After writing a dozen plugins where I had to use subclassing to supply to Mojos of the same kind in two different configurations (like AbstractCompilerMojo, CompilerMojo and TestCompilerMojo), I extended the annotations to allow a class to be annotated with two different goals.

2. Mojo inheritance (rather: prototypes): With this, you can specify prototype Mojos from which your Mojos inherits decriptor and parameter properties. Now you can extend a Maven Mojo without duplicating all annotations. Mojo and parameter annotations can be overwritten, of course.

Regards,
Jochen

Examples:

Multi-Mojo-Annotation

@MojoClasses( {
@MojoClass( goal = "compile", phase = "compile", dependencyResolutionRequired = Phase.COMPILE, @MojoClass( goal = "test-compile", phase = "test-compile", dependencyResolutionRequired = Phase.TEST} )

Prototypes:

@MojoClass( goal = "compile", phase = "compile", prototypes = "org.apache.maven.plugin:maven-compiler-plugin:compile" )

Parameter Override:

To overried prototype parameters, you can use the class-level annotations for parameters or components:

@MojoParameters( @MojoParameter(name = "verbose", defaultValue = Bool.TRUE )

Usage:

To use the patches, you should add the following to your pom.xml:

<plugin>
   <inherited>true</inherited>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-plugin-plugin</artifactId>
   <extensions>true</extensions>
   <dependencies>
       <dependency>
           <groupId>org.apache.maven</groupId>
           <artifactId>maven-plugin-tools-java5</artifactId>
           <version>SNAPSHOT</version>
       </dependency>
   </dependencies>
</plugin>

You should also apply QDOX patches [3] and [4].

The patches were tested with Maven 2.0.5 and 2.0.7. They do not run with 2.0.6 yet.

[1] http://jira.codehaus.org/secure/attachment/28141/maven-plugin-tools-annotations.tar.gz [2]
http://jira.codehaus.org/secure/attachment/28142/maven-plugin-tools-java5.tar.gz
[3]
http://jira.codehaus.org/browse/QDOX-123
[4] http://jira.codehaus.org/browse/QDOX-122



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to