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
39 @Mojo( name = "failsafe-report-only" )
40 public class FailsafeReportMojo
41 extends AbstractSurefireReportMojo
42 {
43
44
45
46
47 @Parameter( defaultValue = "failsafe-report", property = "outputName", required = true )
48 private String outputName;
49
50
51
52
53
54
55 @Parameter( defaultValue = "false", property = "alwaysGenerateFailsafeReport" )
56 private boolean alwaysGenerateFailsafeReport;
57
58
59
60
61
62 @Parameter( defaultValue = "false", property = "skipFailsafeReport" )
63 private boolean skipFailsafeReport;
64
65 @Override
66 protected File getSurefireReportsDirectory( MavenProject subProject )
67 {
68 String buildDir = subProject.getBuild().getDirectory();
69 return new File( buildDir + "/failsafe-reports" );
70 }
71
72 @Override
73 public String getOutputName()
74 {
75 return outputName;
76 }
77
78 @Override
79 protected boolean isSkipped()
80 {
81 return skipFailsafeReport;
82 }
83
84 @Override
85 protected boolean isGeneratedWhenNoResults()
86 {
87 return alwaysGenerateFailsafeReport;
88 }
89
90
91
92
93 @Override
94 public String getName( Locale locale )
95 {
96 return getBundle( locale ).getString( "report.failsafe.name" );
97 }
98
99
100
101
102 @Override
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, getClass().getClassLoader() );
116 }
117 }