You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2011/07/26 00:57:32 UTC

svn commit: r1150948 - in /maven/plugins/trunk/maven-site-plugin: pom.xml src/it/full-reporting/pom.xml src/it/full-reporting/verify.groovy src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java

Author: hboutemy
Date: Mon Jul 25 22:57:29 2011
New Revision: 1150948

URL: http://svn.apache.org/viewvc?rev=1150948&view=rev
Log:
[MSITE-402] ensure order of reports like defined in POM (works with Maven 3 but not with Maven 2.2 for the moment)

Modified:
    maven/plugins/trunk/maven-site-plugin/pom.xml
    maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml
    maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java

Modified: maven/plugins/trunk/maven-site-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/pom.xml?rev=1150948&r1=1150947&r2=1150948&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-site-plugin/pom.xml Mon Jul 25 22:57:29 2011
@@ -205,7 +205,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.reporting</groupId>
       <artifactId>maven-reporting-exec</artifactId>
-      <version>1.0</version>
+      <version>1.0.1-SNAPSHOT</version>
     </dependency>
 
     <!-- Maven -->

Modified: maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml?rev=1150948&r1=1150947&r2=1150948&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml (original)
+++ maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml Mon Jul 25 22:57:29 2011
@@ -65,6 +65,23 @@
           <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
           <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
         </configuration>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>index</report>
+              <report>summary</report>
+              <report>license</report>
+              <report>project-team</report>
+              <report>scm</report>
+              <report>issue-tracking</report>
+              <report>mailing-list</report>
+              <report>dependencies</report>
+              <report>cim</report>
+              <report>plugin-management</report>
+              <report>plugins</report>
+            </reports>
+          </reportSet>
+        </reportSets>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>

