1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.api;
20
21 import java.util.Collection;
22 import java.util.List;
23 import java.util.Optional;
24 import java.util.stream.Stream;
25
26 import org.apache.maven.api.annotations.Experimental;
27 import org.apache.maven.api.annotations.Immutable;
28 import org.apache.maven.api.annotations.Nonnull;
29 import org.apache.maven.api.model.Plugin;
30
31
32
33
34
35
36
37
38
39
40
41
42 @Experimental
43 @Immutable
44 public interface Lifecycle extends ExtensibleEnum {
45
46
47
48
49 String CLEAN = "clean";
50 String DEFAULT = "default";
51 String SITE = "site";
52
53
54
55
56 String BEFORE = "before:";
57 String AFTER = "after:";
58 String AT = "at:";
59
60
61
62
63
64
65 @Override
66 String id();
67
68
69
70
71 Collection<Phase> phases();
72
73
74
75
76 default Stream<Phase> allPhases() {
77 return phases().stream().flatMap(Phase::allPhases);
78 }
79
80
81
82
83 Collection<Alias> aliases();
84
85
86
87
88
89 default Optional<List<String>> orderedPhases() {
90 return Optional.empty();
91 }
92
93
94
95
96
97
98
99 interface Phase {
100
101
102
103
104 String BUILD = "build";
105 String INITIALIZE = "initialize";
106 String VALIDATE = "validate";
107 String SOURCES = "sources";
108 String RESOURCES = "resources";
109 String COMPILE = "compile";
110 String READY = "ready";
111 String PACKAGE = "package";
112 String VERIFY = "verify";
113 String UNIT_TEST = "unit-test";
114 String TEST_SOURCES = "test-sources";
115 String TEST_RESOURCES = "test-resources";
116 String TEST_COMPILE = "test-compile";
117 String TEST = "test";
118 String INTEGRATION_TEST = "integration-test";
119 String INSTALL = "install";
120 String DEPLOY = "deploy";
121 String CLEAN = "clean";
122
123 @Nonnull
124 String name();
125
126 @Nonnull
127 List<Plugin> plugins();
128
129 @Nonnull
130 Collection<Link> links();
131
132
133
134
135 @Nonnull
136 List<Phase> phases();
137
138 @Nonnull
139 Stream<Phase> allPhases();
140 }
141
142
143
144
145
146 interface Alias {
147 String v3Phase();
148
149 String v4Phase();
150 }
151
152
153
154
155
156
157 interface Link {
158 enum Kind {
159 BEFORE,
160 AFTER
161 }
162
163 Kind kind();
164
165 Pointer pointer();
166 }
167
168 interface Pointer {
169 enum Type {
170 PROJECT,
171 DEPENDENCIES,
172 CHILDREN
173 }
174
175 String phase();
176
177 Type type();
178 }
179
180 interface PhasePointer extends Pointer {
181 default Type type() {
182 return Type.PROJECT;
183 }
184 }
185
186 interface DependenciesPointer extends Pointer {
187 String scope();
188
189 default Type type() {
190 return Type.DEPENDENCIES;
191 }
192 }
193
194 interface ChildrenPointer extends Pointer {
195 default Type type() {
196 return Type.CHILDREN;
197 }
198 }
199 }