1 package org.nuiton.config;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import org.apache.maven.artifact.DependencyResolutionRequiredException;
26 import org.apache.maven.plugins.annotations.Execute;
27 import org.apache.maven.plugins.annotations.LifecyclePhase;
28 import org.apache.maven.plugins.annotations.Mojo;
29 import org.apache.maven.plugins.annotations.Parameter;
30 import org.apache.maven.plugins.annotations.ResolutionScope;
31 import org.apache.maven.project.MavenProject;
32 import org.apache.maven.reporting.MavenReportException;
33
34 import java.util.HashSet;
35 import java.util.List;
36 import java.util.Set;
37
38
39
40
41
42
43
44
45
46
47 @Mojo(name = "aggregate-config-report", aggregator = true,
48 requiresProject = true, requiresReports = true,
49 requiresDependencyResolution = ResolutionScope.RUNTIME)
50 @Execute(phase = LifecyclePhase.COMPILE)
51 public class AggregateApplicationConfigReport extends AbstractApplicationConfigReport {
52
53
54
55
56
57
58 @Parameter(property = "reactorProjects", readonly = true, required = true)
59 protected List<?> reactorProjects;
60
61 @Override
62 protected ClassLoader createClassLoader() throws MavenReportException {
63 Set<String> paths = new HashSet<String>();
64
65 for (Object o : reactorProjects) {
66 MavenProject p = (MavenProject) o;
67 try {
68 List runtimeClasspathElements = p.getRuntimeClasspathElements();
69 paths.addAll(runtimeClasspathElements);
70 } catch (DependencyResolutionRequiredException e) {
71 throw new MavenReportException("Could not obtain dependencies for project " + p);
72 }
73 }
74 return createClassLoader(paths);
75 }
76 }