Sorry guys, my analysis was premature.  I figured out the issue (which
likely applies to java5 annotations on java mojos as well as groovy).

By default, the maven-plugin-plugin:descriptor mojo runs in the
generate-resources phase.  But of course, the class files (from compile
phase) with the java-annotations are not there yet.  So all I have to do is
add:

        <executions>
          <execution>
            <id>default-descriptor</id>
            <phase>process-classes</phase>
          </execution>
        </executions>

to my maven-plugin-plugin declaration and it works even with mvn clean
install.

Perhaps this should be updated on
http://maven.apache.org/plugin-tools/maven-plugin-plugin/examples/using-annotations.html
As well, the mvnref book is out of date:
http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-custom-plugin.html
which
says Maven does not support java5 annotations.

My misguided analysis before was caused by mvn install working but mvn
clean install not (when eclipse generated the class files prior to the
build).

Thanks,
Ben

On Fri, Aug 24, 2012 at 12:21 PM, Ben Tatham <[email protected]>wrote:

> Thanks - maven-plugin-plugin 2.4 didn't have java5 annotations, so it
> wouldn't work there regardless.  The issue seems to be the groovy compiler
> since it works sometimes (when greclipse generates the class files, but not
> when gmaven-plugin generates them).
>
> For now, I'll (unfortunately) stick with javadoc annotations.
>
> -Ben
>
>
> On Thu, Aug 23, 2012 at 5:40 PM, Hervé BOUTEMY <[email protected]>wrote:
>
>> ok, I didn't know this one
>> IIUC, it's based on groovy-maven-plugin, which does woodoo to transform
>> Groovy
>> to java plugin without maven-plugin-plugin being aware of it
>>
>> If you open a Jira issue with a testcase working with maven-plugin-plugin
>> 2.4,
>> I can have a look to find why it stops working with 3.1.
>>
>> Regards,
>>
>> Hervé
>>
>> Le jeudi 23 août 2012 13:45:14 Manfred Moser a écrit :
>> > It at least was possible to write a plugin in Groovy without annotations
>> > though. See
>> >
>> >
>> http://www.sonatype.com/books/mcookbook/reference/writing-plugins-alternativ
>> > e-sect-writing-groovy.html
>> >
>> > Not sure what happened..
>> >
>> > manfred
>> >
>> > On Thu, August 23, 2012 1:18 pm, Hervé BOUTEMY wrote:
>> > > Groovy isn't actually supported: see maven-script part of
>> > > http://maven.apache.org/plugin-tools/
>> > >
>> > > There isn't even anybody who opened a Jira issue about this.
>> > >
>> > > Regards,
>> > >
>> > > Hervé
>> > >
>> > > Le mercredi 22 août 2012 14:07:39 Ben Tatham a écrit :
>> > >> I am trying to use java-annotations (not javadoc) on a Mojo written
>> in
>> > >> groovy, as per [1].  (I need them so I can subclass the mojo in
>> other,
>> > >> multiple plugins, as annotations are, in theory, much easier than the
>> > >> Maven
>> > >> 2 ways of doing plugin extension).
>> > >>
>> > >> However, the maven-plugin-plugin 3.1 does not find any of the mojo
>> > >> definitions when building.
>> > >>
>> > >> I have tried various versions of gmaven and groovy-runtime with
>> > >> different
>> > >> failure conditions, but none of which work.
>> > >>
>> > >> Has anyone else tried this before?
>> > >>
>> > >> Thanks,
>> > >> Ben
>> > >>
>> > >> [1]
>> > >>
>> http://maven.apache.org/plugin-tools/maven-plugin-plugin/examples/using-a
>> > >> nno tations.html
>> > >
>> > > ---------------------------------------------------------------------
>> > > 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]
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
> --
> Ben Tatham
> Software Developer
> Nanometrics Inc.
> +1 613-592-6776 x254
> http://www.nanometrics.ca
>
>
>


-- 
Ben Tatham
Software Developer
Nanometrics Inc.
+1 613-592-6776 x254
http://www.nanometrics.ca

Reply via email to