1 package org.apache.maven.shared.dependency.graph; 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.resolver.filter.ArtifactFilter; 23 import org.apache.maven.project.MavenProject; 24 import org.apache.maven.project.ProjectBuildingRequest; 25 26 import java.util.Collection; 27 28 /** 29 * Maven project dependency graph builder API, neutral against Maven 2 or Maven 3. 30 * 31 * @author Hervé Boutemy 32 * @since 2.0 33 */ 34 public interface DependencyGraphBuilder 35 { 36 /** 37 * Build the dependency graph. 38 * 39 * @param buildingRequest the buildingRequest 40 * @param filter artifact filter (can be <code>null</code>) 41 * @return the dependency graph 42 * @throws DependencyGraphBuilderException if some of the dependencies could not be resolved. 43 */ 44 DependencyNode buildDependencyGraph( ProjectBuildingRequest buildingRequest, ArtifactFilter filter ) 45 throws DependencyGraphBuilderException; 46 47 /** 48 * Build the dependency graph, with a hack to include dependencies contained in the reactor projects 49 * but that are not yet compiled, which is the minimum prerequisite for Maven core's 50 * ReactorReader to find them. Notice that this hack hasn't been done for Maven 2. 51 * <p>Notice: If Maven core did collect instead of resolving dependencies (ie did not try to get the 52 * artifacts but only the poms), probably this hack wouldn't be necessary even for people requiring 53 * the dependency graph before compiling. TODO: for Maven 3, use Aether to collect dependencies.</p> 54 * 55 * @param buildingRequest the buildingRequest 56 * @param filter artifact filter (can be <code>null</code>) 57 * @param reactorProjects Collection of those projects contained in the reactor (can be <code>null</code>). 58 * @return the dependency graph 59 * @throws DependencyGraphBuilderException if some of the dependencies could not be resolved. 60 */ 61 DependencyNode buildDependencyGraph( ProjectBuildingRequest buildingRequest, ArtifactFilter filter, 62 Collection<MavenProject> reactorProjects ) 63 throws DependencyGraphBuilderException; 64 }