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 the result isn't reliable.
32   * 
33   * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
34   * @version $Id: DependencyTreeBuilder.java 1365319 2012-07-24 21:59:14Z hboutemy $
35   */
36  public interface DependencyTreeBuilder
37  {
38      // fields -----------------------------------------------------------------
39  
40      /**
41       * The plexus role for this component.
42       */
43      String ROLE = DependencyTreeBuilder.class.getName();
44  
45      // public methods ---------------------------------------------------------
46  
47      /**
48       * Builds a tree of dependencies for the specified Maven project.
49       * 
50       * @param project
51       *            the Maven project
52       * @param repository
53       *            the artifact repository to resolve against
54       * @param factory
55       *            the artifact factory to use
56       * @param metadataSource
57       *            the artifact metadata source to use
58       * @param collector
59       *            the artifact collector to use
60       * @return the dependency tree of the specified Maven project
61       * @throws DependencyTreeBuilderException
62       *             if the dependency tree cannot be resolved
63       * @deprecated As of 1.1, replaced by
64       *             {@link #buildDependencyTree(MavenProject, ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, ArtifactCollector)}
65       */
66      DependencyTree buildDependencyTree( MavenProject project, ArtifactRepository repository, ArtifactFactory factory,
67                                          ArtifactMetadataSource metadataSource, ArtifactCollector collector )
68          throws DependencyTreeBuilderException;
69  
70      /**
71       * Builds a tree of dependencies for the specified Maven project.
72       * 
73       * @param project
74       *            the Maven project
75       * @param repository
76       *            the artifact repository to resolve against
77       * @param factory
78       *            the artifact factory to use
79       * @param metadataSource
80       *            the artifact metadata source to use
81       * @param filter
82       *            the artifact filter to use
83       * @param collector
84       *            the artifact collector to use
85       * @return the dependency tree root node of the specified Maven project
86       * @throws DependencyTreeBuilderException
87       *             if the dependency tree cannot be resolved
88       * @since 1.1
89       */
90      DependencyNode buildDependencyTree( MavenProject project, ArtifactRepository repository, ArtifactFactory factory,
91                                          ArtifactMetadataSource metadataSource, ArtifactFilter filter,
92                                          ArtifactCollector collector )
93          throws DependencyTreeBuilderException;
94  
95      DependencyNode buildDependencyTree( MavenProject project )
96          throws DependencyTreeBuilderException;
97  }