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
FieldsModifier and TypeFieldDescriptionprivate org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverprivate Fileprivate Stringprivate org.apache.maven.project.ProjectBuilderFields 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, typeFields inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
outputAbsoluteArtifactFilename, reactorProjects, sessionFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddParentArtifacts(org.apache.maven.project.MavenProject project, Set<org.apache.maven.artifact.Artifact> artifacts) Adds parent artifacts.private org.apache.maven.project.MavenProjectbuildProjectFromArtifact(org.apache.maven.artifact.Artifact artifact) Creates a maven project instance from the given artifact.private voidcollectDependencies(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 ofartwith artifacts taken fromcoordMappingwriting not so far known results toartifacts.private StringgetCoordinate(org.apache.maven.artifact.Artifact artifact) Returns the coordinate ofartifact.private StringgetCoordinate(org.apache.maven.model.Dependency dependency) Returns the coordinate ofdependency.protected org.apache.maven.plugins.dependency.utils.DependencyStatusSetsgetDependencySets(boolean stopOnFailure, boolean includeParents) voidsetOutputFile(File outputFile) voidsetPathSeparator(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, setStripVersionMethods inherited from class org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojo
filterMarkedDependencies, getArtifactResolver, getClassifierTranslatedDependencies, getDependencyResolver, getDependencySets, getMarkersDirectory, getRepositoryManager, getResolvedDependencies, isPrependGroupId, resolve, setMarkersDirectory, setPrependGroupIdMethods inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojo
copyFile, execute, getArchiverManager, getProject, isSilent, isSkip, isUseJvmChmod, newResolveArtifactProjectBuildingRequest, newResolvePluginProjectBuildingRequest, setArchiverManager, setSilent, setSkip, setUseJvmChmod, unpack, unpack, unpackMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
artifactResolver
@Component private org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver artifactResolver -
projectBuilder
@Component private org.apache.maven.project.ProjectBuilder projectBuilder -
outputFile
-
pathSeparator
@Parameter(property="mdep.pathSeparator", defaultValue="", required=true) private String pathSeparator -
rootCoordinates
-
-
Constructor Details
-
DiffClasspathMojo
public DiffClasspathMojo()
-
-
Method Details
-
setOutputFile
- Overrides:
setOutputFilein classorg.apache.maven.plugins.dependency.fromDependencies.BuildClasspathMojo
-
setPathSeparator
- Overrides:
setPathSeparatorin classorg.apache.maven.plugins.dependency.fromDependencies.BuildClasspathMojo
-
getCoordinate
Returns the coordinate ofartifact.- Parameters:
artifact- the artifact- Returns:
- the coordinate
-
getCoordinate
Returns the coordinate ofdependency.- 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.MojoExecutionExceptionCollects all transitive dependencies ofartwith artifacts taken fromcoordMappingwriting not so far known results toartifacts. There are for sure better ways...- Parameters:
artifact- the artifact to resolvecoordMapping- the coordinate-to-artifact mappingartifacts- 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:
getDependencySetsin classorg.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 fromAbstractDependencyMojoas 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 fromAbstractDependencyMojoas not accessible.- Parameters:
project- the project to take the artifacts fromartifacts- the artifacts set to be modified- Throws:
org.apache.maven.plugin.MojoExecutionException- in case that artifact resolution fails
-