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.shared.dependency.graph;
20  
21  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
22  import org.apache.maven.project.ProjectBuildingRequest;
23  
24  /**
25   * Maven project dependency raw dependency collector API, providing an abstraction layer against Maven 3 and Maven 3.1+
26   * particular Aether implementations.
27   *
28   * @author Gabriel Belingueres
29   * @since 3.1.0
30   */
31  public interface DependencyCollectorBuilder {
32  
33      /**
34       * collect the project's raw dependency graph, with information to allow the API client to reason on its own about
35       * dependencies.
36       *
37       * @param buildingRequest the request with the project to process its dependencies.
38       * @param filter an artifact filter if not all dependencies are required (can be <code>null</code>)
39       * @return the raw dependency tree
40       * @throws DependencyCollectorBuilderException if some of the dependencies could not be collected.
41       */
42      default DependencyNode collectDependencyGraph(ProjectBuildingRequest buildingRequest, ArtifactFilter filter)
43              throws DependencyCollectorBuilderException {
44          return collectDependencyGraph(new DependencyCollectorRequest(buildingRequest, filter));
45      }
46  
47      /**
48       * collect the project's raw dependency graph, with information to allow the API client to reason on its own about
49       * dependencies.
50       *
51       * @param dependencyCollectorRequest the request with different paramaters.
52       * @return the raw dependency tree
53       * @throws DependencyCollectorBuilderException if some of the dependencies could not be collected.
54       * @since 3.2.1
55       */
56      DependencyNode collectDependencyGraph(DependencyCollectorRequest dependencyCollectorRequest)
57              throws DependencyCollectorBuilderException;
58  }