o Fix copy of resources directory for exclude all "default" files

o Fix xhtml for conformance with standard

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@179320 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-06-01 00:24:37 +00:00
parent 215c30bbb3
commit 6d4626e2d6
2 changed files with 60 additions and 10 deletions

View File

@ -26,6 +26,7 @@ import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.siterenderer.Renderer;
import org.codehaus.plexus.siterenderer.RendererException;
import org.codehaus.plexus.siterenderer.sink.SiteRendererSink;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringInputStream;
@ -39,6 +40,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@ -60,6 +62,24 @@ public class DoxiaMojo
private static final String DEFAULT_TEMPLATE = RESOURCE_DIR + "/maven-site.vm";
private static final String[] DEFAULT_EXCLUDES = {// Miscellaneous typical temporary files
"**/*~", "**/#*#", "**/.#*", "**/%*%", "**/._*",
// CVS
"**/CVS", "**/CVS/**", "**/.cvsignore",
// SCCS
"**/SCCS", "**/SCCS/**",
// Visual SourceSafe
"**/vssver.scc",
// Subversion
"**/.svn", "**/.svn/**",
// Mac
"**/.DS_Store" };
/**
* @parameter expression="${basedir}/src/site"
* @required
@ -213,9 +233,9 @@ public class DoxiaMojo
{
getLog().warn( "DEPRECATED: the css and images directories are deprecated, please use resources" );
FileUtils.copyDirectory( cssDirectory, new File( outputDirectory, "css" ) );
copyDirectory( cssDirectory, new File( outputDirectory, "css" ) );
FileUtils.copyDirectory( imagesDirectory, new File( outputDirectory, "images" ) );
copyDirectory( imagesDirectory, new File( outputDirectory, "images" ) );
}
// Generate static site
@ -227,7 +247,7 @@ public class DoxiaMojo
// Copy site resources
if ( resourcesDirectory != null )
{
FileUtils.copyDirectory( resourcesDirectory, new File( outputDirectory ) );
copyDirectory( resourcesDirectory, new File( outputDirectory ) );
}
copyResources( outputDirectory );
@ -537,7 +557,8 @@ public class DoxiaMojo
if ( is == null )
{
throw new IOException( "The resource " + line + " doesn't exists in " + DEFAULT_TEMPLATE + " template." );
throw new IOException( "The resource " + line + " doesn't exists in " + DEFAULT_TEMPLATE
+ " template." );
}
File outputFile = new File( outputDirectory, line );
@ -563,4 +584,33 @@ public class DoxiaMojo
{
return DoxiaMojo.class.getClassLoader().getResourceAsStream( name );
}
private void copyDirectory( File source, File destination )
throws IOException
{
DirectoryScanner scanner = new DirectoryScanner();
String[] includedResources = { "**/**" };
scanner.setIncludes( includedResources );
scanner.addDefaultExcludes();
scanner.setBasedir( source );
scanner.scan();
List includedFiles = Arrays.asList( scanner.getIncludedFiles() );
for ( Iterator j = includedFiles.iterator(); j.hasNext(); )
{
String name = (String) j.next();
File sourceFile = new File( source, name );
File destinationFile = new File( destination, name );
FileUtils.copyFile( sourceFile, destinationFile );
}
}
}

View File

@ -32,7 +32,7 @@
<div id="navcolumn">
$mainMenu
<a href="http://maven.apache.org/" title="Built by Maven" id="poweredBy">
<img alt="Built by Maven" src="$relativePath/images/logos/maven-feather.png"></img>
<img alt="Built by Maven" src="$relativePath/images/logos/maven-feather.png" />
</a>
</div>
</div>
@ -42,12 +42,12 @@
</div>
</div>
<div class="clear">
<hr/>
<hr />
</div>
<div id="footer">
<div class="xright">&#169; 2002-2005, Apache Software Foundation</div>
<div class="clear">
<hr/>
<hr />
</div>
</div>
</body>