Class BuildClasspathMojo
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
- All Implemented Interfaces:
- Comparator<org.apache.maven.artifact.Artifact>,- org.apache.maven.plugin.ContextEnabled,- org.apache.maven.plugin.Mojo
@Mojo(name="build-classpath",
      requiresDependencyResolution=TEST,
      defaultPhase=GENERATE_SOURCES,
      threadSafe=true)
public class BuildClasspathMojo
extends AbstractDependencyFilterMojo
implements Comparator<org.apache.maven.artifact.Artifact>
This goal outputs a classpath string of dependencies from the local repository to a file or log.
- Since:
- 2.0-alpha-2
- Author:
- ankostis
- 
Field SummaryFields inherited from class org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojoclassifier, 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.AbstractDependencyMojoreactorProjects, sessionFields inherited from interface org.apache.maven.plugin.MojoROLE
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedBuildClasspathMojo(org.apache.maven.execution.MavenSession session, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.project.MavenProject project, ResolverUtil resolverUtil, org.apache.maven.project.ProjectBuilder projectBuilder, org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager, org.apache.maven.project.MavenProjectHelper projectHelper) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidappendArtifactPath(org.apache.maven.artifact.Artifact art, StringBuilder sb) Appends the artifact path to the specified StringBuilder.protected voidattachFile(String cpString) intcompare(org.apache.maven.artifact.Artifact art1, org.apache.maven.artifact.Artifact art2) Compares artifacts lexicographically, using pattern [group_id][artifact_id][version].protected voidMain entry into mojo.protected org.apache.maven.shared.artifact.filter.collection.ArtifactsFilterReturn anArtifactsFilterindicating which artifacts must be filtered out.booleanprotected StringReads the file specified by the mojo param 'outputFile' into a string.voidsetFileSeparator(String theFileSeparator) voidsetLocalRepoProperty(String localRepoProperty) voidsetOutputFile(File outputFile) voidsetOutputProperty(String theOutputProperty) voidsetPathSeparator(String thePathSeparator) voidvoidsetRegenerateFile(boolean theRegenerateFile) voidsetStripVersion(boolean theStripVersion) Methods inherited from class org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojofilterMarkedDependencies, getDependencySets, getDependencySets, getMarkersDirectory, getResolvedDependencies, getResolverUtil, isPrependGroupId, setMarkersDirectory, setPrependGroupIdMethods inherited from class org.apache.maven.plugins.dependency.AbstractDependencyMojoexecute, getProject, isSilent, isSkip, setSilent, setSkipMethods inherited from class org.apache.maven.plugin.AbstractMojogetLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparatorequals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
- 
Constructor Details- 
BuildClasspathMojo@Inject protected BuildClasspathMojo(org.apache.maven.execution.MavenSession session, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.project.MavenProject project, ResolverUtil resolverUtil, org.apache.maven.project.ProjectBuilder projectBuilder, org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager, org.apache.maven.project.MavenProjectHelper projectHelper) 
 
- 
- 
Method Details- 
doExecuteprotected void doExecute() throws org.apache.maven.plugin.MojoExecutionExceptionMain entry into mojo. Gets the list of dependencies and iterates to create a classpath.- Specified by:
- doExecutein class- AbstractDependencyMojo
- Throws:
- org.apache.maven.plugin.MojoExecutionException- with a message if an error occurs
- See Also:
 
- 
attachFile- Parameters:
- cpString- the classpath
- Throws:
- org.apache.maven.plugin.MojoExecutionException- in case of an error
 
- 
appendArtifactPathAppends the artifact path to the specified StringBuilder.- Parameters:
- art-- Artifact
- sb-- StringBuilder
 
- 
readClasspathFileReads the file specified by the mojo param 'outputFile' into a string. Assumes the field 'outputFile' is not null.- Returns:
- the string contained in the classpathFile, if it exists, or null otherwise
- Throws:
- IOException- in case of an error
 
- 
comparepublic int compare(org.apache.maven.artifact.Artifact art1, org.apache.maven.artifact.Artifact art2) Compares artifacts lexicographically, using pattern [group_id][artifact_id][version].- Specified by:
- comparein interface- Comparator<org.apache.maven.artifact.Artifact>
- Parameters:
- art1- first object
- art2- second object
- Returns:
- the value 0if the argument string is equal to this string; a value less than0if this string is lexicographically less than the string argument; and a value greater than0if this string is lexicographically greater than the string argument
 
- 
getMarkedArtifactFilterprotected org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter getMarkedArtifactFilter()Description copied from class:AbstractDependencyFilterMojoReturn anArtifactsFilterindicating which artifacts must be filtered out.- Specified by:
- getMarkedArtifactFilterin class- AbstractDependencyFilterMojo
- Returns:
- an ArtifactsFilterindicating which artifacts must be filtered out
 
- 
setOutputFile- Parameters:
- outputFile- the outputFile to set
 
- 
setOutputProperty- Parameters:
- theOutputProperty- the outputProperty to set
 
- 
setFileSeparator- Parameters:
- theFileSeparator- the fileSeparator to set
 
- 
setPathSeparator- Parameters:
- thePathSeparator- the pathSeparator to set
 
- 
setPrefix- Parameters:
- thePrefix- the prefix to set
 
- 
setRegenerateFilepublic void setRegenerateFile(boolean theRegenerateFile) - Parameters:
- theRegenerateFile- the regenerateFile to set
 
- 
isStripVersionpublic boolean isStripVersion()- Returns:
- the stripVersion
 
- 
setStripVersionpublic void setStripVersion(boolean theStripVersion) - Parameters:
- theStripVersion- the stripVersion to set
 
- 
setLocalRepoProperty- Parameters:
- localRepoProperty-- localRepoProperty
 
 
-