On 2007-06-25 17:22:36 +0200, "Eric Redmond" <[EMAIL PROTECTED]> said:


This was my first course of action - and still the preferred as it it
pre-compilation. However, there are a couple problems using QDox - which I'd
be interested to know about if you have overcome them:

1) Referring to constants that exist in compiled dependencies

2) Amalgamated values, such as:

@Goal( name = SomeObject.GOAL + "-" + ( 5 * 3 ) + "-" + OtherObject.SUFFIX )

The first is hackable, the latter is what made me shy away from continuing
with QDox. Not impossible, but necessary.

Since both cases do not work with the current JavaDoc annotations, I chose to ignore them at first ;-) They are valid Java5 syntax, yes, but I don't think we need to support them immediatly

It's more the multi-mojo annotations and the prototypes I wanted to put up for discussion. And I, too, think that qdox pre-compilation would be better, most of all since the class file contains no mojo or parameter descriptions. And I think it's better to evolve qdox, since we might want to have general annotations processing without the sun jdk some day, too.

If the concept is accepted, I will gladly help to hack away at qdox. There sure is work to do there...

Regards,
Jochen


Eric

On 6/25/07, Jochen Kuhnle <[EMAIL PROTECTED]> 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.

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]




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

Reply via email to