Class DiffClasspathMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.dependency.AbstractDependencyMojo
org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojo
org.apache.maven.plugins.dependency.fromDependencies.BuildClasspathMojo
de.iip_ecosphere.platform.tools.maven.dependencies.DiffClasspathMojo
All Implemented Interfaces:
Comparator<org.apache.maven.artifact.Artifact>, org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="diff-classpath", requiresDependencyCollection=COMPILE_PLUS_RUNTIME, requiresDependencyResolution=COMPILE_PLUS_RUNTIME, defaultPhase=GENERATE_SOURCES, threadSafe=true) public class DiffClasspathMojo extends org.apache.maven.plugins.dependency.fromDependencies.BuildClasspathMojo
Reused build-classpath Mojo to write a diffed classpath from rootCoordinates and the containing project.
Author:
Holger Eichelberger, SSE
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver
     
    private File
     
    private String
     
    private org.apache.maven.project.ProjectBuilder
     
    private Set<String>
     

    Fields inherited from class org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojo

    classifier, excludeArtifactIds, excludeClassifiers, excludeGroupIds, excludeScope, excludeTransitive, excludeTypes, includeArtifactIds, includeClassifiers, includeGroupIds, includeScope, includeTypes, markersDirectory, overWriteIfNewer, overWriteReleases, overWriteSnapshots, prependGroupId, type

    Fields inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo

    outputAbsoluteArtifactFilename, reactorProjects, session

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    addParentArtifacts(org.apache.maven.project.MavenProject project, Set<org.apache.maven.artifact.Artifact> artifacts)
    Adds parent artifacts.
    private org.apache.maven.project.MavenProject
    buildProjectFromArtifact(org.apache.maven.artifact.Artifact artifact)
    Creates a maven project instance from the given artifact.
    private void
    collectDependencies(org.apache.maven.artifact.Artifact artifact, Map<String,org.apache.maven.artifact.Artifact> coordMapping, Set<org.apache.maven.artifact.Artifact> artifacts)
    Collects all transitive dependencies of art with artifacts taken from coordMapping writing not so far known results to artifacts.
    private String
    getCoordinate(org.apache.maven.artifact.Artifact artifact)
    Returns the coordinate of artifact.
    private String
    getCoordinate(org.apache.maven.model.Dependency dependency)
    Returns the coordinate of dependency.
    protected org.apache.maven.plugins.dependency.utils.DependencyStatusSets
    getDependencySets(boolean stopOnFailure, boolean includeParents)
     
    void
    setOutputFile(File outputFile)
     
    void
    setPathSeparator(String thePathSeparator)
     

    Methods inherited from class org.apache.maven.plugins.dependency.fromDependencies.BuildClasspathMojo

    appendArtifactPath, attachFile, compare, doExecute, getMarkedArtifactFilter, isStripVersion, readClasspathFile, setFileSeparator, setLocalRepoProperty, setOutputProperty, setPrefix, setRegenerateFile, setStripVersion

    Methods inherited from class org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojo

    filterMarkedDependencies, getArtifactResolver, getClassifierTranslatedDependencies, getDependencyResolver, getDependencySets, getMarkersDirectory, getRepositoryManager, getResolvedDependencies, isPrependGroupId, resolve, setMarkersDirectory, setPrependGroupId

    Methods inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo

    copyFile, execute, getArchiverManager, getProject, isSilent, isSkip, isUseJvmChmod, newResolveArtifactProjectBuildingRequest, newResolvePluginProjectBuildingRequest, setArchiverManager, setSilent, setSkip, setUseJvmChmod, unpack, unpack, unpack

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • artifactResolver

      @Component private org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver artifactResolver
    • projectBuilder

      @Component private org.apache.maven.project.ProjectBuilder projectBuilder
    • outputFile

      @Parameter(property="mdep.outputFile", required=true) private File outputFile
    • pathSeparator

      @Parameter(property="mdep.pathSeparator", defaultValue="", required=true) private String pathSeparator
    • rootCoordinates

      @Parameter(property="mdep.rootCoordinates", required=true) private Set<String> rootCoordinates
  • Constructor Details

    • DiffClasspathMojo

      public DiffClasspathMojo()
  • Method Details

    • setOutputFile

      public void setOutputFile(File outputFile)
      Overrides:
      setOutputFile in class org.apache.maven.plugins.dependency.fromDependencies.BuildClasspathMojo
    • setPathSeparator

      public void setPathSeparator(String thePathSeparator)
      Overrides:
      setPathSeparator in class org.apache.maven.plugins.dependency.fromDependencies.BuildClasspathMojo
    • getCoordinate

      private String getCoordinate(org.apache.maven.artifact.Artifact artifact)
      Returns the coordinate of artifact.
      Parameters:
      artifact - the artifact
      Returns:
      the coordinate
    • getCoordinate

      private String getCoordinate(org.apache.maven.model.Dependency dependency)
      Returns the coordinate of dependency.
      Parameters:
      dependency - the dependency
      Returns:
      the coordinate
    • collectDependencies

      private void collectDependencies(org.apache.maven.artifact.Artifact artifact, Map<String,org.apache.maven.artifact.Artifact> coordMapping, Set<org.apache.maven.artifact.Artifact> artifacts) throws org.apache.maven.plugin.MojoExecutionException
      Collects all transitive dependencies of art with artifacts taken from coordMapping writing not so far known results to artifacts. There are for sure better ways...
      Parameters:
      artifact - the artifact to resolve
      coordMapping - the coordinate-to-artifact mapping
      artifacts - the resulting artifacts containing the transitive dependencies, to be modified as a side effect
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if maven projects cannot be built from artifact information
    • getDependencySets

      protected org.apache.maven.plugins.dependency.utils.DependencyStatusSets getDependencySets(boolean stopOnFailure, boolean includeParents) throws org.apache.maven.plugin.MojoExecutionException
      Overrides:
      getDependencySets in class org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • buildProjectFromArtifact

      private org.apache.maven.project.MavenProject buildProjectFromArtifact(org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionException
      Creates a maven project instance from the given artifact. Taken over from AbstractDependencyMojo as not accessible.
      Parameters:
      artifact - the artifact
      Returns:
      the maven project
      Throws:
      org.apache.maven.plugin.MojoExecutionException - the project instance cannot be built
    • addParentArtifacts

      private void addParentArtifacts(org.apache.maven.project.MavenProject project, Set<org.apache.maven.artifact.Artifact> artifacts) throws org.apache.maven.plugin.MojoExecutionException
      Adds parent artifacts. Taken over from AbstractDependencyMojo as not accessible.
      Parameters:
      project - the project to take the artifacts from
      artifacts - the artifacts set to be modified
      Throws:
      org.apache.maven.plugin.MojoExecutionException - in case that artifact resolution fails