[hibernate-commits] Hibernate SVN: r11702 - in trunk/sandbox/maven-poc/plugins: maven-docbook-support-plugin and 12 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Jun 22 16:58:27 EDT 2007


Author: steve.ebersole at jboss.com
Date: 2007-06-22 16:58:27 -0400 (Fri, 22 Jun 2007)
New Revision: 11702

Added:
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/pom.xml
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/jboss/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/jboss/maven/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/jboss/maven/plugin/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/jboss/maven/plugin/docbook/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/jboss/maven/plugin/docbook/support/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/jboss/maven/plugin/docbook/support/DocBookSupportResourcesMojo.java
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/resources/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/resources/META-INF/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/resources/META-INF/plexus/
   trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/resources/META-INF/plexus/components.xml
Log:
added the plugin for the docbook-support packaging

Added: trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/pom.xml
===================================================================
--- trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/pom.xml	                        (rev 0)
+++ trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/pom.xml	2007-06-22 20:58:27 UTC (rev 11702)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+
+<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">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.jboss.maven.plugins</groupId>
+    <artifactId>maven-docbook-support-plugin</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>maven-plugin</packaging>
+
+    <name>DocBook Support Packaging</name>
+    <description>Plugin defining a docbook-support packaging for support of DocBook transformations.</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-utils</artifactId>
+            <version>1.0.4</version>
+        </dependency>
+    </dependencies>
+
+</project>

Added: trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/jboss/maven/plugin/docbook/support/DocBookSupportResourcesMojo.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/jboss/maven/plugin/docbook/support/DocBookSupportResourcesMojo.java	                        (rev 0)
+++ trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/java/org/jboss/maven/plugin/docbook/support/DocBookSupportResourcesMojo.java	2007-06-22 20:58:27 UTC (rev 11702)
@@ -0,0 +1,103 @@
+/*
+ * Copyright © 2007  Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details. You should have received a
+ * copy of the GNU Lesser General Public License, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Steve Ebersole
+ */
+package org.jboss.maven.plugin.docbook.support;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Defines resources-like processing for docbook support files such
+ * as XSLT, fonts, resources (images/css/etc), moving them to specific locations
+ * within the output directory for inclusion in the final package.
+ *
+ * @goal resources
+ * @phase process-resources
+ * @requiresDependencyResolution
+ *
+ * @author Steve Ebersole
+ */
+public class DocBookSupportResourcesMojo extends AbstractMojo {
+
+	/**
+	 * The directory containing the XSLT sources.
+	 *
+	 * @parameter expression="${basedir}/src/main/styles"
+	 */
+	protected File xsltSourceDirectory;
+
+	/**
+	 * The directory containing fonts to be included in package.
+	 *
+	 * @parameter expression="${basedir}/src/main/fonts"
+	 */
+	protected File fontSourceDirectory;
+
+	/**
+	 * The directory containing images to be included in package.
+	 *
+	 * @parameter expression="${basedir}/src/main/images"
+	 */
+	protected File imagesSourceDirectory;
+
+	/**
+	 * The directory containing css to be included in package.
+	 *
+	 * @parameter expression="${basedir}/src/main/css"
+	 */
+	protected File cssSourceDirectory;
+
+	/**
+	 * The directory from which packaging is staged.
+	 *
+	 * @parameter expression="${project.build.outputDirectory}"
+	 */
+	protected File outputDirectory;
+
+	public void execute() throws MojoExecutionException, MojoFailureException {
+		copySource( xsltSourceDirectory, new File( outputDirectory, "styles" ) );
+		copySource( fontSourceDirectory, new File( outputDirectory, "fonts" ) );
+		copySource( imagesSourceDirectory, new File( outputDirectory, "images" ) );
+		copySource( cssSourceDirectory, new File( outputDirectory, "css" ) );
+	}
+
+	private void copySource(File sourceDirectory, File targetDirectory)
+			throws MojoExecutionException {
+		getLog().info( "attempting to copy directory : " + sourceDirectory.getAbsolutePath() );
+		if ( !sourceDirectory.exists() ) {
+			return;
+		}
+		String[] list = sourceDirectory.list();
+		if ( list == null || list.length == 0 ) {
+			return;
+		}
+
+		if ( !targetDirectory.exists() ) {
+			targetDirectory.mkdirs();
+		}
+
+		try {
+			FileUtils.copyDirectoryStructure( sourceDirectory, targetDirectory );
+		}
+		catch ( IOException e ) {
+			throw new MojoExecutionException( "unable to copy source directory [" + sourceDirectory.getAbsolutePath() + "]", e );
+		}
+	}
+}

Added: trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/resources/META-INF/plexus/components.xml
===================================================================
--- trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/resources/META-INF/plexus/components.xml	                        (rev 0)
+++ trunk/sandbox/maven-poc/plugins/maven-docbook-support-plugin/src/main/resources/META-INF/plexus/components.xml	2007-06-22 20:58:27 UTC (rev 11702)
@@ -0,0 +1,35 @@
+<component-set>
+
+    <components>
+
+        <component>
+            <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+            <role-hint>docbook-support</role-hint>
+            <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+            <configuration>
+                <phases>
+                    <process-resources>org.jboss.maven.plugins:maven-docbook-support-plugin:resources</process-resources>
+                    <package>org.apache.maven.plugins:maven-jar-plugin:jar</package>
+                    <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+                    <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+                </phases>
+            </configuration>
+        </component>
+
+        <component>
+            <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+            <role-hint>docbook-support</role-hint>
+            <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+            <configuration>
+                <type>docbook-support</type>
+                <extension>jar</extension>
+                <packaging>jar</packaging>
+                <language>java</language>
+                <addedToClasspath>false</addedToClasspath>
+                <includesDependencies>true</includesDependencies>
+            </configuration>
+        </component>
+
+    </components>
+
+</component-set>
\ No newline at end of file




More information about the hibernate-commits mailing list