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 projects in their intended build order, i.e. after topologically sorting the projects according to their
37       * inter-dependencies.
38       *
39       * @return The projects in the build order, never {@code null}.
40       */
41      List<MavenProject> getSortedProjects();
42  
43      /**
44       * Gets the downstream projects of the specified project. A downstream project is a project that directly or
45       * indirectly depends on the given project.
46       *
47       * @param project The project whose downstream projects should be retrieved, must not be {@code null}.
48       * @param transitive A flag whether to retrieve all direct and indirect downstream projects or just the immediate
49       *            downstream projects.
50       * @return The downstream projects in the build order, never {@code null}.
51       */
52      List<MavenProject> getDownstreamProjects( MavenProject project, boolean transitive );
53  
54      /**
55       * Gets the upstream projects of the specified project. An upstream project is a project that directly or indirectly
56       * is a prerequisite of the given project.
57       *
58       * @param project The project whose upstream projects should be retrieved, must not be {@code null}.
59       * @param transitive A flag whether to retrieve all direct and indirect upstream projects or just the immediate
60       *            upstream projects.
61       * @return The upstream projects in the build order, never {@code null}.
62       */
63      List<MavenProject> getUpstreamProjects( MavenProject project, boolean transitive );
64  
65  }