Author: evenisse
Date: Wed Jun  1 17:23:46 2005
New Revision: 179471

URL: http://svn.apache.org/viewcvs?rev=179471&view=rev
Log:
Allow user to change the template

Modified:
    
maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java

Modified: 
maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java?rev=179471&r1=179470&r2=179471&view=diff
==============================================================================
--- 
maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java
 (original)
+++ 
maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java
 Wed Jun  1 17:23:46 2005
@@ -39,6 +39,9 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -87,12 +90,17 @@
     private File resourcesDirectory;
 
     /**
-     * @parameterX expression="${template}
+     * @parameter expression="${templateDirectory}
+     */
+    private String templateDirectory;
+
+    /**
+     * @parameter expression="${template}
      */
     private String template = DEFAULT_TEMPLATE;
 
     /**
-     * @parameterX expression="${attributes}
+     * @parameter expression="${attributes}
      */
     private Map attributes;
 
@@ -138,7 +146,27 @@
     public void execute()
         throws MojoExecutionException
     {
-        siteRenderer.setTemplateClassLoader( DoxiaMojo.class.getClassLoader() 
);
+        if ( templateDirectory == null )
+        {
+            siteRenderer.setTemplateClassLoader( 
DoxiaMojo.class.getClassLoader() );
+        }
+        else
+        {
+            try
+            {
+                URL templateDirectoryUrl = new URL( templateDirectory );
+
+                URL[] urls = { templateDirectoryUrl };
+
+                URLClassLoader urlClassloader = new URLClassLoader( urls );
+
+                siteRenderer.setTemplateClassLoader( urlClassloader );
+            }
+            catch( MalformedURLException e )
+            {
+                throw new MojoExecutionException( templateDirectory + " isn't 
a valid URL." );
+            }
+        }
 
         try
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to