View Javadoc
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.shared.release.strategies;
20  
21  import javax.inject.Named;
22  import javax.inject.Singleton;
23  
24  import java.util.Arrays;
25  import java.util.Collections;
26  import java.util.List;
27  
28  import org.apache.maven.shared.release.strategy.Strategy;
29  
30  /**
31   * <p>DefaultStrategy class.</p>
32   *
33   * @author Robert Scholte
34   * @since 3.0.0-M5
35   */
36  @Singleton
37  @Named
38  public class DefaultStrategy implements Strategy {
39      /**
40       * The phases of release to run to prepare.
41       */
42      private final List<String> preparePhases;
43  
44      /**
45       * The phases of release to run to perform.
46       */
47      private final List<String> performPhases;
48  
49      /**
50       * The phases of release to run to rollback changes
51       */
52      private final List<String> rollbackPhases;
53  
54      /**
55       * The phases to create a branch.
56       */
57      private final List<String> branchPhases;
58  
59      /**
60       * The phases to create update versions.
61       */
62      private final List<String> updateVersionsPhases;
63  
64      public DefaultStrategy() {
65          this.preparePhases = Collections.unmodifiableList(Arrays.asList(
66                  // START SNIPPET: prepare
67                  "check-poms",
68                  "scm-check-modifications",
69                  "check-dependency-snapshots",
70                  "create-backup-poms",
71                  "map-release-versions",
72                  "input-variables",
73                  "map-development-versions",
74                  "rewrite-poms-for-release",
75                  "generate-release-poms",
76                  "run-preparation-goals",
77                  "scm-commit-release",
78                  "scm-tag",
79                  "rewrite-poms-for-development",
80                  "remove-release-poms",
81                  "run-completion-goals",
82                  "scm-commit-development",
83                  "end-release"
84                  // END SNIPPET: prepare
85                  ));
86          this.performPhases = Collections.unmodifiableList(Arrays.asList(
87                  // START SNIPPET: perform
88                  "verify-completed-prepare-phases", "checkout-project-from-scm", "run-perform-goals"
89                  // END SNIPPET: perform
90                  ));
91          this.rollbackPhases = Collections.unmodifiableList(Arrays.asList(
92                  // START SNIPPET: rollback
93                  "restore-backup-poms", "scm-commit-rollback", "remove-scm-tag"
94                  // END SNIPPET: rollback
95                  ));
96          this.branchPhases = Collections.unmodifiableList(Arrays.asList(
97                  // START SNIPPET: branch
98                  "check-poms",
99                  "scm-check-modifications",
100                 "create-backup-poms",
101                 "map-branch-versions",
102                 "branch-input-variables",
103                 "map-development-versions",
104                 "rewrite-poms-for-branch",
105                 "scm-commit-branch",
106                 "scm-branch",
107                 "rewrite-poms-for-development",
108                 "scm-commit-development",
109                 "end-release"
110                 // END SNIPPET: branch
111                 ));
112         this.updateVersionsPhases = Collections.unmodifiableList(Arrays.asList(
113                 // START SNIPPET: update-versions
114                 "check-poms-updateversions", "create-backup-poms", "map-development-versions", "rewrite-pom-versions"
115                 // END SNIPPET: update-versions
116                 ));
117     }
118 
119     @Override
120     public final List<String> getPreparePhases() {
121         return preparePhases;
122     }
123 
124     @Override
125     public List<String> getPerformPhases() {
126         return performPhases;
127     }
128 
129     @Override
130     public List<String> getRollbackPhases() {
131         return rollbackPhases;
132     }
133 
134     @Override
135     public List<String> getBranchPhases() {
136         return branchPhases;
137     }
138 
139     @Override
140     public List<String> getUpdateVersionsPhases() {
141         return updateVersionsPhases;
142     }
143 }