1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.lifecycle;
20
21 import java.util.List;
22 import java.util.Map;
23 import org.apache.maven.lifecycle.mapping.LifecyclePhase;
24
25 /**
26 * Lifecycle definition, with eventual plugin bindings (when they are not packaging-specific).
27 */
28 public class Lifecycle {
29 public Lifecycle() {}
30
31 public Lifecycle(String id, List<String> phases, Map<String, LifecyclePhase> defaultPhases) {
32 this.id = id;
33 this.phases = phases;
34 this.defaultPhases = defaultPhases;
35 }
36
37 // <lifecycle>
38 // <id>clean</id>
39 // <phases>
40 // <phase>pre-clean</phase>
41 // <phase>clean</phase>
42 // <phase>post-clean</phase>
43 // </phases>
44 // <default-phases>
45 // <clean>org.apache.maven.plugins:maven-clean-plugin:clean</clean>
46 // </default-phases>
47 // </lifecycle>
48
49 private String id;
50
51 private List<String> phases;
52
53 private Map<String, LifecyclePhase> defaultPhases;
54
55 public String getId() {
56 return this.id;
57 }
58
59 public List<String> getPhases() {
60 return this.phases;
61 }
62
63 public Map<String, LifecyclePhase> getDefaultLifecyclePhases() {
64 return defaultPhases;
65 }
66
67 @Deprecated
68 public Map<String, String> getDefaultPhases() {
69 return LifecyclePhase.toLegacyMap(getDefaultLifecyclePhases());
70 }
71
72 @Override
73 public String toString() {
74 return id + " -> " + phases;
75 }
76 }