View Javadoc
1   package org.apache.maven.shared.dependency.tree;
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.factory.ArtifactFactory;
23  import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
24  import org.apache.maven.artifact.repository.ArtifactRepository;
25  import org.apache.maven.artifact.resolver.ArtifactCollector;
26  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
27  import org.apache.maven.project.MavenProject;
28  
29  /**
30   * Builds a tree of dependencies for a given Maven 2 project. Notice that it doesn't fail with Maven 3, but when Maven 2
31   * and Maven 3 don't calculate the same transitive dependency result, the tree calculated with this component is
32   * consistent with Maven 2 even if run with Maven 3 (see <a
33   * href="http://jira.codehaus.org/browse/MSHARED-167">MSHARED-167</a>.
34   * 
35   * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
36   * @version $Id: DependencyTreeBuilder.java 1595871 2014-05-19 12:38:45Z jvanzyl $
37   */
38  public interface DependencyTreeBuilder
39  {
40      // fields -----------------------------------------------------------------
41  
42      /**
43       * The plexus role for this component.
44       */
45      String ROLE = DependencyTreeBuilder.class.getName();
46  
47      // public methods ---------------------------------------------------------
48  
49      /**
50       * Builds a tree of dependencies for the specified Maven project.
51       * 
52       * @param project the Maven project
53       * @param repository the artifact repository to resolve against
54       * @param factory the artifact factory to use
55       * @param metadataSource the artifact metadata source to use
56       * @param collector the artifact collector to use
57       * @return the dependency tree of the specified Maven project
58       * @throws DependencyTreeBuilderException if the dependency tree cannot be resolved
59       * @deprecated As of 1.1, replaced by
60       * {@link #buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource,
61       * ArtifactFilter, ArtifactCollector)}
62       */
63      DependencyTree buildDependencyTree( MavenProject project, ArtifactRepository repository, ArtifactFactory factory,
64                                          ArtifactMetadataSource metadataSource, ArtifactCollector collector )
65          throws DependencyTreeBuilderException;
66  
67      /**
68       * Builds a tree of dependencies for the specified Maven project.
69       * 
70       * @param project the Maven project
71       * @param repository the artifact repository to resolve against
72       * @param factory the artifact factory to use
73       * @param metadataSource the artifact metadata source to use
74       * @param filter the artifact filter to use
75       * @param collector the artifact collector to use
76       * @return the dependency tree root node of the specified Maven project
77       * @throws DependencyTreeBuilderException if the dependency tree cannot be resolved
78       * @since 1.1
79       */
80      DependencyNode buildDependencyTree( MavenProject project, ArtifactRepository repository, ArtifactFactory factory,
81                                          ArtifactMetadataSource metadataSource, ArtifactFilter filter,
82                                          ArtifactCollector collector )
83          throws DependencyTreeBuilderException;
84  
85      /**
86       * @deprecated doesn't work with Maven 3
87       */
88      DependencyNode buildDependencyTree( MavenProject project )
89          throws DependencyTreeBuilderException;
90  
91      /**
92       * @since 2.1
93       */
94      DependencyNode buildDependencyTree( MavenProject project, ArtifactRepository repository, ArtifactFilter filter )
95          throws DependencyTreeBuilderException;
96  }