mirror of https://github.com/apache/maven.git
use resources directory instead
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@178561 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dc01cea9f8
commit
d408365aea
|
@ -25,25 +25,24 @@ import org.apache.maven.reporting.MavenReportConfiguration;
|
||||||
import org.codehaus.doxia.module.xhtml.XhtmlSink;
|
import org.codehaus.doxia.module.xhtml.XhtmlSink;
|
||||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
|
import org.codehaus.plexus.util.IOUtil;
|
||||||
import org.codehaus.plexus.util.StringInputStream;
|
import org.codehaus.plexus.util.StringInputStream;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
import org.codehaus.plexus.util.IOUtil;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal site
|
|
||||||
* @description Doxia plugin
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal site
|
||||||
|
* @description Doxia plugin
|
||||||
*/
|
*/
|
||||||
public class DoxiaMojo
|
public class DoxiaMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -72,6 +71,12 @@ public class DoxiaMojo
|
||||||
*/
|
*/
|
||||||
private String outputDirectory;
|
private String outputDirectory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @parameter expression="${basedir}/src/site/resources"
|
||||||
|
* @required
|
||||||
|
*/
|
||||||
|
private File resourcesDirectory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @parameter alias="flavor"
|
* @parameter alias="flavor"
|
||||||
*/
|
*/
|
||||||
|
@ -82,7 +87,7 @@ public class DoxiaMojo
|
||||||
* @required
|
* @required
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
private SiteRenderer siteRenderer;
|
private SiteRenderer siteRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @parameter expression="${project}"
|
* @parameter expression="${project}"
|
||||||
|
@ -113,6 +118,7 @@ public class DoxiaMojo
|
||||||
private List remoteRepositories;
|
private List remoteRepositories;
|
||||||
|
|
||||||
private List projectInfos = new ArrayList();
|
private List projectInfos = new ArrayList();
|
||||||
|
|
||||||
private List projectReports = new ArrayList();
|
private List projectReports = new ArrayList();
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
|
@ -141,9 +147,9 @@ public class DoxiaMojo
|
||||||
|
|
||||||
report.setConfiguration( config );
|
report.setConfiguration( config );
|
||||||
|
|
||||||
XhtmlSink sink = siteRenderer.createSink( new File( siteDirectory ), siteDirectory,
|
XhtmlSink sink = siteRenderer.createSink( new File( siteDirectory ),
|
||||||
report.getOutputName() + ".html",
|
report.getOutputName() + ".html", outputDirectory,
|
||||||
outputDirectory, getSiteDescriptor(), flavour );
|
getSiteDescriptor(), flavour );
|
||||||
|
|
||||||
report.generate( sink );
|
report.generate( sink );
|
||||||
}
|
}
|
||||||
|
@ -174,8 +180,22 @@ public class DoxiaMojo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File cssDirectory = new File( siteDirectory, "css" );
|
||||||
|
File imagesDirectory = new File( siteDirectory, "images" );
|
||||||
|
|
||||||
|
// special case for backwards compatibility
|
||||||
|
if ( cssDirectory.exists() || imagesDirectory.exists() )
|
||||||
|
{
|
||||||
|
getLog().warn( "DEPRECATED: the css and images directories are deprecated, please use resources" );
|
||||||
|
|
||||||
|
FileUtils.copyDirectory( cssDirectory, new File( outputDirectory, "css" ) );
|
||||||
|
|
||||||
|
FileUtils.copyDirectory( imagesDirectory, new File( outputDirectory, "images" ) );
|
||||||
|
}
|
||||||
|
|
||||||
//Generate static site
|
//Generate static site
|
||||||
siteRenderer.render( siteDirectory, generatedSiteDirectory, outputDirectory, flavour, getSiteDescriptor() );
|
siteRenderer.render( siteDirectory, generatedSiteDirectory, outputDirectory, flavour, getSiteDescriptor(),
|
||||||
|
resourcesDirectory );
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
|
@ -211,7 +231,7 @@ public class DoxiaMojo
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
buffer.append( "<menu name=\"Project Documentation\">\n" );
|
buffer.append( "<menu name=\"Project Documentation\">\n" );
|
||||||
buffer.append( " <item name=\"About " + project.getName() + "\" href=\"/index.html\"/>\n");
|
buffer.append( " <item name=\"About " + project.getName() + "\" href=\"/index.html\"/>\n" );
|
||||||
|
|
||||||
if ( projectInfos.size() > 0 )
|
if ( projectInfos.size() > 0 )
|
||||||
{
|
{
|
||||||
|
@ -221,8 +241,9 @@ public class DoxiaMojo
|
||||||
for ( Iterator i = projectInfos.iterator(); i.hasNext(); )
|
for ( Iterator i = projectInfos.iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
MavenReport report = (MavenReport) i.next();
|
MavenReport report = (MavenReport) i.next();
|
||||||
buffer.append( " <item name=\"" + report.getName() + "\" href=\"/" +
|
buffer.append(
|
||||||
report.getOutputName() + ".html\"/>\n" );
|
" <item name=\"" + report.getName() + "\" href=\"/" + report.getOutputName() +
|
||||||
|
".html\"/>\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.append( " </item>\n" );
|
buffer.append( " </item>\n" );
|
||||||
|
@ -236,8 +257,9 @@ public class DoxiaMojo
|
||||||
for ( Iterator i = projectReports.iterator(); i.hasNext(); )
|
for ( Iterator i = projectReports.iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
MavenReport report = (MavenReport) i.next();
|
MavenReport report = (MavenReport) i.next();
|
||||||
buffer.append( " <item name=\"" + report.getName() + "\" href=\"/" +
|
buffer.append(
|
||||||
report.getOutputName() + ".html\"/>\n" );
|
" <item name=\"" + report.getName() + "\" href=\"/" + report.getOutputName() +
|
||||||
|
".html\"/>\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.append( " </item>\n" );
|
buffer.append( " </item>\n" );
|
||||||
|
@ -266,7 +288,7 @@ public class DoxiaMojo
|
||||||
siteDescriptorContent = IOUtil.toString( getClass().getResourceAsStream( "/default-site.xml" ) );
|
siteDescriptorContent = IOUtil.toString( getClass().getResourceAsStream( "/default-site.xml" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "The site descriptor cannot be read!", e );
|
throw new MojoExecutionException( "The site descriptor cannot be read!", e );
|
||||||
}
|
}
|
||||||
|
@ -306,9 +328,8 @@ public class DoxiaMojo
|
||||||
private void generateProjectInfoPage( InputStream siteDescriptor )
|
private void generateProjectInfoPage( InputStream siteDescriptor )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
XhtmlSink sink = siteRenderer.createSink( new File( siteDirectory ), siteDirectory,
|
XhtmlSink sink = siteRenderer.createSink( new File( siteDirectory ), "project-info.html", outputDirectory,
|
||||||
"project-info.html",
|
siteDescriptor, flavour );
|
||||||
outputDirectory, siteDescriptor, flavour );
|
|
||||||
|
|
||||||
String title = "General Project Information";
|
String title = "General Project Information";
|
||||||
|
|
||||||
|
@ -326,7 +347,7 @@ public class DoxiaMojo
|
||||||
|
|
||||||
sink.paragraph();
|
sink.paragraph();
|
||||||
sink.text( "This document provides an overview of the various documents and links that are part " +
|
sink.text( "This document provides an overview of the various documents and links that are part " +
|
||||||
"of this project's general information. All of this content is automatically generated by ");
|
"of this project's general information. All of this content is automatically generated by " );
|
||||||
sink.link( "http://maven.apache.org" );
|
sink.link( "http://maven.apache.org" );
|
||||||
sink.text( "Maven" );
|
sink.text( "Maven" );
|
||||||
sink.link_();
|
sink.link_();
|
||||||
|
@ -367,7 +388,7 @@ public class DoxiaMojo
|
||||||
}
|
}
|
||||||
|
|
||||||
sink.table_();
|
sink.table_();
|
||||||
|
|
||||||
sink.section2_();
|
sink.section2_();
|
||||||
|
|
||||||
sink.section1_();
|
sink.section1_();
|
||||||
|
@ -379,12 +400,11 @@ public class DoxiaMojo
|
||||||
sink.close();
|
sink.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateProjectReportsPage( InputStream siteDescriptor)
|
private void generateProjectReportsPage( InputStream siteDescriptor )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
XhtmlSink sink = siteRenderer.createSink( new File( siteDirectory ), siteDirectory,
|
XhtmlSink sink = siteRenderer.createSink( new File( siteDirectory ), "maven-reports.html", outputDirectory,
|
||||||
"maven-reports.html",
|
siteDescriptor, flavour );
|
||||||
outputDirectory, siteDescriptor, flavour );
|
|
||||||
|
|
||||||
String title = "Maven Generated Reports";
|
String title = "Maven Generated Reports";
|
||||||
|
|
||||||
|
@ -442,7 +462,7 @@ public class DoxiaMojo
|
||||||
}
|
}
|
||||||
|
|
||||||
sink.table_();
|
sink.table_();
|
||||||
|
|
||||||
sink.section2_();
|
sink.section2_();
|
||||||
|
|
||||||
sink.section1_();
|
sink.section1_();
|
||||||
|
|
Loading…
Reference in New Issue