View Javadoc
1   package org.eclipse.aether.graph;
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  /**
25   * A cycle within a dependency graph, that is a sequence of dependencies d_1, d_2, ..., d_n where d_1 and d_n have the
26   * same versionless coordinates. In more practical terms, a cycle occurs when a project directly or indirectly depends
27   * on its own output artifact.
28   * 
29   * @noimplement This interface is not intended to be implemented by clients.
30   * @noextend This interface is not intended to be extended by clients.
31   */
32  public interface DependencyCycle
33  {
34  
35      /**
36       * Gets the dependencies that lead to the first dependency on the cycle, starting from the root of the dependency
37       * graph.
38       * 
39       * @return The (read-only) sequence of dependencies that precedes the cycle in the graph, potentially empty but
40       *         never {@code null}.
41       */
42      List<Dependency> getPrecedingDependencies();
43  
44      /**
45       * Gets the dependencies that actually form the cycle. For example, a -&gt; b -&gt; c -&gt; a, i.e. the last
46       * dependency in this sequence duplicates the first element and closes the cycle. Hence the length of the cycle is
47       * the size of the returned sequence minus 1.
48       * 
49       * @return The (read-only) sequence of dependencies that forms the cycle, never {@code null}.
50       */
51      List<Dependency> getCyclicDependencies();
52  
53  }