1 package org.apache.maven.plugins.surefire.report;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.Locale;
24 import java.util.ResourceBundle;
25 import org.apache.maven.plugins.annotations.Mojo;
26 import org.apache.maven.plugins.annotations.Parameter;
27 import org.apache.maven.project.MavenProject;
28
29
30
31
32
33
34
35
36
37
38 @Mojo( name = "failsafe-report-only" )
39 public class FailsafeReportMojo
40 extends AbstractSurefireReportMojo
41 {
42
43
44
45
46
47
48 @Parameter( defaultValue = "failsafe-report", property = "outputName", required = true )
49 private String outputName;
50
51
52
53
54
55
56
57
58 @Parameter( defaultValue = "false", property = "alwaysGenerateFailsafeReport" )
59 private boolean alwaysGenerateFailsafeReport;
60
61
62
63
64
65
66
67 @Parameter( defaultValue = "false", property = "skipFailsafeReport" )
68 private boolean skipFailsafeReport;
69
70 protected File getSurefireReportsDirectory( MavenProject subProject )
71 {
72 String buildDir = subProject.getBuild().getDirectory();
73 return new File( buildDir + "/failsafe-reports" );
74 }
75
76 public String getOutputName()
77 {
78 return outputName;
79 }
80
81 protected boolean isSkipped()
82 {
83 return skipFailsafeReport;
84 }
85
86 protected boolean isGeneratedWhenNoResults()
87 {
88 return alwaysGenerateFailsafeReport;
89 }
90
91
92
93
94 public String getName( Locale locale )
95 {
96 return getBundle( locale ).getString( "report.failsafe.name" );
97 }
98
99
100
101
102 public String getDescription( Locale locale )
103 {
104 return getBundle( locale ).getString( "report.failsafe.description" );
105 }
106
107
108
109
110
111
112 private ResourceBundle getBundle( Locale locale )
113 {
114 return ResourceBundle.getBundle( "surefire-report", locale, this.getClass().getClassLoader() );
115 }
116 }