Modified: maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy?rev=1150948&r1=1150947&r2=1150948&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy (original)
+++ maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy Mon Jul 25 22:57:29 2011
@@ -25,21 +25,71 @@ assert content.contains( 'Test set: org.
 
 assert content.contains( 'Tests run: 1, Failures: 0, Errors: 0, Skipped: 0' );
 
-assert new File( basedir, 'target/site/surefire-report.html' ).exists();
-assert new File( basedir, 'target/site/index.html' ).exists();
-assert new File( basedir, 'target/site/checkstyle.html' ).exists();
-assert new File( basedir, 'target/site/cpd.html' ).exists();
-assert new File( basedir, 'target/site/apidocs/index.html' ).exists();
-assert new File( basedir, 'target/site/apidocs/org/apache/maven/plugins/site/its/App.html' ).exists();
-assert new File( basedir, 'target/site/cobertura/index.html' ).exists();
-assert new File( basedir, 'target/site/xref/index.html' ).exists();
-assert new File( basedir, 'target/site/xref-test/index.html' ).exists();
+sitedir = new File( basedir, 'target/site' );
 
-assert new File( basedir, 'target/site/taglist.html' ).exists();
-assert new File( basedir, 'target/site/team-list.html' ).exists();
+assert new File( sitedir, 'surefire-report.html' ).exists();
+assert new File( sitedir, 'index.html' ).exists();
+assert new File( sitedir, 'checkstyle.html' ).exists();
+assert new File( sitedir, 'cpd.html' ).exists();
+assert new File( sitedir, 'apidocs/index.html' ).exists();
+assert new File( sitedir, 'apidocs/org/apache/maven/plugins/site/its/App.html' ).exists();
+assert new File( sitedir, 'cobertura/index.html' ).exists();
+assert new File( sitedir, 'xref/index.html' ).exists();
+assert new File( sitedir, 'xref-test/index.html' ).exists();
 
-assert new File( basedir, 'target/site/dependencies.html' ).exists();
-content = new File( basedir, 'target/site/dependencies.html' ).text;
+assert new File( sitedir, 'taglist.html' ).exists();
+assert new File( sitedir, 'team-list.html' ).exists();
+
+assert new File( sitedir, 'dependencies.html' ).exists();
+content = new File( sitedir, 'dependencies.html' ).text;
 assert content.contains( 'junit:junit:jar:3.8.2' );
 
+// check reports order
+String[] reports = [ 'index',                  // <report>index</report>
+                     'project-summary',        // <report>summary</report>
+                     'license',                // <report>license</report>
+                     'team-list',              // <report>project-team</report>
+                     'source-repository',      // <report>scm</report>
+                     'issue-tracking',         // <report>issue-tracking</report>
+                     'mail-lists',             // <report>mailing-list</report>
+                     'dependencies',           // <report>dependencies</report>
+                     'integration',            // <report>cim</report>
+                     'plugin-management',      // <report>plugin-management</report>
+                     'plugins'                 // <report>plugins</report>
+                   ];
+String info = new File( sitedir, 'project-info.html' ).text;
+int index1 = 10;
+int index2 = 10;
+String previousReportLink;
+for ( String report : reports )
+{
+    File reportFile = new File( sitedir, report + ".html" );
+    if ( !reportFile.isFile() )
+    {
+        println "Report file not existent: $reportFile";
+        return false;
+    }
+
+    String link = "<a href=\"" + reportFile.getName() + "\"";
+    int i1 = info.indexOf( link );
+    int i2 = info.indexOf( link, i1 + 1 );
+    if ( i1 < index1 )
+    {
+        println "Wrong order for first report link: expected $previousReportLink -> $link, but found $i1 < $index1";
+        println "   previous report link: " + info.substring( index1 - 10, index1 + 70 );
+        println "     actual report link: " + info.substring( i1 - 10, i1 + 70 );
+        //return false; // does not work with Maven 2.2 for the moment
+    }
+    if ( i2 < index2 )
+    {
+        println "Wrong order for second report link: expected $previousReportLink -> $link, but found $i2 < $index2";
+        println "   previous report link: " + info.substring( index2 - 10, index2 + 70 );
+        println "     actual report link: " + info.substring( i2 - 10, i2 + 70 );
+        //return false; // does not work with Maven 2.2 for the moment
+    }
+    index1 = i1;
+    index2 = i2;
+    previousReportLink = link;
+}
+
 return true;
\ No newline at end of file

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?rev=1150948&r1=1150947&r2=1150948&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java Mon Jul 25 22:57:29 2011
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -389,7 +390,7 @@ public abstract class AbstractSiteRender
         // copy Collection to prevent ConcurrentModificationException
         List<MavenReportExecution> filtered = new ArrayList<MavenReportExecution>( reports );
 
-        Map<String, MavenReport> reportsByOutputName = new HashMap<String, MavenReport>();
+        Map<String, MavenReport> reportsByOutputName = new LinkedHashMap<String, MavenReport>();
         for ( MavenReportExecution mavenReportExecution : filtered )
         {
             MavenReport report = mavenReportExecution.getMavenReport();
@@ -426,7 +427,7 @@ public abstract class AbstractSiteRender
      */
     protected Map<String, List<MavenReport>> categoriseReports( Collection<MavenReport> reports )
     {
-        Map<String, List<MavenReport>> categories = new HashMap<String, List<MavenReport>>();
+        Map<String, List<MavenReport>> categories = new LinkedHashMap<String, List<MavenReport>>();
         for ( MavenReport report : reports )
         {
             List<MavenReport> categoryReports = categories.get( report.getCategoryName() );



Re: svn commit: r1150948 - in /maven/plugins/trunk/maven-site-plugin: pom.xml src/it/full-reporting/pom.xml src/it/full-reporting/verify.groovy src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java

Posted by Hervé BOUTEMY <he...@free.fr>.
I found the culprit: MNG-5140
and the impact is reduced: only reports in a reportSet are affected

Given this, I think it is safe to keep the fix

Regards,

Hervé

Le mercredi 27 juillet 2011, Hervé BOUTEMY a écrit :
> I still need to investigate what's happenning with m-site-p 2.3 and Maven
> 2.2
> 
> yes, it's better to have same behaviour with every Maven version
> I'll work on it tomorrow
> 
> Regards,
> 
> Hervé
> 
> Le mercredi 27 juillet 2011, Dennis Lundberg a écrit :
> > Hervé,
> > 
> > Do you have an idea how to fix this for Maven 2?
> > 
> > If you don't, then I'd like to postpone this change to a time when we
> > have a solution for Maven 2.
> > 
> > I feel that it is better (and easier) if this version of the plugin
> > behaves the same (as much as possible) when it is run with Maven 2 and
> > Maven 3.
> > 
> > On 2011-07-26 00:57, hboutemy@apache.org wrote:
> > > Author: hboutemy
> > > Date: Mon Jul 25 22:57:29 2011
> > > New Revision: 1150948
> > > 
> > > URL: http://svn.apache.org/viewvc?rev=1150948&view=rev
> > > Log:
> > > [MSITE-402] ensure order of reports like defined in POM (works with
> > > Maven 3 but not with Maven 2.2 for the moment)
> > > 
> > > Modified:
> > >     maven/plugins/trunk/maven-site-plugin/pom.xml
> > >     maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml
> > >     maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.
> > >     gr oovy
> > >     maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/mave
> > >     n /plugins/site/AbstractSiteRenderingMojo.java
> > > 
> > > Modified: maven/plugins/trunk/maven-site-plugin/pom.xml
> > > URL:
> > > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/pom.
> > > x ml?rev=1150948&r1=1150947&r2=1150948&view=diff
> > > =======================================================================
> > > = ====== --- maven/plugins/trunk/maven-site-plugin/pom.xml (original)
> > > +++ maven/plugins/trunk/maven-site-plugin/pom.xml Mon Jul 25 22:57:29
> > > 2011 @@ -205,7 +205,7 @@ under the License.
> > > 
> > >      <dependency>
> > >      
> > >        <groupId>org.apache.maven.reporting</groupId>
> > >        <artifactId>maven-reporting-exec</artifactId>
> > > 
> > > -      <version>1.0</version>
> > > +      <version>1.0.1-SNAPSHOT</version>
> > > 
> > >      </dependency>
> > >      
> > >      <!-- Maven -->
> > > 
> > > Modified:
> > > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml
> > > URL:
> > > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src
> > > /i t/full-reporting/pom.xml?rev=1150948&r1=1150947&r2=1150948&view=diff
> > > ======================================================================
> > > == ====== ---
> > > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml
> > > (original) +++
> > > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml Mon
> > > Jul 25 22:57:29 2011 @@ -65,6 +65,23 @@
> > > 
> > >            <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
> > >            <dependencyLocationsEnabled>false</dependencyLocationsEnable
> > >            d>
> > >          
> > >          </configuration>
> > > 
> > > +        <reportSets>
> > > +          <reportSet>
> > > +            <reports>
> > > +              <report>index</report>
> > > +              <report>summary</report>
> > > +              <report>license</report>
> > > +              <report>project-team</report>
> > > +              <report>scm</report>
> > > +              <report>issue-tracking</report>
> > > +              <report>mailing-list</report>
> > > +              <report>dependencies</report>
> > > +              <report>cim</report>
> > > +              <report>plugin-management</report>
> > > +              <report>plugins</report>
> > > +            </reports>
> > > +          </reportSet>
> > > +        </reportSets>
> > > 
> > >        </plugin>
> > >        <plugin>
> > >        
> > >          <groupId>org.apache.maven.plugins</groupId>
> > > 
> > > Modified:
> > > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groo
> > > v y URL:
> > > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/
> > > i
> > > t/full-reporting/verify.groovy?rev=1150948&r1=1150947&r2=1150948&view=
> > > dif f
> > > =======================================================================
> > > = ====== ---
> > > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groo
> > > v y (original) +++
> > > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groo
> > > v y Mon Jul 25 22:57:29 2011 @@ -25,21 +25,71 @@ assert
> > > content.contains( 'Test set: org.
> > > 
> > >  assert content.contains( 'Tests run: 1, Failures: 0, Errors: 0,
> > >  Skipped: 0' );
> > > 
> > > -assert new File( basedir, 'target/site/surefire-report.html'
> > > ).exists(); -assert new File( basedir, 'target/site/index.html'
> > > ).exists(); -assert new File( basedir, 'target/site/checkstyle.html'
> > > ).exists(); -assert new File( basedir, 'target/site/cpd.html'
> > > ).exists();
> > > -assert new File( basedir, 'target/site/apidocs/index.html' ).exists();
> > > -assert new File( basedir,
> > > 'target/site/apidocs/org/apache/maven/plugins/site/its/App.html'
> > > ).exists(); -assert new File( basedir,
> > > 'target/site/cobertura/index.html' ).exists(); -assert new File(
> > > basedir, 'target/site/xref/index.html' ).exists(); -assert new File(
> > > basedir, 'target/site/xref-test/index.html' ).exists(); +sitedir = new
> > > File( basedir, 'target/site' );
> > > 
> > > -assert new File( basedir, 'target/site/taglist.html' ).exists();
> > > -assert new File( basedir, 'target/site/team-list.html' ).exists();
> > > +assert new File( sitedir, 'surefire-report.html' ).exists();
> > > +assert new File( sitedir, 'index.html' ).exists();
> > > +assert new File( sitedir, 'checkstyle.html' ).exists();
> > > +assert new File( sitedir, 'cpd.html' ).exists();
> > > +assert new File( sitedir, 'apidocs/index.html' ).exists();
> > > +assert new File( sitedir,
> > > 'apidocs/org/apache/maven/plugins/site/its/App.html' ).exists();
> > > +assert new File( sitedir, 'cobertura/index.html' ).exists();
> > > +assert new File( sitedir, 'xref/index.html' ).exists();
> > > +assert new File( sitedir, 'xref-test/index.html' ).exists();
> > > 
> > > -assert new File( basedir, 'target/site/dependencies.html' ).exists();
> > > -content = new File( basedir, 'target/site/dependencies.html' ).text;
> > > +assert new File( sitedir, 'taglist.html' ).exists();
> > > +assert new File( sitedir, 'team-list.html' ).exists();
> > > +
> > > +assert new File( sitedir, 'dependencies.html' ).exists();
> > > +content = new File( sitedir, 'dependencies.html' ).text;
> > > 
> > >  assert content.contains( 'junit:junit:jar:3.8.2' );
> > > 
> > > +// check reports order
> > > +String[] reports = [ 'index',                  //
> > > <report>index</report> +                     'project-summary',       
> > > //
> > > <report>summary</report> +                     'license',
> > > // <report>license</report> +                     'team-list',
> > > 
> > >    // <report>project-team</report> +
> > > 
> > > 'source-repository',      // <report>scm</report> +
> > > 'issue-tracking',         // <report>issue-tracking</report> +
> > > 
> > >           'mail-lists',             // <report>mailing-list</report> +
> > >           
> > >                   'dependencies',           //
> > > 
> > > <report>dependencies</report> +                     'integration',
> > > 
> > >      // <report>cim</report> +                     'plugin-management',
> > >     
> > >     // <report>plugin-management</report> +
> > > 
> > > 'plugins'                 // <report>plugins</report> +
> > > 
> > >  ];
> > > 
> > > +String info = new File( sitedir, 'project-info.html' ).text;
> > > +int index1 = 10;
> > > +int index2 = 10;
> > > +String previousReportLink;
> > > +for ( String report : reports )
> > > +{
> > > +    File reportFile = new File( sitedir, report + ".html" );
> > > +    if ( !reportFile.isFile() )
> > > +    {
> > > +        println "Report file not existent: $reportFile";
> > > +        return false;
> > > +    }
> > > +
> > > +    String link = "<a href=\"" + reportFile.getName() + "\"";
> > > +    int i1 = info.indexOf( link );
> > > +    int i2 = info.indexOf( link, i1 + 1 );
> > > +    if ( i1 < index1 )
> > > +    {
> > > +        println "Wrong order for first report link: expected
> > > $previousReportLink -> $link, but found $i1 < $index1"; +       
> > > println "   previous report link: " + info.substring( index1 - 10,
> > > index1 + 70 ); +        println "     actual report link: " +
> > > info.substring( i1 - 10, i1 + 70 ); +        //return false; // does
> > > not work with Maven 2.2 for the moment +    }
> > > +    if ( i2 < index2 )
> > > +    {
> > > +        println "Wrong order for second report link: expected
> > > $previousReportLink -> $link, but found $i2 < $index2"; +       
> > > println "   previous report link: " + info.substring( index2 - 10,
> > > index2 + 70 ); +        println "     actual report link: " +
> > > info.substring( i2 - 10, i2 + 70 ); +        //return false; // does
> > > not work with Maven 2.2 for the moment +    }
> > > +    index1 = i1;
> > > +    index2 = i2;
> > > +    previousReportLink = link;
> > > +}
> > > +
> > > 
> > >  return true;
> > > 
> > > \ No newline at end of file
> > > 
> > > Modified:
> > > maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/pl
> > > u gins/site/AbstractSiteRenderingMojo.java URL:
> > > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/
> > > m
> > > ain/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?
> > > rev =1150948&r1=1150947&r2=1150948&view=diff
> > > =======================================================================
> > > = ====== ---
> > > maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/pl
> > > u gins/site/AbstractSiteRenderingMojo.java (original) +++
> > > maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/pl
> > > u gins/site/AbstractSiteRenderingMojo.java Mon Jul 25 22:57:29 2011 @@
> > > -26,6 +26,7 @@ import java.util.ArrayList;
> > > 
> > >  import java.util.Collection;
> > >  import java.util.HashMap;
> > >  import java.util.Iterator;
> > > 
> > > +import java.util.LinkedHashMap;
> > > 
> > >  import java.util.List;
> > >  import java.util.Locale;
> > >  import java.util.Map;
> > > 
> > > @@ -389,7 +390,7 @@ public abstract class AbstractSiteRender
> > > 
> > >          // copy Collection to prevent ConcurrentModificationException
> > >          List<MavenReportExecution> filtered = new
> > >          ArrayList<MavenReportExecution>( reports );
> > > 
> > > -        Map<String, MavenReport> reportsByOutputName = new
> > > HashMap<String, MavenReport>(); +        Map<String, MavenReport>
> > > reportsByOutputName = new LinkedHashMap<String, MavenReport>();
> > > 
> > >          for ( MavenReportExecution mavenReportExecution : filtered )
> > >          {
> > >          
> > >              MavenReport report =
> > >              mavenReportExecution.getMavenReport();
> > > 
> > > @@ -426,7 +427,7 @@ public abstract class AbstractSiteRender
> > > 
> > >       */
> > >      
> > >      protected Map<String, List<MavenReport>> categoriseReports(
> > >      Collection<MavenReport> reports ) {
> > > 
> > > -        Map<String, List<MavenReport>> categories = new
> > > HashMap<String, List<MavenReport>>(); +        Map<String,
> > > List<MavenReport>> categories = new LinkedHashMap<String,
> > > List<MavenReport>>();
> > > 
> > >          for ( MavenReport report : reports )
> > >          {
> > >          
> > >              List<MavenReport> categoryReports = categories.get(
> > >              report.getCategoryName() );
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org


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


Re: svn commit: r1150948 - in /maven/plugins/trunk/maven-site-plugin: pom.xml src/it/full-reporting/pom.xml src/it/full-reporting/verify.groovy src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java

Posted by Hervé BOUTEMY <he...@free.fr>.
I still need to investigate what's happenning with m-site-p 2.3 and Maven 2.2

yes, it's better to have same behaviour with every Maven version
I'll work on it tomorrow

Regards,

Hervé

Le mercredi 27 juillet 2011, Dennis Lundberg a écrit :
> Hervé,
> 
> Do you have an idea how to fix this for Maven 2?
> 
> If you don't, then I'd like to postpone this change to a time when we
> have a solution for Maven 2.
> 
> I feel that it is better (and easier) if this version of the plugin
> behaves the same (as much as possible) when it is run with Maven 2 and
> Maven 3.
> 
> On 2011-07-26 00:57, hboutemy@apache.org wrote:
> > Author: hboutemy
> > Date: Mon Jul 25 22:57:29 2011
> > New Revision: 1150948
> > 
> > URL: http://svn.apache.org/viewvc?rev=1150948&view=rev
> > Log:
> > [MSITE-402] ensure order of reports like defined in POM (works with Maven
> > 3 but not with Maven 2.2 for the moment)
> > 
> > Modified:
> >     maven/plugins/trunk/maven-site-plugin/pom.xml
> >     maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml
> >     maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.gr
> >     oovy
> >     maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven
> >     /plugins/site/AbstractSiteRenderingMojo.java
> > 
> > Modified: maven/plugins/trunk/maven-site-plugin/pom.xml
> > URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/pom.x
> > ml?rev=1150948&r1=1150947&r2=1150948&view=diff
> > ========================================================================
> > ====== --- maven/plugins/trunk/maven-site-plugin/pom.xml (original)
> > +++ maven/plugins/trunk/maven-site-plugin/pom.xml Mon Jul 25 22:57:29
> > 2011 @@ -205,7 +205,7 @@ under the License.
> > 
> >      <dependency>
> >      
> >        <groupId>org.apache.maven.reporting</groupId>
> >        <artifactId>maven-reporting-exec</artifactId>
> > 
> > -      <version>1.0</version>
> > +      <version>1.0.1-SNAPSHOT</version>
> > 
> >      </dependency>
> >      
> >      <!-- Maven -->
> > 
> > Modified:
> > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/i
> > t/full-reporting/pom.xml?rev=1150948&r1=1150947&r2=1150948&view=diff
> > ========================================================================
> > ====== ---
> > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml
> > (original) +++
> > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml Mon
> > Jul 25 22:57:29 2011 @@ -65,6 +65,23 @@
> > 
> >            <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
> >            <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
> >          
> >          </configuration>
> > 
> > +        <reportSets>
> > +          <reportSet>
> > +            <reports>
> > +              <report>index</report>
> > +              <report>summary</report>
> > +              <report>license</report>
> > +              <report>project-team</report>
> > +              <report>scm</report>
> > +              <report>issue-tracking</report>
> > +              <report>mailing-list</report>
> > +              <report>dependencies</report>
> > +              <report>cim</report>
> > +              <report>plugin-management</report>
> > +              <report>plugins</report>
> > +            </reports>
> > +          </reportSet>
> > +        </reportSets>
> > 
> >        </plugin>
> >        <plugin>
> >        
> >          <groupId>org.apache.maven.plugins</groupId>
> > 
> > Modified:
> > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groov
> > y URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/i
> > t/full-reporting/verify.groovy?rev=1150948&r1=1150947&r2=1150948&view=dif
> > f
> > ========================================================================
> > ====== ---
> > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groov
> > y (original) +++
> > maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groov
> > y Mon Jul 25 22:57:29 2011 @@ -25,21 +25,71 @@ assert content.contains(
> > 'Test set: org.
> > 
> >  assert content.contains( 'Tests run: 1, Failures: 0, Errors: 0, Skipped:
> >  0' );
> > 
> > -assert new File( basedir, 'target/site/surefire-report.html' ).exists();
> > -assert new File( basedir, 'target/site/index.html' ).exists();
> > -assert new File( basedir, 'target/site/checkstyle.html' ).exists();
> > -assert new File( basedir, 'target/site/cpd.html' ).exists();
> > -assert new File( basedir, 'target/site/apidocs/index.html' ).exists();
> > -assert new File( basedir,
> > 'target/site/apidocs/org/apache/maven/plugins/site/its/App.html'
> > ).exists(); -assert new File( basedir,
> > 'target/site/cobertura/index.html' ).exists(); -assert new File(
> > basedir, 'target/site/xref/index.html' ).exists(); -assert new File(
> > basedir, 'target/site/xref-test/index.html' ).exists(); +sitedir = new
> > File( basedir, 'target/site' );
> > 
> > -assert new File( basedir, 'target/site/taglist.html' ).exists();
> > -assert new File( basedir, 'target/site/team-list.html' ).exists();
> > +assert new File( sitedir, 'surefire-report.html' ).exists();
> > +assert new File( sitedir, 'index.html' ).exists();
> > +assert new File( sitedir, 'checkstyle.html' ).exists();
> > +assert new File( sitedir, 'cpd.html' ).exists();
> > +assert new File( sitedir, 'apidocs/index.html' ).exists();
> > +assert new File( sitedir,
> > 'apidocs/org/apache/maven/plugins/site/its/App.html' ).exists(); +assert
> > new File( sitedir, 'cobertura/index.html' ).exists();
> > +assert new File( sitedir, 'xref/index.html' ).exists();
> > +assert new File( sitedir, 'xref-test/index.html' ).exists();
> > 
> > -assert new File( basedir, 'target/site/dependencies.html' ).exists();
> > -content = new File( basedir, 'target/site/dependencies.html' ).text;
> > +assert new File( sitedir, 'taglist.html' ).exists();
> > +assert new File( sitedir, 'team-list.html' ).exists();
> > +
> > +assert new File( sitedir, 'dependencies.html' ).exists();
> > +content = new File( sitedir, 'dependencies.html' ).text;
> > 
> >  assert content.contains( 'junit:junit:jar:3.8.2' );
> > 
> > +// check reports order
> > +String[] reports = [ 'index',                  // <report>index</report>
> > +                     'project-summary',        //
> > <report>summary</report> +                     'license',               
> > // <report>license</report> +                     'team-list',          
> >    // <report>project-team</report> +                    
> > 'source-repository',      // <report>scm</report> +                    
> > 'issue-tracking',         // <report>issue-tracking</report> +          
> >           'mail-lists',             // <report>mailing-list</report> +  
> >                   'dependencies',           //
> > <report>dependencies</report> +                     'integration',      
> >      // <report>cim</report> +                     'plugin-management', 
> >     // <report>plugin-management</report> +                    
> > 'plugins'                 // <report>plugins</report> +                 
> >  ];
> > +String info = new File( sitedir, 'project-info.html' ).text;
> > +int index1 = 10;
> > +int index2 = 10;
> > +String previousReportLink;
> > +for ( String report : reports )
> > +{
> > +    File reportFile = new File( sitedir, report + ".html" );
> > +    if ( !reportFile.isFile() )
> > +    {
> > +        println "Report file not existent: $reportFile";
> > +        return false;
> > +    }
> > +
> > +    String link = "<a href=\"" + reportFile.getName() + "\"";
> > +    int i1 = info.indexOf( link );
> > +    int i2 = info.indexOf( link, i1 + 1 );
> > +    if ( i1 < index1 )
> > +    {
> > +        println "Wrong order for first report link: expected
> > $previousReportLink -> $link, but found $i1 < $index1"; +        println
> > "   previous report link: " + info.substring( index1 - 10, index1 + 70
> > ); +        println "     actual report link: " + info.substring( i1 -
> > 10, i1 + 70 ); +        //return false; // does not work with Maven 2.2
> > for the moment +    }
> > +    if ( i2 < index2 )
> > +    {
> > +        println "Wrong order for second report link: expected
> > $previousReportLink -> $link, but found $i2 < $index2"; +        println
> > "   previous report link: " + info.substring( index2 - 10, index2 + 70
> > ); +        println "     actual report link: " + info.substring( i2 -
> > 10, i2 + 70 ); +        //return false; // does not work with Maven 2.2
> > for the moment +    }
> > +    index1 = i1;
> > +    index2 = i2;
> > +    previousReportLink = link;
> > +}
> > +
> > 
> >  return true;
> > 
> > \ No newline at end of file
> > 
> > Modified:
> > maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plu
> > gins/site/AbstractSiteRenderingMojo.java URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/m
> > ain/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?rev
> > =1150948&r1=1150947&r2=1150948&view=diff
> > ========================================================================
> > ====== ---
> > maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plu
> > gins/site/AbstractSiteRenderingMojo.java (original) +++
> > maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plu
> > gins/site/AbstractSiteRenderingMojo.java Mon Jul 25 22:57:29 2011 @@
> > -26,6 +26,7 @@ import java.util.ArrayList;
> > 
> >  import java.util.Collection;
> >  import java.util.HashMap;
> >  import java.util.Iterator;
> > 
> > +import java.util.LinkedHashMap;
> > 
> >  import java.util.List;
> >  import java.util.Locale;
> >  import java.util.Map;
> > 
> > @@ -389,7 +390,7 @@ public abstract class AbstractSiteRender
> > 
> >          // copy Collection to prevent ConcurrentModificationException
> >          List<MavenReportExecution> filtered = new
> >          ArrayList<MavenReportExecution>( reports );
> > 
> > -        Map<String, MavenReport> reportsByOutputName = new
> > HashMap<String, MavenReport>(); +        Map<String, MavenReport>
> > reportsByOutputName = new LinkedHashMap<String, MavenReport>();
> > 
> >          for ( MavenReportExecution mavenReportExecution : filtered )
> >          {
> >          
> >              MavenReport report = mavenReportExecution.getMavenReport();
> > 
> > @@ -426,7 +427,7 @@ public abstract class AbstractSiteRender
> > 
> >       */
> >      
> >      protected Map<String, List<MavenReport>> categoriseReports(
> >      Collection<MavenReport> reports ) {
> > 
> > -        Map<String, List<MavenReport>> categories = new HashMap<String,
> > List<MavenReport>>(); +        Map<String, List<MavenReport>> categories
> > = new LinkedHashMap<String, List<MavenReport>>();
> > 
> >          for ( MavenReport report : reports )
> >          {
> >          
> >              List<MavenReport> categoryReports = categories.get(
> >              report.getCategoryName() );


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


Re: svn commit: r1150948 - in /maven/plugins/trunk/maven-site-plugin: pom.xml src/it/full-reporting/pom.xml src/it/full-reporting/verify.groovy src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java

Posted by Dennis Lundberg <de...@apache.org>.
Hervé,

Do you have an idea how to fix this for Maven 2?

If you don't, then I'd like to postpone this change to a time when we
have a solution for Maven 2.

I feel that it is better (and easier) if this version of the plugin
behaves the same (as much as possible) when it is run with Maven 2 and
Maven 3.

On 2011-07-26 00:57, hboutemy@apache.org wrote:
> Author: hboutemy
> Date: Mon Jul 25 22:57:29 2011
> New Revision: 1150948
> 
> URL: http://svn.apache.org/viewvc?rev=1150948&view=rev
> Log:
> [MSITE-402] ensure order of reports like defined in POM (works with Maven 3 but not with Maven 2.2 for the moment)
> 
> Modified:
>     maven/plugins/trunk/maven-site-plugin/pom.xml
>     maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml
>     maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy
>     maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
> 
> Modified: maven/plugins/trunk/maven-site-plugin/pom.xml
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/pom.xml?rev=1150948&r1=1150947&r2=1150948&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-site-plugin/pom.xml (original)
> +++ maven/plugins/trunk/maven-site-plugin/pom.xml Mon Jul 25 22:57:29 2011
> @@ -205,7 +205,7 @@ under the License.
>      <dependency>
>        <groupId>org.apache.maven.reporting</groupId>
>        <artifactId>maven-reporting-exec</artifactId>
> -      <version>1.0</version>
> +      <version>1.0.1-SNAPSHOT</version>
>      </dependency>
>  
>      <!-- Maven -->
> 
> Modified: maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml?rev=1150948&r1=1150947&r2=1150948&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml (original)
> +++ maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/pom.xml Mon Jul 25 22:57:29 2011
> @@ -65,6 +65,23 @@
>            <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
>            <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
>          </configuration>
> +        <reportSets>
> +          <reportSet>
> +            <reports>
> +              <report>index</report>
> +              <report>summary</report>
> +              <report>license</report>
> +              <report>project-team</report>
> +              <report>scm</report>
> +              <report>issue-tracking</report>
> +              <report>mailing-list</report>
> +              <report>dependencies</report>
> +              <report>cim</report>
> +              <report>plugin-management</report>
> +              <report>plugins</report>
> +            </reports>
> +          </reportSet>
> +        </reportSets>
>        </plugin>
>        <plugin>
>          <groupId>org.apache.maven.plugins</groupId>
> 
> Modified: maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy?rev=1150948&r1=1150947&r2=1150948&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy (original)
> +++ maven/plugins/trunk/maven-site-plugin/src/it/full-reporting/verify.groovy Mon Jul 25 22:57:29 2011
> @@ -25,21 +25,71 @@ assert content.contains( 'Test set: org.
>  
>  assert content.contains( 'Tests run: 1, Failures: 0, Errors: 0, Skipped: 0' );
>  
> -assert new File( basedir, 'target/site/surefire-report.html' ).exists();
> -assert new File( basedir, 'target/site/index.html' ).exists();
> -assert new File( basedir, 'target/site/checkstyle.html' ).exists();
> -assert new File( basedir, 'target/site/cpd.html' ).exists();
> -assert new File( basedir, 'target/site/apidocs/index.html' ).exists();
> -assert new File( basedir, 'target/site/apidocs/org/apache/maven/plugins/site/its/App.html' ).exists();
> -assert new File( basedir, 'target/site/cobertura/index.html' ).exists();
> -assert new File( basedir, 'target/site/xref/index.html' ).exists();
> -assert new File( basedir, 'target/site/xref-test/index.html' ).exists();
> +sitedir = new File( basedir, 'target/site' );
>  
> -assert new File( basedir, 'target/site/taglist.html' ).exists();
> -assert new File( basedir, 'target/site/team-list.html' ).exists();
> +assert new File( sitedir, 'surefire-report.html' ).exists();
> +assert new File( sitedir, 'index.html' ).exists();
> +assert new File( sitedir, 'checkstyle.html' ).exists();
> +assert new File( sitedir, 'cpd.html' ).exists();
> +assert new File( sitedir, 'apidocs/index.html' ).exists();
> +assert new File( sitedir, 'apidocs/org/apache/maven/plugins/site/its/App.html' ).exists();
> +assert new File( sitedir, 'cobertura/index.html' ).exists();
> +assert new File( sitedir, 'xref/index.html' ).exists();
> +assert new File( sitedir, 'xref-test/index.html' ).exists();
>  
> -assert new File( basedir, 'target/site/dependencies.html' ).exists();
> -content = new File( basedir, 'target/site/dependencies.html' ).text;
> +assert new File( sitedir, 'taglist.html' ).exists();
> +assert new File( sitedir, 'team-list.html' ).exists();
> +
> +assert new File( sitedir, 'dependencies.html' ).exists();
> +content = new File( sitedir, 'dependencies.html' ).text;
>  assert content.contains( 'junit:junit:jar:3.8.2' );
>  
> +// check reports order
> +String[] reports = [ 'index',                  // <report>index</report>
> +                     'project-summary',        // <report>summary</report>
> +                     'license',                // <report>license</report>
> +                     'team-list',              // <report>project-team</report>
> +                     'source-repository',      // <report>scm</report>
> +                     'issue-tracking',         // <report>issue-tracking</report>
> +                     'mail-lists',             // <report>mailing-list</report>
> +                     'dependencies',           // <report>dependencies</report>
> +                     'integration',            // <report>cim</report>
> +                     'plugin-management',      // <report>plugin-management</report>
> +                     'plugins'                 // <report>plugins</report>
> +                   ];
> +String info = new File( sitedir, 'project-info.html' ).text;
> +int index1 = 10;
> +int index2 = 10;
> +String previousReportLink;
> +for ( String report : reports )
> +{
> +    File reportFile = new File( sitedir, report + ".html" );
> +    if ( !reportFile.isFile() )
> +    {
> +        println "Report file not existent: $reportFile";
> +        return false;
> +    }
> +
> +    String link = "<a href=\"" + reportFile.getName() + "\"";
> +    int i1 = info.indexOf( link );
> +    int i2 = info.indexOf( link, i1 + 1 );
> +    if ( i1 < index1 )
> +    {
> +        println "Wrong order for first report link: expected $previousReportLink -> $link, but found $i1 < $index1";
> +        println "   previous report link: " + info.substring( index1 - 10, index1 + 70 );
> +        println "     actual report link: " + info.substring( i1 - 10, i1 + 70 );
> +        //return false; // does not work with Maven 2.2 for the moment
> +    }
> +    if ( i2 < index2 )
> +    {
> +        println "Wrong order for second report link: expected $previousReportLink -> $link, but found $i2 < $index2";
> +        println "   previous report link: " + info.substring( index2 - 10, index2 + 70 );
> +        println "     actual report link: " + info.substring( i2 - 10, i2 + 70 );
> +        //return false; // does not work with Maven 2.2 for the moment
> +    }
> +    index1 = i1;
> +    index2 = i2;
> +    previousReportLink = link;
> +}
> +
>  return true;
> \ No newline at end of file
> 
> Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?rev=1150948&r1=1150947&r2=1150948&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java (original)
> +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java Mon Jul 25 22:57:29 2011
> @@ -26,6 +26,7 @@ import java.util.ArrayList;
>  import java.util.Collection;
>  import java.util.HashMap;
>  import java.util.Iterator;
> +import java.util.LinkedHashMap;
>  import java.util.List;
>  import java.util.Locale;
>  import java.util.Map;
> @@ -389,7 +390,7 @@ public abstract class AbstractSiteRender
>          // copy Collection to prevent ConcurrentModificationException
>          List<MavenReportExecution> filtered = new ArrayList<MavenReportExecution>( reports );
>  
> -        Map<String, MavenReport> reportsByOutputName = new HashMap<String, MavenReport>();
> +        Map<String, MavenReport> reportsByOutputName = new LinkedHashMap<String, MavenReport>();
>          for ( MavenReportExecution mavenReportExecution : filtered )
>          {
>              MavenReport report = mavenReportExecution.getMavenReport();
> @@ -426,7 +427,7 @@ public abstract class AbstractSiteRender
>       */
>      protected Map<String, List<MavenReport>> categoriseReports( Collection<MavenReport> reports )
>      {
> -        Map<String, List<MavenReport>> categories = new HashMap<String, List<MavenReport>>();
> +        Map<String, List<MavenReport>> categories = new LinkedHashMap<String, List<MavenReport>>();
>          for ( MavenReport report : reports )
>          {
>              List<MavenReport> categoryReports = categories.get( report.getCategoryName() );
> 
> 
> 


-- 
Dennis Lundberg

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