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.execution;
20  
21  import java.util.List;
22  import org.apache.maven.project.MavenProject;
23  
24  /**
25   * Describes the interdependencies between projects in the reactor.
26   *
27   * @author Benjamin Bentmann
28   * @since 3.0-alpha
29   */
30  public interface ProjectDependencyGraph {
31  
32      /**
33       * Gets all collected projects.
34       *
35       * @return All collected projects.
36       *
37       * @since 3.5.0
38       */
39      List<MavenProject> getAllProjects();
40  
41      /**
42       * Gets all projects in their intended build order, i.e. after topologically sorting the projects according to their
43       * interdependencies.
44       *
45       * @return The projects in the build order, never {@code null}.
46       */
47      List<MavenProject> getSortedProjects();
48  
49      /**
50       * Gets the downstream projects of the specified project. A downstream project is a project that directly or
51       * indirectly depends on the given project.
52       *
53       * @param project The project whose downstream projects should be retrieved, must not be {@code null}.
54       * @param transitive A flag whether to retrieve all direct and indirect downstream projects or just the immediate
55       *            downstream projects.
56       * @return The downstream projects in the build order, never {@code null}.
57       */
58      List<MavenProject> getDownstreamProjects(MavenProject project, boolean transitive);
59  
60      /**
61       * Gets the upstream projects of the specified project. An upstream project is a project that directly or indirectly
62       * is a prerequisite of the given project.
63       *
64       * @param project The project whose upstream projects should be retrieved, must not be {@code null}.
65       * @param transitive A flag whether to retrieve all direct and indirect upstream projects or just the immediate
66       *            upstream projects.
67       * @return The upstream projects in the build order, never {@code null}.
68       */
69      List<MavenProject> getUpstreamProjects(MavenProject project, boolean transitive);
70  }