Author: vsiveton Date: Wed Aug 3 06:11:10 2005 New Revision: 227216 URL: http://svn.apache.org/viewcvs?rev=227216&view=rev Log: Rolling back to still allow exception on duplicate files and some small improvements.
Modified: maven/components/trunk/maven-plugins/maven-site-plugin/pom.xml maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java Modified: maven/components/trunk/maven-plugins/maven-site-plugin/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-site-plugin/pom.xml?rev=227216&r1=227215&r2=227216&view=diff ============================================================================== --- maven/components/trunk/maven-plugins/maven-site-plugin/pom.xml (original) +++ maven/components/trunk/maven-plugins/maven-site-plugin/pom.xml Wed Aug 3 06:11:10 2005 @@ -61,10 +61,6 @@ <artifactId>wagon-ssh</artifactId> <version>1.0-alpha-4</version> </dependency> - <dependency> - <groupId>plexus</groupId> - <artifactId>plexus-utils</artifactId> - </dependency> </dependencies> <developers> <developer> Modified: maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java?rev=227216&r1=227215&r2=227216&view=diff ============================================================================== --- maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java (original) +++ maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java Wed Aug 3 06:11:10 2005 @@ -257,9 +257,10 @@ } } + Locale locale; for ( Iterator iterator = localesList.iterator(); iterator.hasNext(); ) { - Locale locale = (Locale) iterator.next(); + locale = (Locale) iterator.next(); File localeOutputDirectory = getOuputDirectory( locale ); @@ -272,9 +273,10 @@ //Generate reports if ( reports != null ) { + MavenReport report; for ( Iterator j = reports.iterator(); j.hasNext(); ) { - MavenReport report = (MavenReport) j.next(); + report = (MavenReport) j.next(); getLog().info( "Generate \"" + report.getName( locale ) + "\" report." ); @@ -365,10 +367,10 @@ if ( duplicate.size() > 0 ) { StringBuffer sb = null; - + Map.Entry entry; for ( Iterator it = duplicate.entrySet().iterator(); it.hasNext(); ) { - Map.Entry entry = (Map.Entry) it.next(); + entry = (Map.Entry) it.next(); Set values = (Set) entry.getValue(); if ( values.size() > 1 ) @@ -614,6 +616,11 @@ /** * @todo should only be needed once + * + * @param reports a list of reports + * @param locale the current locale + * @return the inpustream + * @throws MojoExecutionException is any */ private InputStream getSiteDescriptor( List reports, Locale locale ) throws MojoExecutionException @@ -663,7 +670,8 @@ { if ( project.getModules() != null && project.getModules().size() > 0 ) { - props.put( "modules", getModulesMenu( locale ) ); + /* See the Not working section, around line 460*/ + //props.put( "modules", getModulesMenu( locale ) ); } } @@ -1003,9 +1011,10 @@ List reports = new ArrayList(); if ( reportPlugins != null ) { + ReportPlugin reportPlugin; for ( Iterator it = reportPlugins.iterator(); it.hasNext(); ) { - ReportPlugin reportPlugin = (ReportPlugin) it.next(); + reportPlugin = (ReportPlugin) it.next(); try { @@ -1020,9 +1029,10 @@ } else { + ReportSet reportSet; for ( Iterator j = reportSets.iterator(); j.hasNext(); ) { - ReportSet reportSet = (ReportSet) j.next(); + reportSet = (ReportSet) j.next(); reportsList = pluginManager.getReports( reportPlugin, reportSet, project, session ); } @@ -1052,8 +1062,8 @@ } /** - * Convenience method that try to find duplicate files in a given directory. - * <p>The scan is case unsensitive.</p> + * Convenience method that try to find duplicate files in sub-directories of a given directory. + * <p>The scan is case sensitive.</p> * * @param directory the directory to scan * @param duplicate the map to update @@ -1063,33 +1073,51 @@ throws IOException { String defaultExcludes = StringUtils.join( DEFAULT_EXCLUDES, "," ); - List siteFiles = FileUtils.getFileNames( directory, null, defaultExcludes, false ); - for ( Iterator it = siteFiles.iterator(); it.hasNext(); ) + + List siteFileNames = FileUtils.getFileNames( directory, null, defaultExcludes, false ); + + String currentFileName; + for ( Iterator it = siteFileNames.iterator(); it.hasNext(); ) { - String currentFile = (String) it.next(); + currentFileName = (String) it.next(); - if ( currentFile.lastIndexOf( File.separator ) == -1 ) + if ( currentFileName.lastIndexOf( File.separator ) == -1 ) { // ignore files directly in the directory continue; } - if ( currentFile.lastIndexOf( "." ) == -1 ) + if ( currentFileName.lastIndexOf( "." ) == -1 ) { // ignore files without extension continue; } - String key = currentFile.substring( currentFile.indexOf( File.separator ) + 1, - currentFile.lastIndexOf( "." ) ); + String key = currentFileName.substring( currentFileName.indexOf( File.separator ) + 1, + currentFileName.lastIndexOf( "." ) ); + + String filePattern = "**/" + key + ".*"; - Set tmp = (Set) duplicate.get( key.toLowerCase() ); - if ( tmp == null ) + List duplicateFileNames = FileUtils.getFileNames( directory, filePattern, defaultExcludes, false ); + Set duplicatedFileNamesSet = (Set) duplicate.get( key.toLowerCase() ); + if ( duplicatedFileNamesSet == null ) { - tmp = new HashSet(); - duplicate.put( key.toLowerCase(), tmp ); + duplicatedFileNamesSet = new HashSet(); + } + + String tmp; + for ( Iterator it2 = duplicateFileNames.iterator(); it2.hasNext(); ) + { + tmp = (String) it2.next(); + if ( tmp.lastIndexOf( File.separator ) == -1 ) + { + // ignore files directly in the directory + continue; + } + + duplicatedFileNamesSet.add( directory.getAbsolutePath() + File.separator + tmp ); } - tmp.add( key ); + duplicate.put( key.toLowerCase(), duplicatedFileNamesSet ); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]