Class ProjectDependencyAnalysis

java.lang.Object
org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis

public class ProjectDependencyAnalysis extends Object
Project dependencies analysis result.
Author:
Mark Hobson
  • Constructor Details

    • ProjectDependencyAnalysis

      public ProjectDependencyAnalysis()

      Constructor for ProjectDependencyAnalysis.

    • ProjectDependencyAnalysis

      public ProjectDependencyAnalysis(Set<org.apache.maven.artifact.Artifact> usedDeclaredArtifacts, Set<org.apache.maven.artifact.Artifact> usedUndeclaredArtifacts, Set<org.apache.maven.artifact.Artifact> unusedDeclaredArtifacts)

      Constructor for ProjectDependencyAnalysis to maintain compatibility with old API

      Parameters:
      usedDeclaredArtifacts - artifacts both used and declared
      usedUndeclaredArtifacts - artifacts used but not declared
      unusedDeclaredArtifacts - artifacts declared but not used
    • ProjectDependencyAnalysis

      public ProjectDependencyAnalysis(Set<org.apache.maven.artifact.Artifact> usedDeclaredArtifacts, Set<org.apache.maven.artifact.Artifact> usedUndeclaredArtifacts, Set<org.apache.maven.artifact.Artifact> unusedDeclaredArtifacts, Set<org.apache.maven.artifact.Artifact> testArtifactsWithNonTestScope)

      Constructor for ProjectDependencyAnalysis.

      Parameters:
      usedDeclaredArtifacts - artifacts both used and declared
      usedUndeclaredArtifacts - artifacts used but not declared
      unusedDeclaredArtifacts - artifacts declared but not used
      testArtifactsWithNonTestScope - artifacts only used in tests but not declared with test scope
    • ProjectDependencyAnalysis

      public ProjectDependencyAnalysis(Map<org.apache.maven.artifact.Artifact,Set<DependencyUsage>> usedDeclaredArtifacts, Map<org.apache.maven.artifact.Artifact,Set<DependencyUsage>> usedUndeclaredArtifacts, Set<org.apache.maven.artifact.Artifact> unusedDeclaredArtifacts, Set<org.apache.maven.artifact.Artifact> testArtifactsWithNonTestScope)
  • Method Details

    • getUsedDeclaredArtifacts

      public Set<org.apache.maven.artifact.Artifact> getUsedDeclaredArtifacts()
      Returns artifacts both used and declared.
      Returns:
      artifacts both used and declared
    • getUsedDeclaredArtifactsWithUsages

      public Map<org.apache.maven.artifact.Artifact,Set<DependencyUsage>> getUsedDeclaredArtifactsWithUsages()
      Returns artifacts both used and declared.
      Returns:
      artifacts both used and declared
    • getUsedUndeclaredArtifacts

      public Set<org.apache.maven.artifact.Artifact> getUsedUndeclaredArtifacts()
      Returns artifacts used but not declared.
      Returns:
      artifacts used but not declared
    • getUsedUndeclaredArtifactsWithClasses

      public Map<org.apache.maven.artifact.Artifact,Set<String>> getUsedUndeclaredArtifactsWithClasses()
      Returns artifacts used but not declared.
      Returns:
      artifacts used but not declared
    • getUsedUndeclaredArtifactsWithUsages

      public Map<org.apache.maven.artifact.Artifact,Set<DependencyUsage>> getUsedUndeclaredArtifactsWithUsages()
    • getUnusedDeclaredArtifacts

      public Set<org.apache.maven.artifact.Artifact> getUnusedDeclaredArtifacts()
      Returns artifacts declared but not used.
      Returns:
      artifacts declared but not used
    • getTestArtifactsWithNonTestScope

      public Set<org.apache.maven.artifact.Artifact> getTestArtifactsWithNonTestScope()
      Returns artifacts only used in tests but not declared with test scope.
      Returns:
      artifacts only used in tests but not declared with test scope
    • ignoreNonCompile

      public ProjectDependencyAnalysis ignoreNonCompile()
      Filter non-compile scoped artifacts from unused declared.
      Returns:
      updated project dependency analysis
      Since:
      1.3
    • forceDeclaredDependenciesUsage

      public ProjectDependencyAnalysis forceDeclaredDependenciesUsage(String[] forceUsedDependencies) throws ProjectDependencyAnalyzerException
      Force use status of some declared dependencies, to manually fix consequences of bytecode-level analysis which happens to not detect some effective use (constants, annotation with source-retention, javadoc).
      Parameters:
      forceUsedDependencies - dependencies to move from "unused-declared" to "used-declared", with groupId:artifactId format
      Returns:
      updated project dependency analysis
      Throws:
      ProjectDependencyAnalyzerException - if dependencies forced were either not declared or already detected as used
      Since:
      1.3
    • hashCode

      public int hashCode()

      hashCode.

      Overrides:
      hashCode in class Object
      Returns:
      an int
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • toString

      public String toString()

      toString.

      Overrides:
      toString in class Object
      Returns:
      a String object.