maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r594596 - /maven/surefire/branches/surefire-2.3.x/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
Date Tue, 13 Nov 2007 18:02:13 GMT
Author: brett
Date: Tue Nov 13 10:02:13 2007
New Revision: 594596

URL: http://svn.apache.org/viewvc?rev=594596&view=rev
Log:
[SUREFIRE-357] Java language constraint is a poor criteria for surefire report generation
Submitted by: David Cardon
Merged from trunk rev: 594595

Modified:
    maven/surefire/branches/surefire-2.3.x/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java

Modified: maven/surefire/branches/surefire-2.3.x/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/branches/surefire-2.3.x/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java?rev=594596&r1=594595&r2=594596&view=diff
==============================================================================
--- maven/surefire/branches/surefire-2.3.x/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
(original)
+++ maven/surefire/branches/surefire-2.3.x/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
Tue Nov 13 10:02:13 2007
@@ -19,17 +19,19 @@
  * under the License.
  */
 
-import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.reporting.AbstractMavenReport;
 import org.apache.maven.reporting.MavenReportException;
 import org.codehaus.doxia.site.renderer.SiteRenderer;
+import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.PathTool;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
@@ -195,8 +197,19 @@
      */
     public boolean canGenerateReport()
     {
-        // Only execute reports for java projects
-        ArtifactHandler artifactHandler = this.project.getArtifact().getArtifactHandler();
-        return "java".equals( artifactHandler.getLanguage() );
+        try
+        {
+            if ( reportsDirectory.exists() && reportsDirectory.isDirectory() )
+            {
+                List fileList = FileUtils.getFileNames( reportsDirectory, "**/TEST-*.xml",
"", true );
+                return !fileList.isEmpty();
+            }
+        }
+        catch ( IOException e )
+        {
+            getLog().error( "Error accessing reports directory!" );
+        }
+        
+        return false;
     }
 }



Mime
View raw message