You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/09/29 06:18:35 UTC

svn commit: r292387 - /maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java

Author: brett
Date: Wed Sep 28 21:18:30 2005
New Revision: 292387

URL: http://svn.apache.org/viewcvs?rev=292387&view=rev
Log:
PR: MNG-912
Submitted by: Binyan
Reviewed by:  Brett Porter
avoid "duplicate files" checking during site generation for resources

Modified:
    maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java

Modified: maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java?rev=292387&r1=292386&r2=292387&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java Wed Sep 28 21:18:30 2005
@@ -294,15 +294,21 @@
 
                 // Try to find duplicate files
                 Map duplicate = new LinkedHashMap();
+                String defaultExcludes = StringUtils.join( DEFAULT_EXCLUDES, "," );
+
                 if ( siteDirectoryFile.exists() )
                 {
-                    tryToFindDuplicates( siteDirectoryFile, duplicate );
+                    // TODO: avoid this hardcoding - the resources dir might be elsewhere. We should really test for duplicate targets, not guess at what source files will be html.
+                    // add the site's 'resources' directory to the default exclude list
+                    String actualExcludes = defaultExcludes + "," + "resources/**";
+
+                    tryToFindDuplicates( siteDirectoryFile, actualExcludes, duplicate );
                 }
 
                 // Handle the GeneratedSite Directory
                 if ( generatedSiteDirectory.exists() )
                 {
-                    tryToFindDuplicates( generatedSiteDirectory, duplicate );
+                    tryToFindDuplicates( generatedSiteDirectory, defaultExcludes, duplicate );
                 }
 
                 // Exception if a file is duplicate
@@ -1109,13 +1115,13 @@
      * <p>The scan is case sensitive.</p>
      *
      * @param directory the directory to scan
+     * @param defaultExcludes files patterns to be exclude from the search
      * @param duplicate the map to update
      * @throws IOException if any
      */
-    private static void tryToFindDuplicates( File directory, Map duplicate )
+    private static void tryToFindDuplicates( File directory, String defaultExcludes, Map duplicate )
         throws IOException
     {
-        String defaultExcludes = StringUtils.join( DEFAULT_EXCLUDES, "," );
         List siteFiles = FileUtils.getFileNames( directory, null, defaultExcludes, false );
         for ( Iterator it = siteFiles.iterator(); it.hasNext(); )
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org