View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.shared.dependency.analyzer;
20  
21  import java.util.Collection;
22  
23  import org.apache.maven.project.MavenProject;
24  
25  /**
26   * Analyze a project's declared dependencies and effective classes used to find which artifacts are:
27   * <ul>
28   * <li>used and declared,</li>
29   * <li>used but not declared,</li>
30   * <li>not used but declared.</li>
31   * <li>used but declared in too broad a scope</li>
32   * </ul>
33   *
34   * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
35   */
36  public interface ProjectDependencyAnalyzer {
37  
38      /**
39       * <p>analyze.</p>
40       *
41       * @param project a {@link org.apache.maven.project.MavenProject} object
42       * @return a {@link org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis} object
43       * @throws org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException if any
44       */
45      default ProjectDependencyAnalysis analyze(MavenProject project) throws ProjectDependencyAnalyzerException {
46          return analyze(project, null);
47      }
48  
49      /**
50       * <p>analyze.</p>
51       *
52       * @param project a {@link org.apache.maven.project.MavenProject} object
53       * @param excludedClasses collection of regular expression of classes name to exclude
54       * @return a {@link org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis} object
55       * @throws org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException if any
56       */
57      ProjectDependencyAnalysis analyze(MavenProject project, Collection<String> excludedClasses)
58              throws ProjectDependencyAnalyzerException;
59  }