001 package org.apache.maven; 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022 import java.util.Collection; 023 import java.util.Set; 024 025 import org.apache.maven.artifact.Artifact; 026 import org.apache.maven.artifact.resolver.ArtifactNotFoundException; 027 import org.apache.maven.artifact.resolver.ArtifactResolutionException; 028 import org.apache.maven.execution.MavenSession; 029 import org.apache.maven.project.MavenProject; 030 031 public interface ProjectDependenciesResolver 032 { 033 034 /** 035 * Resolves the transitive dependencies of the specified project. 036 * 037 * @param project The project whose dependencies should be resolved, must not be {@code null}. 038 * @param scopesToResolve The dependency scopes that should be resolved, may be {@code null}. 039 * @param session The current build session, must not be {@code null}. 040 * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. 041 */ 042 Set<Artifact> resolve( MavenProject project, Collection<String> scopesToResolve, MavenSession session ) 043 throws ArtifactResolutionException, ArtifactNotFoundException; 044 045 /** 046 * Resolves the transitive dependencies of the specified project. 047 * 048 * @param project The project whose dependencies should be resolved, must not be {@code null}. 049 * @param scopesToCollect The dependency scopes that should be collected, may be {@code null}. 050 * @param scopesToResolve The dependency scopes that should be collected and also resolved, may be {@code null}. 051 * @param session The current build session, must not be {@code null}. 052 * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. 053 */ 054 Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect, 055 Collection<String> scopesToResolve, MavenSession session ) 056 throws ArtifactResolutionException, ArtifactNotFoundException; 057 058 /** 059 * Resolves the transitive dependencies of the specified project. 060 * 061 * @param project The project whose dependencies should be resolved, must not be {@code null}. 062 * @param scopesToCollect The dependency scopes that should be collected, may be {@code null}. 063 * @param scopesToResolve The dependency scopes that should be collected and also resolved, may be {@code null}. 064 * @param session The current build session, must not be {@code null}. 065 * @param ignoreableArtifacts Artifacts that need not be resolved 066 * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. 067 */ 068 Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect, 069 Collection<String> scopesToResolve, MavenSession session, Set<Artifact> ignoreableArtifacts ) 070 throws ArtifactResolutionException, ArtifactNotFoundException; 071 072 073 /** 074 * Resolves the transitive dependencies of the specified projects. Note that dependencies which can't be resolved 075 * from any repository but are present among the set of specified projects will not cause an exception. Instead, 076 * those unresolved artifacts will be returned in the result set, allowing the caller to take special care of 077 * artifacts that haven't been build yet. 078 * 079 * @param projects The projects whose dependencies should be resolved, may be {@code null}. 080 * @param scopes The dependency scopes that should be resolved, may be {@code null}. 081 * @param session The current build session, must not be {@code null}. 082 * @return The transitive dependencies of the specified projects that match the requested scopes, never {@code null} 083 * . 084 */ 085 Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes, MavenSession session ) 086 throws ArtifactResolutionException, ArtifactNotFoundException; 087 088 }