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 org.apache.maven.artifact.Artifact; 23 import org.apache.maven.artifact.resolver.ArtifactNotFoundException; 24 import org.apache.maven.artifact.resolver.ArtifactResolutionException; 25 import org.apache.maven.execution.MavenSession; 26 import org.apache.maven.project.MavenProject; 27 28 import java.util.Collection; 29 import java.util.Set; 30 31 /** 32 * Common interface for plugins and other third-party components running inside a Maven runtime to 33 * resolve the transitive dependency closure for various {@link MavenProject} instances. 34 * 35 * @author jdcasey 36 */ 37 // NOTE: The package specified for this interface is REQUIRED, since it must match Maven 3.x!! 38 public interface ProjectDependenciesResolver 39 { 40 /** 41 * Resolve the dependencies for a collection of {@link MavenProject} instances, using a common 42 * set of remote repositories and a common set of scopes. 43 * 44 * @param projects The projects whose dependencies should be resolved. 45 * @param scopes The list of scopes to resolve. These scopes may imply other scopes. 46 * @param session Contains the local repository, along with other settings related to artifact resolution. 47 * @return The set of resolved artifacts. If the projects contain no dependencies, this will return an empty set. 48 * @throws ArtifactResolutionException In case {@link Artifact} instances cannot be created from 49 * project {@link org.apache.maven.model.Dependency} instances, or artifact resolution fails. 50 * @throws ArtifactNotFoundException In cases where one or more dependency artifacts cannot be found in the 51 * various repositories. 52 */ 53 Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes, 54 MavenSession session ) 55 throws ArtifactResolutionException, ArtifactNotFoundException; 56 57 /** 58 * Resolve the dependencies for a single {@link MavenProject} instance, using the supplied 59 * set of remote repositories and scopes. 60 * 61 * @param project The project whose dependencies should be resolved. 62 * @param scopes The list of scopes to resolve. These scopes may imply other scopes. 63 * @param session Contains the local repository, along with other settings related to artifact resolution. 64 * @return The set of resolved artifacts. If the project contains no dependencies, this will return an empty set. 65 * @throws ArtifactResolutionException In case {@link Artifact} instances cannot be created from the 66 * project {@link org.apache.maven.model.Dependency} instance, or artifact resolution fails. 67 * @throws ArtifactNotFoundException In cases where one or more dependency artifacts cannot be found in the 68 * various repositories. 69 */ 70 Set<Artifact> resolve( MavenProject project, Collection<String> scopes, MavenSession session ) 71 throws ArtifactResolutionException, ArtifactNotFoundException; 72 }