View Javadoc

1   package org.apache.maven.plugins.surefire.report;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.File;
23  import java.util.ArrayList;
24  import java.util.Arrays;
25  import java.util.Iterator;
26  import java.util.List;
27  import java.util.Locale;
28  import java.util.ResourceBundle;
29  
30  import org.apache.maven.doxia.siterenderer.Renderer;
31  import org.apache.maven.model.ReportPlugin;
32  import org.apache.maven.project.MavenProject;
33  import org.apache.maven.reporting.AbstractMavenReport;
34  import org.apache.maven.reporting.MavenReportException;
35  import org.codehaus.plexus.util.PathTool;
36  import org.codehaus.plexus.util.StringUtils;
37  
38  
39  /**
40   * Creates a nicely formatted Surefire Test Report in html format.
41   *
42   * @author <a href="mailto:jruiz@exist.com">Johnny R. Ruiz III</a>
43   * @version $Id: SurefireReportMojo.java 1144289 2011-07-08 12:39:32Z stephenc $
44   * @goal report
45   * @execute phase="test" lifecycle="surefire"
46   */
47  public class SurefireReportMojo
48      extends AbstractSurefireReportMojo
49  {
50  
51      /**
52       * The filename to use for the report.
53       *
54       * @parameter expression="${outputName}" default-value="surefire-report"
55       * @required
56       * @noinspection UnusedDeclaration
57       */
58      private String outputName;
59  
60      protected File getSurefireReportsDirectory( MavenProject subProject )
61      {
62          String buildDir = subProject.getBuild().getDirectory();
63          return new File( buildDir + "/surefire-reports" );
64      }
65  
66      public String getOutputName()
67      {
68          return outputName;
69      }
70  
71  }