mirror of https://github.com/apache/maven.git
Allow user to change the template
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@179471 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a1d0973a13
commit
0ce22ce966
|
@ -39,6 +39,9 @@ import java.io.IOException;
|
|||
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 @@ public class DoxiaMojo
|
|||
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 class DoxiaMojo
|
|||
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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue