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