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