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,
31   * but when Maven 2 and Maven 3 don't calculate the same transitive dependency result, the tree calculated
32   * with this component is consistent with Maven 2 even if run with Maven 3 (see
33   * <a 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 1478591 2013-05-02 22:39:51Z hboutemy $
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
53       *            the Maven project
54       * @param repository
55       *            the artifact repository to resolve against
56       * @param factory
57       *            the artifact factory to use
58       * @param metadataSource
59       *            the artifact metadata source to use
60       * @param collector
61       *            the artifact collector to use
62       * @return the dependency tree of the specified Maven project
63       * @throws DependencyTreeBuilderException
64       *             if the dependency tree cannot be resolved
65       * @deprecated As of 1.1, replaced by
66       *             {@link #buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)}
67       */
68      DependencyTree buildDependencyTree( MavenProject project, ArtifactRepository repository, ArtifactFactory factory,
69                                          ArtifactMetadataSource metadataSource, ArtifactCollector collector )
70          throws DependencyTreeBuilderException;
71  
72      /**
73       * Builds a tree of dependencies for the specified Maven project.
74       * 
75       * @param project
76       *            the Maven project
77       * @param repository
78       *            the artifact repository to resolve against
79       * @param factory
80       *            the artifact factory to use
81       * @param metadataSource
82       *            the artifact metadata source to use
83       * @param filter
84       *            the artifact filter to use
85       * @param collector
86       *            the artifact collector to use
87       * @return the dependency tree root node of the specified Maven project
88       * @throws DependencyTreeBuilderException
89       *             if the dependency tree cannot be resolved
90       * @since 1.1
91       */
92      DependencyNode buildDependencyTree( MavenProject project, ArtifactRepository repository, ArtifactFactory factory,
93                                          ArtifactMetadataSource metadataSource, ArtifactFilter filter,
94                                          ArtifactCollector collector )
95          throws DependencyTreeBuilderException;
96  
97      /**
98       * @deprecated doesn't work with Maven 3
99       */
100     DependencyNode buildDependencyTree( MavenProject project )
101         throws DependencyTreeBuilderException;
102 
103     /**
104      * @since 2.1
105      */
106     DependencyNode buildDependencyTree( MavenProject project, ArtifactRepository repository, ArtifactFilter filter )
107         throws DependencyTreeBuilderException;
108 }