View Javadoc
1   package org.apache.maven.shared.release.phase;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import javax.inject.Inject;
23  import javax.inject.Named;
24  import javax.inject.Singleton;
25  
26  import java.util.List;
27  import java.util.Map;
28  
29  import org.apache.maven.project.MavenProject;
30  import org.apache.maven.shared.release.ReleaseExecutionException;
31  import org.apache.maven.shared.release.ReleaseResult;
32  import org.apache.maven.shared.release.config.ReleaseDescriptor;
33  import org.apache.maven.shared.release.env.ReleaseEnvironment;
34  import org.apache.maven.shared.release.exec.MavenExecutor;
35  
36  /**
37   * Run the completion goals for the project to before committing the continuing development stream.
38   *
39   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
40   * @author <a href="mailto:stephenc@apache.org">Stephen Connolly</a>
41   */
42  @Singleton
43  @Named( "run-completion-goals" )
44  public class RunCompleteGoalsPhase
45          extends AbstractRunGoalsPhase
46  {
47      @Inject
48      public RunCompleteGoalsPhase( Map<String, MavenExecutor> mavenExecutors )
49      {
50          super( mavenExecutors );
51      }
52  
53      @Override
54      public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment,
55                                    List<MavenProject> reactorProjects )
56              throws ReleaseExecutionException
57      {
58          return execute( releaseDescriptor, releaseEnvironment, reactorProjects, false );
59      }
60  
61      @Override
62      public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment,
63                                     List<MavenProject> reactorProjects )
64              throws ReleaseExecutionException
65      {
66          ReleaseResult result = new ReleaseResult();
67  
68          logInfo( result, "Executing completion goals - since this is simulation mode it is running against the "
69                  + "original project, not the rewritten ones" );
70  
71          execute( releaseDescriptor, releaseEnvironment, reactorProjects, true );
72  
73          return result;
74      }
75  
76      @Override
77      protected String getGoals( ReleaseDescriptor releaseDescriptor )
78      {
79          return releaseDescriptor.getCompletionGoals();
80      }
81  }