mirror of https://github.com/apache/maven.git
proofed the development document for marmalade-mojos, and linked it into navigation.xml and index.xml.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163860 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9aab0802c7
commit
8e02703d92
|
@ -61,19 +61,18 @@
|
||||||
compatibility with Jelly, and some measure of Jelly taglib compatibility...and this support
|
compatibility with Jelly, and some measure of Jelly taglib compatibility...and this support
|
||||||
will continue to improve as Maven 2.0 matures. As such, Marmalade can allow the plugin developer
|
will continue to improve as Maven 2.0 matures. As such, Marmalade can allow the plugin developer
|
||||||
the freedom to concentrate on porting between project models and core facilities, rather than
|
the freedom to concentrate on porting between project models and core facilities, rather than
|
||||||
worrying about translating Jelly into Java as well.
|
worrying about changing implementation languages.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Like Maven 2.0 itself, Marmalade is somewhat of a fledgling project. That is, while it's core
|
Like Maven 2.0 itself, Marmalade is somewhat of a fledgling project. That is, while it's core
|
||||||
engine is fairly sophisticated and mature, it's support for Jelly and other taglibs is still
|
engine is fairly sophisticated and mature, it's support for Jelly and other taglibs is still
|
||||||
growing at a brisk pace. In order to try to provide as much Jelly functionality 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
|
users, Marmalade has an available compatibility layer for Jelly, which will allow the user
|
||||||
to basically embed Jelly within Marmalade for the taglibs that have not yet been ported to
|
to embed Jelly within Marmalade for the taglibs that have not yet been ported to native Marmalade.
|
||||||
native Marmalade.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>For more information on Marmalade, <a href="http://marmalade.codehaus.org">Watch this space.</a>
|
<p>For more information on Marmalade, see the <a href="http://marmalade.codehaus.org">Marmalade website.</a>
|
||||||
</subsection>
|
</subsection>
|
||||||
|
|
||||||
<subsection name="Marmalade Plugin Basics">
|
<subsection name="Marmalade Plugin Basics">
|
||||||
|
@ -93,8 +92,8 @@
|
||||||
[Required] A <code>pom.xml</code> for building the plugin, which contains a script source directory
|
[Required] A <code>pom.xml</code> for building the plugin, which contains a script source directory
|
||||||
resembling <code><![CDATA[<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>]]>
|
resembling <code><![CDATA[<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>]]>
|
||||||
</li>
|
</li>
|
||||||
<li>[Optional] Plugin resources for adding to the classpath when the plugin is run</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 are accessed from that plugin's scripts</li>
|
<li>[Optional] Other Java sources, which can be accessed from the plugin's scripts</li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -102,9 +101,9 @@
|
||||||
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</li>
|
<li>Inject project and environmental information into the plugin (parameters)</li>
|
||||||
<li>Wire the plugin up to common infrastructural components</li>
|
<li>Make common infrastructural components available for use in the plugin</li>
|
||||||
<li>Bind the plugin to a particular point in the build process lifecycle</li>
|
<li>Bind the plugin to a particular point in the build process lifecycle, if appropriate</li>
|
||||||
<li>Provide a goal name to reference the plugin from inside the Maven 2.0 system</li>
|
<li>Provide a goal name to reference the plugin from inside the Maven 2.0 system</li>
|
||||||
<li>Provide descriptive information about what the plugin script does</li>
|
<li>Provide descriptive information about what the plugin script does</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -114,8 +113,8 @@
|
||||||
The general structure of a Marmalade plugin script is:
|
The general structure of a Marmalade plugin script is:
|
||||||
</p>
|
</p>
|
||||||
<source><![CDATA[
|
<source><![CDATA[
|
||||||
<!-- The term mojo is a play on POJO, meant to mean Maven POJO.
|
<!-- The term mojo is a play on POJO, meant to mean "Maven POJO".
|
||||||
| Mojos correspond to goals in Maven 2.0.
|
| Mojos correspond to goals in Maven 2.0.
|
||||||
-->
|
-->
|
||||||
<mojo xmlns="marmalade:mojo">
|
<mojo xmlns="marmalade:mojo">
|
||||||
<metadata>
|
<metadata>
|
||||||
|
@ -152,12 +151,21 @@
|
||||||
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>
|
||||||
<groupId>org.apache.maven.plugins</groupId> <!-- for now, this is the only groupId acceptable for maven plugins -->
|
|
||||||
<artifactId>maven-hello-plugin</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version> <!-- using this version, we make the plugin fit the anonymous usage requirements. -->
|
|
||||||
|
|
||||||
<packaging>maven-plugin</packaging> <!-- Designate this project as building a maven plugin -->
|
<!-- for now, this is the only groupId acceptable for maven plugins -->
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|
||||||
|
<!-- uses a standard naming convention -->
|
||||||
|
<artifactId>maven-hello-plugin</artifactId>
|
||||||
|
|
||||||
|
<!-- uses this version, to make it usable without configuring this plugin from
|
||||||
|
| the project POM.
|
||||||
|
-->
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<!-- Designate this project as building a maven plugin -->
|
||||||
|
<packaging>maven-plugin</packaging>
|
||||||
|
|
||||||
<name>Maven Hello World Plugin</name>
|
<name>Maven Hello World Plugin</name>
|
||||||
|
|
||||||
|
@ -167,8 +175,18 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<!-- This is only required if you have Java code -->
|
|
||||||
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
|
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
|
||||||
|
|
||||||
|
<!-- Since the script source directory is only a marker for a resource, you
|
||||||
|
| still have to declare that directory for resource inclusion when you
|
||||||
|
| build.
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/scripts</directory>
|
||||||
|
<includes><include>**/*.mmld</include></includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
</build>
|
</build>
|
||||||
</project>]]></source>
|
</project>]]></source>
|
||||||
|
|
||||||
|
@ -177,7 +195,7 @@
|
||||||
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, our script will simply output <code>Hello, World</code>
|
Since this is in fact a Hello World plugin, your script will simply output <code>Hello, World</code>
|
||||||
to the screen. Create a script in <code>src/main/scripts/hello.mmld</code> with the following contents:
|
to the screen. Create a script in <code>src/main/scripts/hello.mmld</code> with the following contents:
|
||||||
</p>
|
</p>
|
||||||
<source><![CDATA[
|
<source><![CDATA[
|
||||||
|
@ -246,29 +264,29 @@
|
||||||
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[<io:file/>]]></code> tag, we'll
|
Now, to make use of the new parameter. Inside the <code><![CDATA[<c:out/>]]></code> action, simply
|
||||||
write out the customizable salutation instead of the stock phrase <code>Hello</code>:
|
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>
|
||||||
]]></source>
|
]]></source>
|
||||||
<p>
|
<p>
|
||||||
Now, install the new plugin and run it:
|
Install the new plugin and run it, to verify your changes:
|
||||||
</p>
|
</p>
|
||||||
<source>m2 install
|
<source>m2 install
|
||||||
m2 hello:hello</source>
|
m2 hello:hello</source>
|
||||||
<p>
|
<p>
|
||||||
Notice that the file still has the same old salutation (which is the default value of the our parameter).
|
Notice that the output still has the same old salutation (which is the default value of the parameter).
|
||||||
Now, to customize it:
|
Now, to customize it:
|
||||||
</p>
|
</p>
|
||||||
<source>m2 -Dsalutation=Hiya hello:hello</source>
|
<source>m2 -Dsalutation=Hiya hello:hello</source>
|
||||||
<p>
|
<p>
|
||||||
The contents of <code>hello.txt</code> should now read:
|
The output should now read:
|
||||||
</p>
|
</p>
|
||||||
<source>Hiya, World</source>
|
<source>Hiya, World</source>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Now, users of this plugin can customize the salutation for their build without 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>
|
||||||
|
|
|
@ -121,6 +121,11 @@
|
||||||
<a href="configuration.html">Configuring Maven</a>
|
<a href="configuration.html">Configuring Maven</a>
|
||||||
</i>
|
</i>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<i>
|
||||||
|
<a href="developing-plugins-with-marmalade.html">Developing Plugins with Marmalade</a>
|
||||||
|
</i>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<menu name="User's Guide">
|
<menu name="User's Guide">
|
||||||
<item name="Getting Started" href="getting-started.html"/>
|
<item name="Getting Started" href="getting-started.html"/>
|
||||||
<item name="Configuration" href="configuration.html"/>
|
<item name="Configuration" href="configuration.html"/>
|
||||||
|
<item name="Developing Plugins with Marmalade" href="developing-plugins-with-marmalade.html"/>
|
||||||
</menu>
|
</menu>
|
||||||
</body>
|
</body>
|
||||||
</project>
|
</project>
|
Loading…
Reference in New Issue