You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jason Dillon <ja...@planet57.com> on 2007/04/05 04:40:10 UTC

Let your Mojo's be Groovy baby!

Hi folks, I've just finished up the first draft of support to use  
Groovy for Maven plugin development, including Javadoc-based Mojo  
descriptor extraction.

I have yet to update the site docs to cover the Mojo impl bits, but I  
will get to that soon.  Until then you can peek at this integration  
test to see how it works right now:

     http://svn.codehaus.org/mojo/trunk/mojo/groovy-maven-plugin/src/ 
it/mojo-1/

I just published 1.0-alpha-3-SNAPSHOT which includes the Groovy Mojo  
descriptor extractor bits.  I'm going to test this more, update the  
docs and finish up a few other tasks and then start a vote for the  
1.0-alpha-3 release.  If folks can look at this, try using it to  
create Maven plugins and provide feedback on success and/or problems  
I would appreciate it.

--jason

PS. No fembots were harmed in the writing of this email.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Let your Mojo's be Groovy baby!

Posted by Jason van Zyl <ja...@maven.org>.
Awesome, nice work!

Jason.

On 4 Apr 07, at 10:40 PM 4 Apr 07, Jason Dillon wrote:

> Hi folks, I've just finished up the first draft of support to use  
> Groovy for Maven plugin development, including Javadoc-based Mojo  
> descriptor extraction.
>
> I have yet to update the site docs to cover the Mojo impl bits, but  
> I will get to that soon.  Until then you can peek at this  
> integration test to see how it works right now:
>
>     http://svn.codehaus.org/mojo/trunk/mojo/groovy-maven-plugin/src/ 
> it/mojo-1/
>
> I just published 1.0-alpha-3-SNAPSHOT which includes the Groovy  
> Mojo descriptor extractor bits.  I'm going to test this more,  
> update the docs and finish up a few other tasks and then start a  
> vote for the 1.0-alpha-3 release.  If folks can look at this, try  
> using it to create Maven plugins and provide feedback on success  
> and/or problems I would appreciate it.
>
> --jason
>
> PS. No fembots were harmed in the writing of this email.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Let your Mojo's be Groovy baby!

Posted by Stephane Nicoll <st...@gmail.com>.
very cool!

Stéphane

On 4/5/07, Jason Dillon <ja...@planet57.com> wrote:
> Hi folks, I've just finished up the first draft of support to use
> Groovy for Maven plugin development, including Javadoc-based Mojo
> descriptor extraction.
>
> I have yet to update the site docs to cover the Mojo impl bits, but I
> will get to that soon.  Until then you can peek at this integration
> test to see how it works right now:
>
>      http://svn.codehaus.org/mojo/trunk/mojo/groovy-maven-plugin/src/
> it/mojo-1/
>
> I just published 1.0-alpha-3-SNAPSHOT which includes the Groovy Mojo
> descriptor extractor bits.  I'm going to test this more, update the
> docs and finish up a few other tasks and then start a vote for the
> 1.0-alpha-3 release.  If folks can look at this, try using it to
> create Maven plugins and provide feedback on success and/or problems
> I would appreciate it.
>
> --jason
>
> PS. No fembots were harmed in the writing of this email.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: [groovy-user] Let your Mojo's be Groovy baby!

Posted by Jason Dillon <ja...@planet57.com>.
Sorry, I never got these emails in my inbox... dunno why.  So I haven't just
been ignoring you ;-)

Anyways, looks like a bug in the Groovy descriptor extractor.  I've filled
an issue here:

    http://jira.codehaus.org/browse/MGROOVY-40

Will try to get that fixed asap.

--jason



Andrew Perepelytsya wrote:
> 
> In a nice tradition of answering one's own questions... ;)
> 
> Jason't other thread about site goal and similar symptoms gave me another
> idea, which finally shaped into a solution. This could be included in the
> Groovy m2 plugins development guide, smth under 'Building Groovy m2
> plugins in a reactor/multi-module project'.
> 
> Full poms are available at the above mentioned SVN locations, I'll post
> snippets here only.
> 
> Parent:
> =======
> <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-plugin-plugin</artifactId>
>                 <configuration>
>                     <!--
>                         *MUST* override the extractors to disable
> everything
>                         except java, as groovy can handle both java and
> groovy files.
>                         Duplicate processing chokes maven.
>                         Java is the default for plugin implementation
> language,
>                         overridable in individual projects.
>                     -->
>                     <extractors>
>                         <extractor>java</extractor>
>                         <!-- add custom default extractors here if needed
> -->
>                         <!-- extractor>bsh</extractor -->
>                     </extractors>
>                 </configuration>
>                 <dependencies>
>                     <dependency>
>                         <groupId>org.codehaus.mojo</groupId>
>                         <artifactId>groovy-mojo-tools</artifactId>
>                         <version>1.0-alpha-3-SNAPSHOT</version>
>                     </dependency>
>                 </dependencies>
>             </plugin>
>         </plugins>
>     </build>
> 
> 
> The key here is the dependency of the plugin AND extractor configuration.
> It's critical to not enable groovy extractor for plugins implemented in
> Java, as maven will try to process them with both java and groovy and
> fail.
> 
> Child m2 plugin project implemented in groovy (the same build/plugins
> section):
> ===============================
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-plugin-plugin</artifactId>
>                 <configuration>
>                     <extractors>
>                         <!--
>                             *MUST* override the extractors to disable
> everything
>                             except groovy, as groovy can handle both java
> and groovy files.
>                             Duplicate processing chokes maven.
>                             The rest of the config is inherited.
>                         -->
>                         <extractor>groovy</extractor>
>                     </extractors>
>                 </configuration>
>             </plugin>
> 
> Hope it saves much pain to others. And the best part is those settings are
> available in released m2 plugins, which lessens the snapshot pain.
> 
> Cheers!
> Andrew
> 

