mirror of https://github.com/apache/maven.git
unifyf generated site directory, add default site descriptor
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@169776 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3f66301982
commit
0c6a30ab10
|
@ -30,7 +30,7 @@ public class XdocGeneratorMojo
|
|||
extends AbstractGeneratorMojo
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}/generated-xdocs"
|
||||
* @parameter expression="${project.build.directory}/generated-site/xdoc"
|
||||
* @required
|
||||
*/
|
||||
protected File outputDirectory;
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.codehaus.doxia.site.renderer.SiteRenderer;
|
|||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.codehaus.plexus.util.StringInputStream;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.io.File;
|
||||
|
@ -60,7 +61,7 @@ public class DoxiaMojo
|
|||
private String siteDirectory;
|
||||
|
||||
/**
|
||||
* @parameter alias="workingDirectory" expression="${project.build.directory}/site-generated"
|
||||
* @parameter alias="workingDirectory" expression="${project.build.directory}/generated-site"
|
||||
* @required
|
||||
*/
|
||||
private String generatedSiteDirectory;
|
||||
|
@ -125,8 +126,6 @@ public class DoxiaMojo
|
|||
|
||||
config.setModel( project.getModel() );
|
||||
|
||||
config.setOutputDirectory( new File( generatedSiteDirectory ) );
|
||||
|
||||
//Generate reports
|
||||
if ( reports != null )
|
||||
{
|
||||
|
@ -157,7 +156,6 @@ public class DoxiaMojo
|
|||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new MojoExecutionException( "An error is occurred in project info page generation.", e );
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +168,6 @@ public class DoxiaMojo
|
|||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new MojoExecutionException( "An error is occurred in project reports page generation.", e );
|
||||
}
|
||||
}
|
||||
|
@ -254,16 +251,18 @@ public class DoxiaMojo
|
|||
{
|
||||
File siteDescriptor = new File( siteDirectory, "site.xml" );
|
||||
|
||||
if ( !siteDescriptor.exists() )
|
||||
{
|
||||
throw new MojoExecutionException( "The site descriptor is not present!" );
|
||||
}
|
||||
|
||||
String siteDescriptorContent = "";
|
||||
|
||||
try
|
||||
{
|
||||
siteDescriptorContent = FileUtils.fileRead( siteDescriptor );
|
||||
if ( siteDescriptor.exists() )
|
||||
{
|
||||
siteDescriptorContent = FileUtils.fileRead( siteDescriptor );
|
||||
}
|
||||
else
|
||||
{
|
||||
siteDescriptorContent = IOUtil.toString( getClass().getResourceAsStream( "/default-site.xml" ) );
|
||||
}
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
|
@ -277,8 +276,12 @@ public class DoxiaMojo
|
|||
props.put( "reports", getReportsMenu() );
|
||||
}
|
||||
|
||||
// TODO: interpolate ${project.*} in general
|
||||
props.put( "project.name", project.getName() );
|
||||
props.put( "project.url", project.getUrl() );
|
||||
|
||||
siteDescriptorContent = StringUtils.interpolate( siteDescriptorContent, props );
|
||||
|
||||
|
||||
return new StringInputStream( siteDescriptorContent );
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="${project.name}">
|
||||
<bannerLeft>
|
||||
<name>${project.name}</name>
|
||||
</bannerLeft>
|
||||
<body>
|
||||
<links>
|
||||
<item name="${project.name}" href="${project.url}"/>
|
||||
</links>
|
||||
${reports}
|
||||
</body>
|
||||
</project>
|
|
@ -30,20 +30,8 @@ public class MavenReportConfiguration
|
|||
{
|
||||
private Model model;
|
||||
|
||||
private File outputDirectory;
|
||||
|
||||
private File basedir;
|
||||
|
||||
public File getOutputDirectory()
|
||||
{
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
public void setOutputDirectory( File outputDirectory )
|
||||
{
|
||||
this.outputDirectory = outputDirectory;
|
||||
}
|
||||
|
||||
public File getBasedir()
|
||||
{
|
||||
return basedir;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<distributionManagement>
|
||||
<site>
|
||||
<id>website</id>
|
||||
<url>scp://minotaur.apache.org/x1/home/jvanzyl/public_html/m2-new</url>
|
||||
<url>scp://people.apache.org/home/brett/public_html/maven-stage-site/maven2</url>
|
||||
</site>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
|
|
@ -87,8 +87,6 @@ public class PmdReportMojo
|
|||
|
||||
config.setModel( project.getModel() );
|
||||
|
||||
config.setOutputDirectory( new File( outputDirectory ) );
|
||||
|
||||
MavenReport report = new PmdReport();
|
||||
|
||||
report.setConfiguration( config );
|
||||
|
|
Loading…
Reference in New Issue