View Javadoc
1   package org.apache.maven.lifecycle;
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 org.apache.maven.execution.MavenSession;
23  import org.apache.maven.model.Plugin;
24  import org.apache.maven.plugin.InvalidPluginDescriptorException;
25  import org.apache.maven.plugin.MojoExecution;
26  import org.apache.maven.plugin.MojoNotFoundException;
27  import org.apache.maven.plugin.PluginDescriptorParsingException;
28  import org.apache.maven.plugin.PluginManagerException;
29  import org.apache.maven.plugin.PluginNotFoundException;
30  import org.apache.maven.plugin.PluginResolutionException;
31  import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
32  import org.apache.maven.plugin.version.PluginVersionResolutionException;
33  import org.apache.maven.project.MavenProject;
34  
35  import java.util.List;
36  import java.util.Set;
37  
38  /**
39   * A facade that provides lifecycle services to components outside Maven core.
40   *
41   * @author Jason van  Zyl
42   */
43  public interface LifecycleExecutor
44  {
45  
46      // USED BY MAVEN HELP PLUGIN
47      @Deprecated
48      String ROLE = LifecycleExecutor.class.getName();
49  
50      // For a given project packaging find all the plugins that are bound to any registered
51      // lifecycles. The project builder needs to now what default plugin information needs to be
52      // merged into POM being built. Once the POM builder has this plugin information, versions can be assigned
53      // by the POM builder because they will have to be defined in plugin management. Once this is setComplete then it
54      // can be passed back so that the default configuration information can be populated.
55      //
56      // We need to know the specific version so that we can lookup the right version of the plugin descriptor
57      // which tells us what the default configuration is.
58      //
59  
60      /**
61       * @return The plugins bound to the lifecycles of the specified packaging or {@code null} if the packaging is
62       *         unknown.
63       */
64      Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging );
65  
66      MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
67          throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
68          MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
69          PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
70          PluginVersionResolutionException;
71  
72      MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String... tasks )
73          throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
74          MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
75          PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
76          PluginVersionResolutionException;
77  
78      void execute( MavenSession session );
79  
80      // used by the site plugin 3.x
81      void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
82          throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
83          PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
84          LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;
85  
86      // used by the site plugin 3.x
87      List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session )
88          throws LifecycleExecutionException;
89  }