1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.lifecycle.internal;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
25 import org.apache.maven.model.Plugin;
26 import org.apache.maven.plugin.MojoExecution;
27 import org.apache.maven.plugin.descriptor.MojoDescriptor;
28 import org.apache.maven.project.MavenProject;
29
30
31
32
33
34
35
36
37
38
39 public class ExecutionPlanItem {
40 private final MojoExecution mojoExecution;
41
42 public ExecutionPlanItem(MojoExecution mojoExecution) {
43 this.mojoExecution = mojoExecution;
44 }
45
46 public static List<ExecutionPlanItem> createExecutionPlanItems(
47 MavenProject mavenProject, List<MojoExecution> executions) {
48 BuilderCommon.attachToThread(mavenProject);
49
50 List<ExecutionPlanItem> result = new ArrayList<>();
51 for (MojoExecution mojoExecution : executions) {
52 result.add(new ExecutionPlanItem(mojoExecution));
53 }
54 return result;
55 }
56
57 public MojoExecution getMojoExecution() {
58 return mojoExecution;
59 }
60
61 public String getLifecyclePhase() {
62 return mojoExecution.getLifecyclePhase();
63 }
64
65 public Plugin getPlugin() {
66 final MojoDescriptor mojoDescriptor = getMojoExecution().getMojoDescriptor();
67 return mojoDescriptor.getPluginDescriptor().getPlugin();
68 }
69
70 @Override
71 public String toString() {
72 return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + '}' + super.toString();
73 }
74 }