1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.checkstyle;
20
21 import org.apache.maven.plugins.annotations.Mojo;
22 import org.apache.maven.plugins.annotations.ResolutionScope;
23 import org.apache.maven.plugins.checkstyle.exec.CheckstyleExecutorRequest;
24 import org.apache.maven.reporting.MavenReportException;
25
26
27
28
29
30
31
32
33 @Mojo(
34 name = "checkstyle-aggregate",
35 aggregator = true,
36 requiresDependencyResolution = ResolutionScope.COMPILE,
37 threadSafe = true)
38 public class CheckstyleAggregateReport extends AbstractCheckstyleReport {
39
40
41
42 protected CheckstyleExecutorRequest createRequest() throws MavenReportException {
43 CheckstyleExecutorRequest request = new CheckstyleExecutorRequest();
44 request.setAggregate(true)
45 .setReactorProjects(reactorProjects)
46 .setConsoleListener(getConsoleListener())
47 .setConsoleOutput(consoleOutput)
48 .setExcludes(excludes)
49 .setFailsOnError(failsOnError)
50 .setIncludes(includes)
51 .setResourceIncludes(resourceIncludes)
52 .setResourceExcludes(resourceExcludes)
53 .setIncludeResources(includeResources)
54 .setIncludeTestResources(includeTestResources)
55 .setIncludeTestSourceDirectory(includeTestSourceDirectory)
56 .setListener(getListener())
57 .setProject(project)
58 .setSourceDirectories(getSourceDirectories())
59 .setResources(resources)
60 .setTestResources(testResources)
61 .setStringOutputStream(stringOutputStream)
62 .setSuppressionsLocation(suppressionsLocation)
63 .setTestSourceDirectories(getTestSourceDirectories())
64 .setPropertyExpansion(propertyExpansion)
65 .setHeaderLocation(headerLocation)
66 .setCacheFile(cacheFile)
67 .setSuppressionsFileExpression(suppressionsFileExpression)
68 .setEncoding(getInputEncoding())
69 .setPropertiesLocation(propertiesLocation);
70 return request;
71 }
72
73
74 public String getOutputName() {
75 return "checkstyle-aggregate";
76 }
77
78
79 public boolean canGenerateReport() {
80
81 return !skip && project.isExecutionRoot() && reactorProjects.size() > 1;
82 }
83 }