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