Class ArtifactTransitivityFilter

    • Constructor Detail

      • ArtifactTransitivityFilter

        public ArtifactTransitivityFilter​(Artifact artifact,
                                          ProjectBuildingRequest buildingRequest,
                                          ProjectBuilder projectBuilder)
                                   throws ProjectBuildingException

        Use MavenSession.getProjectBuildingRequest() to get the buildingRequest. The projectBuilder should be resolved with CDI.

           // For Mojo
           @Component
           private ProjectBuilder projectBuilder;
        
           // For Components
           @Requirement // or @Inject
           private ProjectBuilder projectBuilder;
         
        Parameters:
        artifact - the artifact to resolve the dependencies from
        buildingRequest - the buildingRequest
        projectBuilder - the projectBuilder
        Throws:
        ProjectBuildingException - if the project descriptor could not be successfully built
    • Method Detail

      • isMaven31

        protected static boolean isMaven31()
        Returns:
        true if the current Maven version is Maven 3.1.
      • filter

        public java.util.Set<Artifact> filter​(java.util.Set<Artifact> artifacts)
        Parameters:
        artifacts - Artifact
        Returns:
        Set of artifacts.
      • artifactIsATransitiveDependency

        public boolean artifactIsATransitiveDependency​(Artifact artifact)
        Compares the artifact to the list of dependencies to see if it is directly included by this project
        Parameters:
        artifact - representing the item to compare.
        Returns:
        true if artifact is a transitive dependency