-- 
View this message in context: http://www.nabble.com/-groovy-user--Let-your-Mojo%27s-be-Groovy-baby%21-tf3529339s177.html#a10689632
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [groovy-user] Let your Mojo's be Groovy baby!

Posted by Andrew Perepelytsya <ap...@gmail.com>.
In a nice tradition of answering one's own questions... ;)

Jason't other thread about site goal and similar symptoms gave me another
idea, which finally shaped into a solution. This could be included in the
Groovy m2 plugins development guide, smth under 'Building Groovy m2 plugins
in a reactor/multi-module project'.

Full poms are available at the above mentioned SVN locations, I'll post
snippets here only.

Parent:
=======
<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <configuration>
                    <!--
                        *MUST* override the extractors to disable everything
                        except java, as groovy can handle both java and
groovy files.
                        Duplicate processing chokes maven.
                        Java is the default for plugin implementation
language,
                        overridable in individual projects.
                    -->
                    <extractors>
                        <extractor>java</extractor>
                        <!-- add custom default extractors here if needed
-->
                        <!-- extractor>bsh</extractor -->
                    </extractors>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>groovy-mojo-tools</artifactId>
                        <version>1.0-alpha-3-SNAPSHOT</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>


The key here is the dependency of the plugin AND extractor configuration.
It's critical to not disable groovy extractor for plugins implemented in
Java, as maven will try to process them with both java and groovy and fail.

Child m2 plugin project implemented in groovy (the same build/plugins
section):
===============================
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <configuration>
                    <extractors>
                        <!--
                            *MUST* override the extractors to disable
everything
                            except groovy, as groovy can handle both java
and groovy files.
                            Duplicate processing chokes maven.
                            The rest of the config is inherited.
                        -->
                        <extractor>groovy</extractor>
                    </extractors>
                </configuration>
            </plugin>

Hope it saves much pain to others. And the best part is those settings are
available in released m2 plugins, which lessens the snapshot pain.

Cheers!
Andrew
-- 
View this message in context: http://www.nabble.com/-groovy-user--Let-your-Mojo%27s-be-Groovy-baby%21-tf3529339s177.html#a10657221
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [groovy-user] Let your Mojo's be Groovy baby!

Posted by Andrew Perepelytsya <ap...@gmail.com>.
I'm closing in on the problem, and found the way to make it work/break.
Though I'm completely lost on which project to file the bug against even...

The parent mule-tools project had several more maven plugins. Once I removed
all of them and left MAV only, it detected the extractor. I'm attaching 2
debug runs, one for the direct invocation from the folder and the invalid
one for the parent with other plugins.

http://www.nabble.com/file/8476/debug_logs_2_runs.zip debug_logs_2_runs.zip 

The org.apache.maven.tools.plugin.scanner.DefaultMojoScanner gets injected
with 2 extractor names only, couldn't trace it further.

Any advice on the direction (which plugin has the bug) is much appreciated.
-- 
View this message in context: http://www.nabble.com/-groovy-user--Let-your-Mojo%27s-be-Groovy-baby%21-tf3529339s177.html#a10654732
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [groovy-user] Let your Mojo's be Groovy baby!

Posted by Andrew Perepelytsya <ap...@gmail.com>.
I tried moving the groovy-mojo dep to the parent - no luck.

Next, I tried making the plugin a standalone project (no parent). Alas, if
run from the mule-tools, still only 2 extractors :(
-- 
View this message in context: http://www.nabble.com/-groovy-user--Let-your-Mojo%27s-be-Groovy-baby%21-tf3529339s177.html#a10653956
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [groovy-user] Let your Mojo's be Groovy baby!

Posted by Andrew Perepelytsya <ap...@gmail.com>.
Hi Jason,

I found an odd behavior, namely, the groovy extractor is lost if building
from the parent. Details are:

The parent project containing the maven plugin (implemented in Groovy) is
Mule Tools:
http://svn.codehaus.org/mule/trunk/mule/tools/

The plugin is the mule-assembly-verifier plugin:
http://svn.codehaus.org/mule/trunk/mule/tools/mule-assembly-verifier/

A number of RAR/assembly modules use the MAV plugin, e.g.:
http://svn.codehaus.org/mule/trunk/mule/distributions/jca/

Details of the valid behavior:
===================
Go to the mule-assembly-verifier module directory and execute mvn. This kind
of direct build from the folder lists 3 mojo extractors (java/bsh/groovy)
and compiles a groovy class. It generates a proper plugin.xml and everything
is good. Any project using the plugin build directly from the folder works
fine (you see a nice small splash right after the package phase), if
everything is ok, no more noise.

Details of the erroneous behavior:
=======================
A CI server executes the build from the top. For simplicity, just launch mvn
from the Mule Tools parent project (one level up from the MAV plugin). Error
- ONLY 2 extractors found (java & bsh), NO groovy extractor detected :( The
groovy class is then compiled and packaged properly. HOWEVER, the plugin.xml
contains an EMPTY mojos node. Projects using this invalid plugin package
never complain, but the plugin never runs. Surely not what we want.

The problem is we want it to be part of a more complex build, and there's no
way it can be isolated in a top-level project.

I'll be looking into it, but let me know if you find something faster.
-- 
View this message in context: http://www.nabble.com/-groovy-user--Let-your-Mojo%27s-be-Groovy-baby%21-tf3529339s177.html#a10653700
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org