You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by BURGHARD Éric <eb...@free.fr> on 2005/11/21 11:32:15 UTC

maven2 groovy plugin archetype

Hi,

Thanks to you (i'm just a follower :-), i switch my building scripts from
jelly+ant to a better maven 2 build cycle model. maven was on my todo list
since a long time, and i must admit that it has overcome my expectations.

To help the jelly migration i wrote an archetype for writing quickly groovy
plugins. It is based on codehaus' groovy plugin which i transform in a
groovy-plugin api.

For example the simpler groovy plugin is just a matter of

1. defining and empty class java (just used by maven to bind the plugin to a
goal with javadoc annotations)

/**
 * A plugin that execute a groovy script when requested
 * to achieve the 'test' goal.
 *
 * @goal test
 * @description Test Groovy Mojo
 */
public class MyMojo
    extends AbstractMojo
{
}

2. write a MyMojo.groovy script and put it on the right place
3. mvn install
4. use your groovy script on your with a mvn test:test.

With the archetype just do a

mvn archetype:create \
  -DgroupId=my.maven \
  -DpackageName=my.maven.test \
  -DartifactId=maven-test-plugin \
  -DarchetypeVersion=1.0 \
  -DarchetypeArtifactId=maven-archetype-groovymojo

Copy your script to the right place, mvn install and your are done.

Perhaps it could be usefull for you, so you can find the sources on a svn
repository (the server is not always online: no-ip rulez :-)

https://tagloo.no-ip.info/svn/public/maven-groovyplugin-api
https://tagloo.no-ip.info/svn/public/maven-archetype-groovymojo

Install procedure and usage are explained in an apt doc.

I'm dreaming of a cocoon-webapp archetype to start as easily a new webapp
based on cocoon with the blocks of my choice. thank you guys, for all this
great work on blocks + maven 2.

Regards.



Re: maven2 groovy plugin archetype

Posted by BURGHARD Éric <eb...@free.fr>.
Jorg Heymans wrote:

> 
> BURGHARD Éric wrote:
>> 
>> Perhaps it could be usefull for you, so you can find the sources on a svn
>> repository (the server is not always online: no-ip rulez :-)
>> 
> 
> I'll have a look at this, thanks!
> 

I've just realized that a .groovy can be compiled directly in a .class and
that a javadoc parser (qdox) can work on a .groovy directly if you take
care of the syntax before important javadocs annotations.

So i've commited a native groovy plugin archetype [1].

I've added a maven-plugin-tools-javalike [2] which can construct a
plugin.xml directly from .groovy and .java files and a maven-groovyc-plugin
[3] which compile all the .groovy presents in your the SourceRoots of the
project.

I didn't manage to find a way to add the maven-plugin-tools-javalike as a
dependency of the install phase, so you need to edit
$M2_REPO/maven-plugin-plugin/2.0/maven-plugin-plugin-2.0.pom and replace
maven-plugin-tools-java by maven-plugin-tools-javalike. Otherwise the
plugin.xml will not be correctly generated during install phase (as it is
however with a mvn plugin:descriptor. strange. any idea ?)

maven-groovyc-plugin is itself a compiled groovy plugin. It's a good example
since it use parameters and reuse the groovyc and mkdir anttasks in 2
lignes. To construct it from sources, you need to compile the .groovy by
hand (bootstrap) or retrieve a .jar from my local repository [4].

Thanks a lot for the coocon webapp archetype. I'll try that very soon.

Regards.

[1] https://tagloo.no-ip.info/svn/public/maven-archetype-groovymojo
[2] https://tagloo.no-ip.info/svn/public/maven-plugin-tools-javalike
[3] https://tagloo.no-ip.info/svn/public/maven-groovyc-plugin
[4] http://tagloo.no-ip.info/maven/repository


Re: maven2 groovy plugin archetype

Posted by Jorg Heymans <jh...@domek.be>.
BURGHARD Éric wrote:
> 
> Perhaps it could be usefull for you, so you can find the sources on a svn
> repository (the server is not always online: no-ip rulez :-)
> 

I'll have a look at this, thanks!

> https://tagloo.no-ip.info/svn/public/maven-groovyplugin-api
> https://tagloo.no-ip.info/svn/public/maven-archetype-groovymojo
> 
> Install procedure and usage are explained in an apt doc.
> 
> I'm dreaming of a cocoon-webapp archetype to start as easily a new webapp
> based on cocoon with the blocks of my choice. thank you guys, for all this
> great work on blocks + maven 2.
> 

Have a look at [1], a basic cocoon-core archetype. The block selection
bit is still missing however.


Regards
Jorg

[1]
http://svn.apache.org/repos/asf/cocoon/whiteboard/maven2/cocoon-archetype-core/