You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by BURGHARD Éric <eb...@free.fr> on 2005/11/24 20:11:04 UTC

using jelly scripts in maven 2.0: the archetype approach

Hi,

Even if i think jelly is an awfull language, i spent some times to package
an archetype [1] that can help you reusing your maven 1.0 scripts. But i
really encourage using groovy instead, it's less buggued, faster, easier
and much more expressive than jelly (many thanks codehaus, you're
genius ;-).

The idea of this archetype is to package your jelly scripts with some simple
java classes that act as bridges between maven's build cycles and your
scripts.

You have one little .java and one .jelly for each goal you want to package
in the same plugin. The formers are in src/main/java, the laters in
src/main/scripts.

The archetype helps to fire a typical 'one goal' plugin project.

Here is an example to write a simple jelly plugin that bind to the 'test'
goal.

First the .java.

+---
package my.maven;

/**
 * My jelly mojo
 *
 * @goal test
 * @description my jelly mojo
 * @author me
 * @version $Id$
 */
public class MyMojo
    extends AbstractMojo
{
}
+---

Yes it's empty. Javadoc annotations help maven to bind your script to a goal
and a phase.

Second the . jelly

+---
<j:jelly xmlns:j="jelly:core">
plugin groupId    : ${project.groupId}
plugin artifactId : ${project.artifactId}
</j:jelly>
+---

mvn install, And your done.

As you can see you have access to a project variable (MavenProject) inside
your script. The plugin rely on a little maven-jellyplugin-api [2]

Refer to the archetype documentation for usage (exemple of parametrizable
jelly plugin).

Regards.

[1] https://tagloo.no-ip.info/svn/public/maven-archetype-jellymojo
[2] https://tagloo.no-ip.info/svn/public/maven-jellyplugin-api


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