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 org.apache.maven.plugins.annotations.Execute;
24 import org.apache.maven.plugins.annotations.LifecyclePhase;
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 @Mojo(name = "report", inheritByDefault = false)
36 @Execute(lifecycle = "surefire", phase = LifecyclePhase.TEST)
37 public class SurefireReportMojo
38 extends AbstractSurefireReportMojo
39 {
40
41
42
43
44
45
46 @Parameter(defaultValue = "surefire-report", property = "outputName", required = true)
47 private String outputName;
48
49
50
51
52
53
54
55
56 @Parameter(defaultValue = "true", property = "alwaysGenerateSurefireReport")
57 private boolean alwaysGenerateSurefireReport;
58
59
60
61
62
63
64
65 @Parameter(defaultValue = "false", property = "skipSurefireReport")
66 private boolean skipSurefireReport;
67
68 protected File getSurefireReportsDirectory( MavenProject subProject )
69 {
70 String buildDir = subProject.getBuild().getDirectory();
71 return new File( buildDir + "/surefire-reports" );
72 }
73
74 public String getOutputName()
75 {
76 return outputName;
77 }
78
79 protected boolean isSkipped()
80 {
81 return skipSurefireReport;
82 }
83
84 protected boolean isGeneratedWhenNoResults()
85 {
86 return alwaysGenerateSurefireReport;
87 }
88 }