review the marmalade document

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163861 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-08 06:10:09 +00:00
parent 8e02703d92
commit 8f7be22081
1 changed files with 57 additions and 51 deletions

View File

@ -27,70 +27,75 @@
<body> <body>
<section name="Developing Plugins with Marmalade"> <section name="Developing Plugins with Marmalade">
<p> <p>
NOTE: Compare this tutorial to <a href="http://maven.apache.org/using/developing-plugins.html">Developing NOTE: Compare this tutorial to
<a href="http://maven.apache.org/using/developing-plugins.html">Developing
Plugins</a> from the Maven 1.0 website. Marmalade is meant to be quite similar to Jelly in its Plugins</a> from the Maven 1.0 website. Marmalade is meant to be quite similar to Jelly in its
syntax, so this process should be very familiar to Maven 1.0 plugin developers. syntax, so this process should be very familiar to Maven 1.0 plugin developers.
</p> </p>
<p>
If you need some background on how plugins fit into the execution model of Maven 2.0, try reading the
<a href="architecture.html">Maven 2.0 Architecture</a>.
</p>
<subsection name="Background"> <subsection name="Graduating from Jelly: Plugins in Marmalade">
<p> <p>
Each of the various steps in a given Maven 2.0 build corresponds to one plugin executing. Beginning in Maven 2.0, plugins can be implemented in various languages. While our initial
Plugins have access to the common infrastructure of the core API, along with the basic information technology preview will only offer support for these Marmalade and Java, we will eventually add
about the current project being built. Using these facilities, each plugin executes one simple,
repeatable step in the build. It is from these simple building blocks that even the most
complex, powerful build processes are constructed.
</p>
<p>
Beginning in Maven 2.0, plugins can be implemented in various languages, ranging from pure Java
to Marmalade - a next-generation Jelly-like XML language - and beyond. While our initial
technology preview will only offer support for these two languages, we will eventually add
support for additional languages, possibly including Beanshell/Janino, Javascript, and more. support for additional languages, possibly including Beanshell/Janino, Javascript, and more.
</p> </p>
<p> <p>
For more information on how plugins fit into the execution model of Maven 2.0, try reading Marmalade is a next-generation Jelly-like XML language, and was chosen for early inclusion in Maven 2.0 to
<a href="architecture.html">Maven 2.0 Architecture</a>. ease migration from Maven 1.0, and to provide a way to incorporate Ant scripts into a build project.
</p> </p>
</subsection>
<subsection name="Graduating from Jelly: Plugins in Marmalade">
<p> <p>
For those Maven 1.x users who have implemented their own plugins using Jelly, Marmalade can be Marmalade currently has basic syntax compatibility with Jelly, and some measure of Jelly taglib
an extremely powerful language for porting to Maven 2.0. Marmalade currently has basic syntax compatibility... and this support will continue to improve as Marmalade matures. As such, Marmalade can allow
compatibility with Jelly, and some measure of Jelly taglib compatibility...and this support the plugin developer the freedom to concentrate on porting between project models and core facilities, rather
will continue to improve as Maven 2.0 matures. As such, Marmalade can allow the plugin developer than worrying about changing implementation languages.
the freedom to concentrate on porting between project models and core facilities, rather than </p>
worrying about changing implementation languages.
<p>
Marmalade is still only a fledgling project, and while it's core engine is sophisticated and mature, it's
support for Jelly and other taglibs is still growing at a brisk pace. In order to provide as much Jelly
functionality out-of-the-box to Maven 2.0 users, Marmalade has an available compatibility layer for Jelly,
which will allow the user to embed Jelly within Marmalade for the taglibs that have not yet been ported to
native Marmalade.
</p> </p>
<p> <p>
Like Maven 2.0 itself, Marmalade is somewhat of a fledgling project. That is, while it's core For those Maven 1.x users who have implemented their own plugins using Jelly, Marmalade can be
engine is fairly sophisticated and mature, it's support for Jelly and other taglibs is still an extremely powerful language for porting to Maven 2.0.
growing at a brisk pace. In order to provide as much Jelly functionality out-of-the-box to Maven 2.0
users, Marmalade has an available compatibility layer for Jelly, which will allow the user
to embed Jelly within Marmalade for the taglibs that have not yet been ported to native Marmalade.
</p> </p>
<p>For more information on Marmalade, see the <a href="http://marmalade.codehaus.org">Marmalade website.</a> <p>For more information on Marmalade, see the
<a href="http://marmalade.codehaus.org">Marmalade website.</a>
</p>
</subsection> </subsection>
<subsection name="Marmalade Plugin Basics"> <subsection name="Marmalade Plugin Basics">
<p> <p>
A plugin implemented in Marmalade can contain the following: A plugin implemented in Marmalade can contain the following:
<ul> <ul>
<li>[Required] One or more Marmalade scripts, each in a file with the extension <code>.mmld</code></li> <li>[Required] One or more Marmalade scripts, each in a file with the extension
<code>.mmld</code>
</li>
<li> <li>
[Optional] One or more Marmalade tag libraries, each consisting of: [Optional] One or more Marmalade tag libraries, each consisting of:
<ul> <ul>
<li>One or more implementations of MarmaladeTag <li>One or more implementations of MarmaladeTag</li>
<li>An implementation of <code>MarmaladeTagLibrary</code>, the constructor of which registers <li>An implementation of
<code>MarmaladeTagLibrary</code>, the constructor of which registers
each MarmaladeTag implementation to a tag name (for use in scripts) each MarmaladeTag implementation to a tag name (for use in scripts)
</li>
</ul> </ul>
</li> </li>
<li> <li>
[Required] A <code>pom.xml</code> for building the plugin, which contains a script source directory [Required] A
resembling <code><![CDATA[<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>]]> <code>pom.xml</code> for building the plugin, which contains a script source directory
resembling
<code><![CDATA[<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>]]></code>
</li> </li>
<li>[Optional] Plugin resources to be used from within the plugin's scripts (available on the classpath)</li> <li>[Optional] Plugin resources to be used from within the plugin's scripts (available on the classpath)</li>
<li>[Optional] Other Java sources, which can be accessed from the plugin's scripts</li> <li>[Optional] Other Java sources, which can be accessed from the plugin's scripts</li>
@ -98,7 +103,8 @@
</p> </p>
<p> <p>
Each <code>.mmld</code> script file must provide the same basic structural elements, which define it Each
<code>.mmld</code> script file must provide the same basic structural elements, which define it
as a Maven 2.0 plugin, and provide essential metadata. This metadata is used to: as a Maven 2.0 plugin, and provide essential metadata. This metadata is used to:
<ul> <ul>
<li>Inject project and environmental information into the plugin (parameters)</li> <li>Inject project and environmental information into the plugin (parameters)</li>
@ -148,7 +154,8 @@
source directory in which to find script sources. source directory in which to find script sources.
</p> </p>
<p> <p>
In a new directory, create a <code>pom.xml</code> file like so: In a new directory, create a
<code>pom.xml</code> file like so:
</p> </p>
<source><![CDATA[<project> <source><![CDATA[<project>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -195,8 +202,10 @@
goal within the build system, so you may need several scripts. goal within the build system, so you may need several scripts.
</p> </p>
<p> <p>
Since this is in fact a Hello World plugin, your script will simply output <code>Hello, World</code> Since this is in fact a Hello World plugin, your script will simply output
to the screen. Create a script in <code>src/main/scripts/hello.mmld</code> with the following contents: <code>Hello, World</code>
to the screen. Create a script in
<code>src/main/scripts/hello.mmld</code> with the following contents:
</p> </p>
<source><![CDATA[ <source><![CDATA[
<mojo xmlns="marmalade:mojo"> <mojo xmlns="marmalade:mojo">
@ -260,12 +269,15 @@
</mojo> </mojo>
]]></source> ]]></source>
<p> <p>
Note the additional element in this parameter declaration: <code>default</code> specified a default Note the additional element in this parameter declaration:
<code>default</code> specified a default
salutation in case the user doesn't need or want to customize the plugin. salutation in case the user doesn't need or want to customize the plugin.
</p> </p>
<p> <p>
Now, to make use of the new parameter. Inside the <code><![CDATA[<c:out/>]]></code> action, simply Now, to make use of the new parameter. Inside the
write out the customizable salutation instead of the stock phrase <code>Hello</code>: <code><![CDATA[<c:out/>]]></code> action, simply
write out the customizable salutation instead of the stock phrase
<code>Hello</code>:
</p> </p>
<source><![CDATA[ <source><![CDATA[
<c:out xmlns:c="marmalade:core">${salutation}, World.</c:out> <c:out xmlns:c="marmalade:core">${salutation}, World.</c:out>
@ -287,7 +299,8 @@ m2 hello:hello</source>
<p> <p>
Users of this plugin can also customize the salutation for their project and avoid having to specify it on Users of this plugin can also customize the salutation for their project and avoid having to specify it on
the command line each time. All they have to do is create a plugin entry in their <code>pom.xml</code> the command line each time. All they have to do is create a plugin entry in their
<code>pom.xml</code>
similar to: similar to:
</p> </p>
<source><![CDATA[ <source><![CDATA[
@ -314,13 +327,6 @@ m2 hello:hello</source>
]]></source> ]]></source>
</subsection> </subsection>
</section> </section>
</body>
<section name="Getting More Information">
<p>
More information about using Marmalade to write Maven 2.0 plugins will be forthcoming, as we
flesh out both Marmalade and the Maven 2.0 platform.
</p>
</section>
</body>
</document> </document>