[ http://jira.codehaus.org/browse/MNG-912?page=comments#action_47295 ] 

Binyan commented on MNG-912:
----------------------------

The following patch will exclude the site directory's resources directory from 
being included in the test for duplicate files.

Index: 
E:/maven-components/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java
===================================================================
--- 
E:/maven-components/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java
     (revision 292059)
+++ 
E:/maven-components/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java
     (working copy)
@@ -294,9 +294,14 @@
 
                 // Try to find duplicate files
                 Map duplicate = new LinkedHashMap();
+                String defaultExcludes = StringUtils.join( DEFAULT_EXCLUDES, 
"," );
+                
                 if ( siteDirectoryFile.exists() )
                 {
-                    tryToFindDuplicates( siteDirectoryFile, duplicate );
+                    // add the site's 'resources' directory to the default 
exclude list
+                    String actualExcludes = defaultExcludes + "," + 
"resources/**";
+                    
+                    tryToFindDuplicates( siteDirectoryFile, actualExcludes, 
duplicate );
                 }
 
                 // Handle the GeneratedSite Directory
@@ -302,7 +307,7 @@
                 // Handle the GeneratedSite Directory
                 if ( generatedSiteDirectory.exists() )
                 {
-                    tryToFindDuplicates( generatedSiteDirectory, duplicate );
+                    tryToFindDuplicates( generatedSiteDirectory, 
defaultExcludes, duplicate );
                 }
 
                 // Exception if a file is duplicate
@@ -1109,13 +1114,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(); )
         {


> Overzealous "duplicate files" checking during site generation
> -------------------------------------------------------------
>
>          Key: MNG-912
>          URL: http://jira.codehaus.org/browse/MNG-912
>      Project: Maven 2
>         Type: Bug
>   Components: maven-site-plugin
>     Versions: 2.0-beta-1
>     Reporter: Daniel Schömer
>      Fix For: 2.0-beta-3

>
>
> I'm currently  testing m2 beta-1 with one of my projects.  During site
> generation, I got an error that there are duplicate files in the
> src/site/ directory.
> | # m2 clean:clean site:site
> | ...
> | [INFO] Diagnosis: Error during report generation
> | [INFO] 
> ----------------------------------------------------------------------------
> | [ERROR] Cause: 
> | org.apache.maven.plugin.MojoExecutionException: Error during report 
> generation
> | ...
> | Caused by: org.apache.maven.reporting.MavenReportException: Some files are 
> duplicates in the site directory or in the generated-site directory. 
> | Review the following files for the "Default" version:
> | images/logos/cl-options_figlet-invita
> |         resources/images/logos/cl-options_figlet-invita.png
> |         resources/images/logos/cl-options_figlet-invita.txt
> |         resources/images/logos/cl-options_figlet-invita.xcf
> | ...
> The listed files are not duplicates, they just contain the logo of the
> project in different file formats (PNG, plain text and GIMP).  Its
> seems a little strange to me that m2 doesn't allows me to store
> "content" in different file formats in the site directory without
> giving them different filenames (except of the filename-"extension").
> To me, this may make sense for files that are processed by m2 to
> generate the site (like xdoc and apt), but not for files that are only
> copied during site generation.
> As Brett Porter <[EMAIL PROTECTED]> replied to the "Maven
> Users List" 
> (http://article.gmane.org/gmane.comp.jakarta.turbine.maven.user/26908),
> the tests for duplicate files seems to be too overzealous - it should only 
> check for 
> duplicates in the different doc directories, not in the resources directory.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to