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:
Brett Leslie Porter 2005-05-12 06:01:56 +00:00
parent 3f66301982
commit 0c6a30ab10
6 changed files with 29 additions and 28 deletions

View File

@ -30,7 +30,7 @@ public class XdocGeneratorMojo
extends AbstractGeneratorMojo extends AbstractGeneratorMojo
{ {
/** /**
* @parameter expression="${project.build.directory}/generated-xdocs" * @parameter expression="${project.build.directory}/generated-site/xdoc"
* @required * @required
*/ */
protected File outputDirectory; protected File outputDirectory;

View File

@ -27,6 +27,7 @@ import org.codehaus.doxia.site.renderer.SiteRenderer;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
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.util.ArrayList;
import java.io.File; import java.io.File;
@ -60,7 +61,7 @@ public class DoxiaMojo
private String siteDirectory; private String siteDirectory;
/** /**
* @parameter alias="workingDirectory" expression="${project.build.directory}/site-generated" * @parameter alias="workingDirectory" expression="${project.build.directory}/generated-site"
* @required * @required
*/ */
private String generatedSiteDirectory; private String generatedSiteDirectory;
@ -125,8 +126,6 @@ public class DoxiaMojo
config.setModel( project.getModel() ); config.setModel( project.getModel() );
config.setOutputDirectory( new File( generatedSiteDirectory ) );
//Generate reports //Generate reports
if ( reports != null ) if ( reports != null )
{ {
@ -157,7 +156,6 @@ public class DoxiaMojo
} }
catch ( Exception e ) catch ( Exception e )
{ {
e.printStackTrace();
throw new MojoExecutionException( "An error is occurred in project info page generation.", e ); throw new MojoExecutionException( "An error is occurred in project info page generation.", e );
} }
} }
@ -170,7 +168,6 @@ public class DoxiaMojo
} }
catch ( Exception e ) catch ( Exception e )
{ {
e.printStackTrace();
throw new MojoExecutionException( "An error is occurred in project reports page generation.", e ); 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" ); File siteDescriptor = new File( siteDirectory, "site.xml" );
if ( !siteDescriptor.exists() )
{
throw new MojoExecutionException( "The site descriptor is not present!" );
}
String siteDescriptorContent = ""; String siteDescriptorContent = "";
try try
{ {
siteDescriptorContent = FileUtils.fileRead( siteDescriptor ); if ( siteDescriptor.exists() )
{
siteDescriptorContent = FileUtils.fileRead( siteDescriptor );
}
else
{
siteDescriptorContent = IOUtil.toString( getClass().getResourceAsStream( "/default-site.xml" ) );
}
} }
catch( IOException e ) catch( IOException e )
{ {
@ -277,8 +276,12 @@ public class DoxiaMojo
props.put( "reports", getReportsMenu() ); 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 ); siteDescriptorContent = StringUtils.interpolate( siteDescriptorContent, props );
return new StringInputStream( siteDescriptorContent ); return new StringInputStream( siteDescriptorContent );
} }

View File

@ -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>

View File

@ -30,20 +30,8 @@ public class MavenReportConfiguration
{ {
private Model model; private Model model;
private File outputDirectory;
private File basedir; private File basedir;
public File getOutputDirectory()
{
return outputDirectory;
}
public void setOutputDirectory( File outputDirectory )
{
this.outputDirectory = outputDirectory;
}
public File getBasedir() public File getBasedir()
{ {
return basedir; return basedir;

View File

@ -12,7 +12,7 @@
<distributionManagement> <distributionManagement>
<site> <site>
<id>website</id> <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> </site>
</distributionManagement> </distributionManagement>
</project> </project>

View File

@ -87,8 +87,6 @@ public class PmdReportMojo
config.setModel( project.getModel() ); config.setModel( project.getModel() );
config.setOutputDirectory( new File( outputDirectory ) );
MavenReport report = new PmdReport(); MavenReport report = new PmdReport();
report.setConfiguration( config ); report.setConfiguration( config );