View Javadoc

1   package org.apache.maven;
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  import java.util.Set;
24  
25  import org.apache.maven.artifact.Artifact;
26  import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
27  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
28  import org.apache.maven.execution.MavenSession;
29  import org.apache.maven.project.MavenProject;
30  
31  public interface ProjectDependenciesResolver
32  {
33  
34      /**
35       * Resolves the transitive dependencies of the specified project.
36       *
37       * @param project         The project whose dependencies should be resolved, must not be {@code null}.
38       * @param scopesToResolve The dependency scopes that should be resolved, may be {@code null}.
39       * @param session         The current build session, must not be {@code null}.
40       * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}.
41       */
42      Set<Artifact> resolve( MavenProject project, Collection<String> scopesToResolve, MavenSession session )
43          throws ArtifactResolutionException, ArtifactNotFoundException;
44  
45      /**
46       * Resolves the transitive dependencies of the specified project.
47       *
48       * @param project         The project whose dependencies should be resolved, must not be {@code null}.
49       * @param scopesToCollect The dependency scopes that should be collected, may be {@code null}.
50       * @param scopesToResolve The dependency scopes that should be collected and also resolved, may be {@code null}.
51       * @param session         The current build session, must not be {@code null}.
52       * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}.
53       */
54      Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect,
55                             Collection<String> scopesToResolve, MavenSession session )
56          throws ArtifactResolutionException, ArtifactNotFoundException;
57  
58      /**
59       * Resolves the transitive dependencies of the specified project.
60       *
61       * @param project             The project whose dependencies should be resolved, must not be {@code null}.
62       * @param scopesToCollect     The dependency scopes that should be collected, may be {@code null}.
63       * @param scopesToResolve     The dependency scopes that should be collected and also resolved, may be {@code null}.
64       * @param session             The current build session, must not be {@code null}.
65       * @param ignoreableArtifacts Artifacts that need not be resolved
66       * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}.
67       */
68      Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect,
69                             Collection<String> scopesToResolve, MavenSession session, Set<Artifact> ignoreableArtifacts )
70          throws ArtifactResolutionException, ArtifactNotFoundException;
71  
72      /**
73       * Resolves the transitive dependencies of the specified projects. Note that dependencies which can't be resolved
74       * from any repository but are present among the set of specified projects will not cause an exception. Instead,
75       * those unresolved artifacts will be returned in the result set, allowing the caller to take special care of
76       * artifacts that haven't been build yet.
77       *
78       * @param projects The projects whose dependencies should be resolved, may be {@code null}.
79       * @param scopes   The dependency scopes that should be resolved, may be {@code null}.
80       * @param session  The current build session, must not be {@code null}.
81       * @return The transitive dependencies of the specified projects that match the requested scopes, never {@code null}
82       *         .
83       */
84      Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes, MavenSession session )
85          throws ArtifactResolutionException, ArtifactNotFoundException;
86  
87  }