1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.surefire.report;
20
21 import javax.inject.Inject;
22
23 import java.io.File;
24
25 import org.apache.maven.plugins.annotations.Mojo;
26 import org.apache.maven.plugins.annotations.Parameter;
27 import org.apache.maven.project.MavenProject;
28 import org.codehaus.plexus.i18n.I18N;
29
30
31
32
33
34
35
36
37
38
39 @Mojo(name = "failsafe-report-only")
40 @SuppressWarnings("unused")
41 public class FailsafeOnlyReport extends AbstractSurefireReport {
42
43
44
45
46 @Parameter(defaultValue = "failsafe", property = "outputName", required = true)
47 private String outputName;
48
49
50
51
52
53
54 @Parameter(defaultValue = "false", property = "alwaysGenerateFailsafeReport")
55 private boolean alwaysGenerateFailsafeReport;
56
57
58
59
60
61 @Parameter(defaultValue = "false", property = "skipFailsafeReport")
62 private boolean skipFailsafeReport;
63
64 @Inject
65 public FailsafeOnlyReport(I18N i18n) {
66 super(i18n);
67 }
68
69 @Override
70 protected File getSurefireReportsDirectory(MavenProject subProject) {
71 String buildDir = subProject.getBuild().getDirectory();
72 return new File(buildDir, "failsafe-reports");
73 }
74
75 @Override
76 public String getOutputName() {
77 return outputName;
78 }
79
80 @Override
81 protected boolean isSkipped() {
82 return skipFailsafeReport;
83 }
84
85 @Override
86 protected boolean isGeneratedWhenNoResults() {
87 return alwaysGenerateFailsafeReport;
88 }
89
90 @Override
91 protected String getI18Nsection() {
92 return "failsafe";
93 }
94 }