On 25 Jun 07, at 3:41 AM 25 Jun 07, Jochen Kuhnle wrote:
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.
How is any of this different then what's in the branch? Look at the
dashboard for a description of the work. Eric and Kenney have worked
on something and it's in a branch I started trying to integrate so
work with them to integrate any difference.
http://docs.codehaus.org/display/MAVEN/Home
Specifically the "Java 5 Annotations for Plugins"
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]
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder and PMC Chair, Apache Maven
jason at sonatype dot com
----------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]