View Javadoc
1   package org.apache.maven.shared.transfer.dependencies.resolve;
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.Collection;
23  
24  import org.apache.maven.model.Dependency;
25  import org.apache.maven.model.Model;
26  import org.apache.maven.project.ProjectBuildingRequest;
27  import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
28  import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult;
29  import org.apache.maven.shared.transfer.dependencies.DependableCoordinate;
30  
31  /**
32   * @author Robert Scholte
33   */
34  public interface DependencyResolver
35  {
36      /**
37       * This will resolve the dependencies of the coordinate, not resolving the the artifact of the coordinate itself. If
38       * the coordinate needs to be resolved too, use
39       * {@link #resolveDependencies(ProjectBuildingRequest, Collection, Collection, TransformableFilter)} passing
40       * {@code Collections.singletonList(coordinate)}
41       * 
42       * @param buildingRequest {@link ProjectBuildingRequest}
43       * @param coordinate {@link DependableCoordinate}
44       * @param filter {@link TransformableFilter} (can be {@code null}).
45       * @return the resolved dependencies.
46       * @throws DependencyResolverException in case of an error.
47       */
48      Iterable<ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest,
49                                                    DependableCoordinate coordinate, TransformableFilter filter )
50          throws DependencyResolverException;
51  
52      /**
53       * This will resolve the dependencies of the coordinate, not resolving the the artifact of the coordinate itself. If
54       * the coordinate needs to be resolved too, use
55       * {@link #resolveDependencies(ProjectBuildingRequest, Collection, Collection, TransformableFilter)} passing
56       * {@code Collections.singletonList(coordinate)}
57       * 
58       * @param buildingRequest {@link ProjectBuildingRequest}
59       * @param model {@link Model}
60       * @param filter {@link TransformableFilter} (can be {@code null}).
61       * @return the resolved dependencies.
62       * @throws DependencyResolverException in case of an error.
63       */
64      Iterable<ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest, Model model,
65                                                    TransformableFilter filter )
66          throws DependencyResolverException;
67  
68      /**
69       * @param buildingRequest the project building request, never {@code null}
70       * @param dependencies the dependencies to resolve, can be {@code null}
71       * @param managedDependencies managed dependencies, can be {@code null}
72       * @param filter a filter, can be {@code null}
73       * @return the resolved dependencies.
74       * @throws DependencyResolverException in case of an error.
75       */
76      Iterable<ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest,
77                                                    Collection<Dependency> dependencies,
78                                                    Collection<Dependency> managedDependencies,
79                                                    TransformableFilter filter )
80          throws DependencyResolverException;
81  }