You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/07/30 03:04:16 UTC
svn commit: r226452 - in /portals/pluto/branches/pluto-1.1: ./
maven-pluto-plugin/ maven-pluto-plugin/src/ maven-pluto-plugin/src/main/
maven-pluto-plugin/src/main/java/ maven-pluto-plugin/src/main/java/org/
maven-pluto-plugin/src/main/java/org/apache/...
Author: ddewolf
Date: Fri Jul 29 18:04:01 2005
New Revision: 226452
URL: http://svn.apache.org/viewcvs?rev=226452&view=rev
Log:
Adding Pluto 1.1. Maven Installer.
-- Includes Pluto Maven Plugin
-- Installer Sub Project
-- Updating Release Notes.
Added:
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/scripts/
portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/scripts/hello.mmld
portals/pluto/branches/pluto-1.1/pluto-install/
portals/pluto/branches/pluto-1.1/pluto-install/pom.xml
portals/pluto/branches/pluto-1.1/pluto-site/
portals/pluto/branches/pluto-1.1/pluto-site/src/
portals/pluto/branches/pluto-1.1/pluto-site/src/site/
portals/pluto/branches/pluto-1.1/pluto-site/src/site/site.xml
portals/pluto/branches/pluto-1.1/pluto-site/src/site/xdoc/
portals/pluto/branches/pluto-1.1/pluto-site/src/site/xdoc/developing-plugins-with-marmalade.xml
Modified:
portals/pluto/branches/pluto-1.1/README
portals/pluto/branches/pluto-1.1/pom.xml
Modified: portals/pluto/branches/pluto-1.1/README
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/README?rev=226452&r1=226451&r2=226452&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/README (original)
+++ portals/pluto/branches/pluto-1.1/README Fri Jul 29 18:04:01 2005
@@ -1,33 +1,50 @@
-To manually install Pluto 1.1.x
+1) Introduction
-1) Install Maven 2 (alpha-3 or above)
+ - You are looking at the source distribution of Pluto 1.1.x.
+ - Pluto 1.1.x is NOT binarily compatible with Pluto 1.0.x
+ - Pluto 1.1.x is a rewrite of 1.0.x aimed at cleaning up
+ the architecture and making pluto more user / developer friendly
+ - Pluto 1.1.x is still under development.
-2) Install Application Server
- - Tomcat 5.5.x or above recomened
-2) Execute 'm2 install'
+2) Installation
+=========================================
-3) Copy The following to a shared classloader location:
+2a) Maven Installation:
+-----------------------------------------
- - castor-0.9.6
- - portlet-api-1.0.jar
- - pluto-container-1.1-SNAPSHOT.jar
- - pluto-descriptor-api-1.1-SNAPSHOT.jar
- - pluto-descriptor-impl-1.1-SNAPSHOT.jar
+ Step 1: 'm2 install'
+ Step 2: 'cd ../pluto-installer'
+ Step 3: 'm2 pluto:install'
- * In Tomcat, copy to: <TOMCAT>/shared/lib
+2b) Manual Installation:
+-----------------------------------------
-4) Copy the following to an endored location:
+ Step 1: 'm2 install'
+ Step 2: Copy the following to <TOMCAT_HOME>/shared/lib
- - xercesImpl-2.6.2
- - xmlParserAPIs-2.6.2
+ - castor-0.9.6
+ - portlet-api-1.0.jar
+ - pluto-container-1.1-SNAPSHOT.jar
+ - pluto-descriptor-api-1.1-SNAPSHOT.jar
+ - pluto-descriptor-impl-1.1-SNAPSHOT.jar
-4) Copy pluto.xml to <CATALINA>/conf/Catalina/localhost
+ Step 3: Copy the following to <TOMCAT_HOME>/common/endorsed
-5) Copy testsuite.xml to <CATALINA>/conf/Catalina/localhost
+ - xercesImpl-2.6.2
+ - xmlParserAPIs-2.6.2
-6) Deploy the following wars:
+ Step 4: Copy the following to <TOMCAT_HOME>/conf/Catalina/localhost
- - pluto-portal.war
- - pluto-testsuite.war
+ - <PLUTO_HOME>/pluto-portal/src/main/resources/pluto.xml
+ - <PLUTO_HOME>/pluto-testsuite/src/main/resources/testsuite.xml
+
+ Step 5:
+
+ - pluto-portal.war
+ - pluto-testsuite.war
+
+2c) Windows EXE Installation
+
+ - The NSIS Installer is not yet complete
Added: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml?rev=226452&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml (added)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/pom.xml Fri Jul 29 18:04:01 2005
@@ -0,0 +1,67 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <name>Maven Pluto Installer Plugin</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>2.0-alpha-3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0-alpha-3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0-alpha-3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0-alpha-3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0-alpha-3</version>
+ </dependency>
+ <dependency>
+ <groupId>marmalade</groupId>
+ <artifactId>marmalade-core</artifactId>
+ <version>1.0-alpha-4</version>
+ </dependency>
+ <dependency>
+ <groupId>marmalade</groupId>
+ <artifactId>marmalade-el-commons</artifactId>
+ <version>1.0-alpha-3</version>
+ </dependency>
+ <dependency>
+ <groupId>marmalade</groupId>
+ <artifactId>marmalade-tags-io</artifactId>
+ <version>1.0-alpha-3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-script-marmalade</artifactId>
+ <version>2.0-alpha-3</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/scripts</directory>
+ <includes><include>**/*.mmld</include></includes>
+ </resource>
+ </resources>
+ </build>
+</project>
+
Added: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java?rev=226452&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java (added)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallMojo.java Fri Jul 29 18:04:01 2005
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.pluto.maven;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @goal install
+ * @requiresDependencyResolution runtime
+ */
+public class InstallMojo extends AbstractMojo {
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression="${pluto.installation.dir}"
+ * @required
+ */
+ private File installationDirectory;
+
+
+ /**
+ * @parameter expression="${pluto.installation.tomcat.host}"
+ */
+ private String host = "localhost";
+
+
+ /**
+ * @parameter expression="${pluto.installation.tomcat.engine}"
+ */
+ private String engine = "Catalina";
+
+ /**
+ * @parameter expression="${project.basedir}/.."
+ */
+ private File basedir;
+
+
+ public void execute() throws MojoExecutionException {
+ if(!installationDirectory.exists() || !installationDirectory.isDirectory()) {
+ throw new MojoExecutionException("Installation Directory "+installationDirectory.getAbsolutePath()+" does not exist.");
+ }
+
+ try {
+ doExecute();
+ }
+ catch(Exception e) {
+ throw new MojoExecutionException("Error Installing Pluto", e);
+ }
+ }
+
+ private void doExecute() throws Exception {
+ getLog().info("Installing Pluto to: "+installationDirectory.getAbsolutePath());
+ configure();
+ sharedLibraries();
+ endorsedLibraries();
+ webapps();
+ }
+
+ private void configure() throws IOException {
+ File conf = new File(installationDirectory, "conf/"+engine+"/"+host);
+ conf.mkdirs();
+
+ File from = new File(basedir, "pluto-portal/src/main/resources/pluto.xml");
+ getLog().info("Copying "+from.getAbsolutePath()+" to "+conf.getAbsolutePath());
+ FileUtils.copyFileToDirectory(from, conf);
+
+ from = new File(basedir, "pluto-testsuite/src/main/resources/testsuite.xml");
+ getLog().info("Copying "+from.getAbsolutePath()+" to "+conf.getAbsolutePath());
+ FileUtils.copyFileToDirectory(from, conf);
+ }
+
+ private List getSharedDependencies() {
+ List list = new ArrayList();
+ list.add("pluto-container");
+ list.add("pluto-descriptor-api");
+ list.add("pluto-descriptor-impl");
+ list.add("portlet-api");
+ list.add("castor");
+ return list;
+ }
+
+ private void sharedLibraries() throws IOException {
+ File shared = new File(installationDirectory, "shared/lib");
+ shared.mkdirs();
+
+ List sharedDependencies = getSharedDependencies();
+ copyArtifacts(sharedDependencies, shared);
+ }
+
+ private List getEndorsedDependencies() {
+ List list = new ArrayList();
+ list.add("xercesImpl");
+ list.add("xmlParserAPIs");
+ return list;
+ }
+
+ private void endorsedLibraries() throws IOException {
+ File endorsed = new File(installationDirectory, "common/endorsed");
+ endorsed.mkdirs();
+
+ List endorsedDependencies = getEndorsedDependencies();
+ copyArtifacts(endorsedDependencies, endorsed);
+ }
+
+ private void webapps() throws IOException {
+ File webapps = new File(installationDirectory, "webapps");
+ webapps.mkdirs();
+
+ File from = new File(basedir, "/pluto-portal/target/pluto-portal.war");
+ File to = new File(installationDirectory, "webapps");
+ getLog().info("Copying "+from.getAbsolutePath()+" to "+to.getAbsolutePath());
+ FileUtils.copyFileToDirectory(from, to);
+
+ from = new File(basedir, "/pluto-testsuite/target/pluto-testsuite.war");
+ getLog().info("Copying "+from.getAbsolutePath()+" to "+to.getAbsolutePath());
+ FileUtils.copyFileToDirectory(from, to);
+ }
+
+ private void copyArtifacts(List names, File destination)
+ throws IOException {
+ Set artifacts = project.getArtifacts();
+
+ for(Iterator i = artifacts.iterator();i.hasNext();) {
+ Artifact artifact = (Artifact)i.next();
+ if(names.contains(artifact.getArtifactId())) {
+ File from = artifact.getFile();
+ getLog().info("Copying "+from.getAbsolutePath()+" to "+destination.getAbsolutePath());
+ FileUtils.copyFileToDirectory(from, destination);
+ }
+ }
+ }
+
+}
Added: portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/scripts/hello.mmld
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/scripts/hello.mmld?rev=226452&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/scripts/hello.mmld (added)
+++ portals/pluto/branches/pluto-1.1/maven-pluto-plugin/src/main/scripts/hello.mmld Fri Jul 29 18:04:01 2005
@@ -0,0 +1,17 @@
+<mojo xmlns="marmalade:mojo">
+ <metadata>
+ <goal>hello</goal>
+ <description>Say Hello to the World.</description>
+ <parameters>
+ <parameter>
+ <name>salutation</name>
+ <expression>#project.build.directory</expression>
+ <description>Description of what this parameter is used for.</description>
+ </parameter>
+ </parameters>
+ </metadata>
+ <execute>
+ <c:out xmlns:c="marmalade:core">Hello, World</c:out>
+ </execute>
+</mojo>
+
Added: portals/pluto/branches/pluto-1.1/pluto-install/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-install/pom.xml?rev=226452&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-install/pom.xml (added)
+++ portals/pluto/branches/pluto-1.1/pluto-install/pom.xml Fri Jul 29 18:04:01 2005
@@ -0,0 +1,88 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>pluto</artifactId>
+ <groupId>org.apache.pluto</groupId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>pluto-util</artifactId>
+ <name>Pluto</name>
+ <url>http://portals.apache.org/pluto/pluto-1.1</url>
+ <inceptionYear>2001</inceptionYear>
+
+ <!-- The dependencies for the install project
+ are those which need to be installed!
+ -->
+ <dependencies>
+ <dependency>
+ <groupId>portlet-api</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto-descriptor-api</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto-descriptor-impl</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto-container</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>castor</groupId>
+ <artifactId>castor</artifactId>
+ <version>0.9.6</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.6.2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ <version>2.6.2</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <distributionManagement>
+ <site>
+ <id>website</id>
+ <url>scp://minotaur.apache.org/www/portals.apache.org/pluto/pluto-1.1</url>
+ </site>
+ </distributionManagement>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <configuration>
+ <installationDirectory>../../pluto-tomcat</installationDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added: portals/pluto/branches/pluto-1.1/pluto-site/src/site/site.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-site/src/site/site.xml?rev=226452&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-site/src/site/site.xml (added)
+++ portals/pluto/branches/pluto-1.1/pluto-site/src/site/site.xml Fri Jul 29 18:04:01 2005
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project name="Maven">
+ <bannerLeft>
+ <name>Maven</name>
+ <src>http://portals.apache.org/pluto/images/apache-portals.gif</src>
+ <href>http://maven.apache.org/</href>
+ </bannerLeft>
+ <bannerRight>
+ <src>http://portals.apache.org/pluto/images/pluto.png</src>
+ </bannerRight>
+ <body>
+ <links>
+ <item name="JSR 168" href="http://jcp.org/en/jsr/detail?id=168"/>
+ <item name="Chinese Translation" href="http://maven.apache.org/"/>
+ </links>
+
+ <menu name="Developing">
+ <item name="Developing Plugins with Marmalade" href="/developers/developing-plugins-with-marmalade.html"/>
+ </menu>
+
+ ${reports}
+ </body>
+</project>
Added: portals/pluto/branches/pluto-1.1/pluto-site/src/site/xdoc/developing-plugins-with-marmalade.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-site/src/site/xdoc/developing-plugins-with-marmalade.xml?rev=226452&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-site/src/site/xdoc/developing-plugins-with-marmalade.xml (added)
+++ portals/pluto/branches/pluto-1.1/pluto-site/src/site/xdoc/developing-plugins-with-marmalade.xml Fri Jul 29 18:04:01 2005
@@ -0,0 +1,333 @@
+<?xml version="1.0"?>
+<!--
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+
+<document>
+
+ <properties>
+ <title>Developing Plugins with Marmalade</title>
+ <author email="jdcasey@apache.org">John Casey</author>
+ </properties>
+
+ <body>
+ <section name="Developing Plugins with Marmalade">
+ <p>
+ 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
+ syntax, so this process should be very familiar to Maven 1.0 plugin developers.
+ </p>
+ <!-- TODO
+ <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="Graduating from Jelly: Plugins in Marmalade">
+ <p>
+ Beginning in Maven 2.0, plugins can be implemented in various languages. While our initial
+ technology preview will only offer support for these Marmalade and Java, we will eventually add
+ support for additional languages, possibly including Beanshell/Janino, Javascript, and more.
+ </p>
+
+ <p>
+ Marmalade is a next-generation Jelly-like XML language, and was chosen for early inclusion in Maven 2.0 to
+ ease migration from Maven 1.0, and to provide a way to incorporate Ant scripts into a build project.
+ </p>
+
+ <p>
+ Marmalade currently has basic syntax compatibility with Jelly, and some measure of Jelly taglib
+ compatibility... and this support will continue to improve as Marmalade matures. As such, Marmalade can allow
+ the plugin developer the freedom to concentrate on porting between project models and core facilities, rather
+ than worrying about changing implementation languages.
+ </p>
+
+ <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>
+ For those Maven 1.x users who have implemented their own plugins using Jelly, Marmalade can be
+ an extremely powerful language for porting to Maven 2.0.
+ </p>
+
+ <p>For more information on Marmalade, see the
+ <a href="http://marmalade.codehaus.org">Marmalade website.</a>
+ </p>
+ </subsection>
+
+ <subsection name="Marmalade Plugin Basics">
+ <p>
+ A plugin implemented in Marmalade can contain the following:
+ <ul>
+ <li>[Required] One or more Marmalade scripts, each in a file with the extension
+ <code>.mmld</code>
+ </li>
+ <li>
+ [Optional] One or more Marmalade tag libraries, each consisting of:
+ <ul>
+ <li>One or more implementations of MarmaladeTag</li>
+ <li>An implementation of
+ <code>MarmaladeTagLibrary</code>, the constructor of which registers
+ each MarmaladeTag implementation to a tag name (for use in scripts)
+ </li>
+ </ul>
+ </li>
+ <li>
+ [Required] A
+ <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>[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>
+ </ul>
+ </p>
+
+ <p>
+ 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:
+ <ul>
+ <li>Inject project and environmental information into the plugin (parameters)</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, if appropriate</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>
+ </ul>
+ </p>
+
+ <p>
+ The general structure of a Marmalade plugin script is:
+ </p>
+ <source><![CDATA[
+<!-- The term mojo is a play on POJO, meant to mean "Maven POJO".
+ | Mojos correspond to goals in Maven 2.0.
+ -->
+<mojo xmlns="marmalade:mojo">
+ <metadata>
+ <goal>pluginGoalName</goal>
+ <lifecyclePhase>compile</lifecyclePhase> <!-- Bind to the 'compile' phase of the standard build lifecycle. -->
+ <description>A description of what the plugin accomplishes for the build process.</description>
+ <parameters>
+ <parameter>
+ <name>parameterName</name> <!-- A name for accessing the parameter from the Marmalade context. -->
+ <expression>#project.build.directory</expression> <!-- The expression used to bind the parameter. -->
+ <description>Description of what this parameter is used for.</description>
+ </parameter>
+ </parameters>
+ </metadata>
+ <execute>
+ <!-- This is where the guts of the plugin go. Below is a sample body, wherein a file called
+ | "touch.txt" will be created in the output directory (by default, in ${basedir}/target), containing
+ | the content "File Content".
+ -->
+ <io:file xmlns:io="marmalade:io" path="${outputDirectory}/touch.txt" mkdirs="true">File Content</io:file>
+ </execute>
+</mojo>]]></source>
+ </subsection>
+
+ <subsection name="Creating Your First Plugin">
+ <p>
+ To start creating a plugin, you must first create a Maven 2.0 project. This is
+ the same as creating any other project, for example one that builds a JAR, with
+ the exception that in the case of a Marmalade plugin, you have to specify a special
+ source directory in which to find script sources.
+ </p>
+ <p>
+ In a new directory, create a
+ <code>pom.xml</code> file like so:
+ </p>
+ <source><![CDATA[<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- 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>
+
+ <!--
+ You might want to include additional information here
+ eg the developers, organisation, and dependencies
+ -->
+
+ <build>
+ <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>
+</project>]]></source>
+
+ <p>
+ Next, create your first plugin script. As mentioned above, each script corresponds to a single
+ goal within the build system, so you may need several scripts.
+ </p>
+ <p>
+ 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:
+ </p>
+ <source><![CDATA[
+<mojo xmlns="marmalade:mojo">
+ <metadata>
+ <id>hello</id>
+ <goal>hello</goal>
+ <description>Say Hello to the World.</description>
+ </metadata>
+ <execute>
+ <c:out xmlns:c="marmalade:core">Hello, World</c:out>
+ </execute>
+</mojo>]]></source>
+
+ <p>
+ Now that you can run the following command to install this into Maven's local artifact repository:
+ </p>
+ <source>m2 install</source>
+
+ <p>
+ You can prove the goal exists by running it.
+ </p>
+ <source>m2 hello:hello</source>
+
+ <p>
+ This execution should result in the following content being printed to the screen:
+ </p>
+ <source>Hello, World</source>
+ </subsection>
+
+ <subsection name="Using Plugin Parameters">
+ <p>
+ While you can always reference the POM information in a script using mojo parameters with expressions
+ that reference project elements, a plugin will often need to create new parameters so that it can be customised.
+ </p>
+
+ <p>
+ The creation of these parameters simply involves defining them in the metadata section of the script,
+ and optionally providing a default value for use in the event the user doesn't need to customize the plugin.
+ </p>
+ <p>
+ As an example, create a parameter for the salutation to be used in your script:
+ </p>
+ <source><![CDATA[
+<mojo xmlns="marmalade:mojo">
+ <metadata>
+ .
+ .
+ .
+ <parameters>
+ <parameter>
+ <name>salutation</name>
+ <expression>#salutation</expression>
+ <default>Hello</default>
+ <description>The salutation to use in greeting the world.</description>
+ </parameter>
+ </parameters>
+ </metadata>
+ .
+ .
+ .
+</mojo>
+ ]]></source>
+ <p>
+ 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.
+ </p>
+ <p>
+ 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>:
+ </p>
+ <source><![CDATA[
+<c:out xmlns:c="marmalade:core">${salutation}, World.</c:out>
+ ]]></source>
+ <p>
+ Install the new plugin and run it, to verify your changes:
+ </p>
+ <source>m2 install
+m2 hello:hello</source>
+ <p>
+ Notice that the output still has the same old salutation (which is the default value of the parameter).
+ Now, to customize it:
+ </p>
+ <source>m2 -Dsalutation=Hiya hello:hello</source>
+ <p>
+ The output should now read:
+ </p>
+ <source>Hiya, World</source>
+
+ <p>
+ 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>
+ similar to:
+ </p>
+ <source><![CDATA[
+<project>
+ .
+ .
+ .
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-hello-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <configuration>
+ <salutation>Hiya</salutation>
+ </configuration>
+ </plugin>
+ </plugins>
+ .
+ .
+ .
+ </build>
+</project>
+ ]]></source>
+ </subsection>
+ </section>
+ </body>
+</document>
+
Modified: portals/pluto/branches/pluto-1.1/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pom.xml?rev=226452&r1=226451&r2=226452&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pom.xml (original)
+++ portals/pluto/branches/pluto-1.1/pom.xml Fri Jul 29 18:04:01 2005
@@ -7,17 +7,14 @@
<name>Apache Pluto</name>
<url>http://portals.apache.org/pluto</url>
<modules>
+ <module>maven-pluto-plugin</module>
<module>pluto-descriptor-api</module>
<module>pluto-descriptor-impl</module>
<module>pluto-deploy</module>
<module>pluto-container</module>
+ <module>pluto-install</module>
<module>pluto-portal</module>
+ <module>pluto-site</module>
<module>pluto-testsuite</module>
</modules>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- </plugins>
</project>