@Mojo(name="build-classpath", requiresDependencyResolution=TEST, defaultPhase=GENERATE_SOURCES, threadSafe=true) public class BuildClasspathMojo extends AbstractDependencyFilterMojo implements java.util.Comparator<org.apache.maven.artifact.Artifact>
Modifier and Type | Field and Description |
---|---|
private boolean |
attach
Attach the classpath file to the main artifact so it can be installed and deployed.
|
private java.lang.String |
fileSeparator
Override the char used between the paths.
|
private java.lang.String |
localRepoProperty
Replace the absolute path to the local repo with this property.
|
private java.io.File |
outputFile
The file to write the classpath string.
|
private boolean |
outputFilterFile
Write out the classpath in a format compatible with filtering (classpath=xxxxx)
|
private java.lang.String |
outputProperty
A property to set to the content of the classpath string.
|
private java.lang.String |
pathSeparator
Override the char used between path folders.
|
private java.lang.String |
prefix
The prefix to prepend on each dependent artifact.
|
private org.apache.maven.project.MavenProjectHelper |
projectHelper
Maven ProjectHelper
|
private boolean |
regenerateFile
If 'true', it skips the up-to-date-check, and always regenerates the classpath file.
|
private org.apache.maven.shared.repository.RepositoryManager |
repositoryManager |
private boolean |
stripClassifier
Strip artifact classifier during copy (only works if prefix is set)
|
private boolean |
stripVersion
Strip artifact version during copy (only works if prefix is set)
|
private boolean |
useBaseVersion
Either append the artifact's baseVersion or uniqueVersion to the filename.
|
classifier, excludeArtifactIds, excludeClassifiers, excludeGroupIds, excludeScope, excludeTransitive, excludeTypes, includeArtifactIds, includeClassifiers, includeGroupIds, includeScope, includeTypes, markersDirectory, overWriteIfNewer, overWriteReleases, overWriteSnapshots, prependGroupId, type
outputAbsoluteArtifactFilename, reactorProjects, session
Constructor and Description |
---|
BuildClasspathMojo() |
Modifier and Type | Method and Description |
---|---|
protected void |
appendArtifactPath(org.apache.maven.artifact.Artifact art,
java.lang.StringBuilder sb)
Appends the artifact path into the specified StringBuilder.
|
protected void |
attachFile(java.lang.String cpString) |
int |
compare(org.apache.maven.artifact.Artifact art1,
org.apache.maven.artifact.Artifact art2)
Compares artifacts lexicographically, using pattern [group_id][artifact_id][version].
|
protected void |
doExecute()
Main entry into mojo.
|
protected org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter |
getMarkedArtifactFilter()
Return an
ArtifactsFilter indicating which artifacts must be filtered out. |
boolean |
isStripVersion() |
private boolean |
isUpdToDate(java.lang.String cpString)
Checks that new classpath differs from that found inside the old classpathFile.
|
protected java.lang.String |
readClasspathFile()
Reads into a string the file specified by the mojo param 'outputFile'.
|
void |
setFileSeparator(java.lang.String theFileSeparator) |
void |
setLocalRepoProperty(java.lang.String localRepoProperty) |
void |
setOutputFile(java.io.File outputFile) |
void |
setOutputProperty(java.lang.String theOutputProperty) |
void |
setPathSeparator(java.lang.String thePathSeparator) |
void |
setPrefix(java.lang.String thePrefix) |
void |
setRegenerateFile(boolean theRegenerateFile) |
void |
setStripVersion(boolean theStripVersion) |
private void |
storeClasspathFile(java.lang.String cpString,
java.io.File out)
It stores the specified string into that file.
|
filterMarkedDependencies, getArtifactResolver, getClassifierTranslatedDependencies, getDependencyResolver, getDependencySets, getDependencySets, getMarkersDirectory, getRepositoryManager, getResolvedDependencies, isPrependGroupId, resolve, setMarkersDirectory, setPrependGroupId
copyFile, execute, getArchiverManager, getProject, isSilent, isSkip, isUseJvmChmod, newResolveArtifactProjectBuildingRequest, setArchiverManager, setSilent, setSkip, setUseJvmChmod, unpack, unpack, unpack
getLog, getPluginContext, setLog, setPluginContext
@Parameter(property="mdep.stripVersion", defaultValue="false") private boolean stripVersion
@Parameter(property="mdep.stripClassifier", defaultValue="false") private boolean stripClassifier
@Parameter(property="mdep.prefix") private java.lang.String prefix
@Parameter(property="mdep.outputProperty") private java.lang.String outputProperty
@Parameter(property="mdep.outputFile") private java.io.File outputFile
@Parameter(property="mdep.regenerateFile", defaultValue="false") private boolean regenerateFile
@Parameter(property="mdep.fileSeparator", defaultValue="") private java.lang.String fileSeparator
@Parameter(property="mdep.pathSeparator", defaultValue="") private java.lang.String pathSeparator
@Parameter(property="mdep.localRepoProperty", defaultValue="") private java.lang.String localRepoProperty
@Parameter(defaultValue="false") private boolean attach
@Parameter(property="mdep.outputFilterFile", defaultValue="false") private boolean outputFilterFile
@Parameter(property="mdep.useBaseVersion", defaultValue="true") private boolean useBaseVersion
isStripVersion()
is false
.@Component private org.apache.maven.project.MavenProjectHelper projectHelper
@Component private org.apache.maven.shared.repository.RepositoryManager repositoryManager
protected void doExecute() throws org.apache.maven.plugin.MojoExecutionException
doExecute
in class AbstractDependencyMojo
org.apache.maven.plugin.MojoExecutionException
- with a message if an error occurs.AbstractDependencyFilterMojo.getResolvedDependencies(boolean)
protected void attachFile(java.lang.String cpString) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void appendArtifactPath(org.apache.maven.artifact.Artifact art, java.lang.StringBuilder sb)
art
- Artifact
sb
- StringBuilder
private boolean isUpdToDate(java.lang.String cpString)
cpString
- private void storeClasspathFile(java.lang.String cpString, java.io.File out) throws org.apache.maven.plugin.MojoExecutionException
cpString
- the string to be written into the file.org.apache.maven.plugin.MojoExecutionException
protected java.lang.String readClasspathFile() throws java.io.IOException
java.io.IOException
- in case of an error.public int compare(org.apache.maven.artifact.Artifact art1, org.apache.maven.artifact.Artifact art2)
compare
in interface java.util.Comparator<org.apache.maven.artifact.Artifact>
art1
- first objectart2
- second object0
if the argument string is equal to this string; a value less than 0
if this string is lexicographically less than the string argument; and a value greater than
0
if this string is lexicographically greater than the string argument.protected org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter getMarkedArtifactFilter()
AbstractDependencyFilterMojo
ArtifactsFilter
indicating which artifacts must be filtered out.getMarkedArtifactFilter
in class AbstractDependencyFilterMojo
ArtifactsFilter
indicating which artifacts must be filtered out.public void setOutputFile(java.io.File outputFile)
outputFile
- the outputFile to setpublic void setOutputProperty(java.lang.String theOutputProperty)
theOutputProperty
- the outputProperty to setpublic void setFileSeparator(java.lang.String theFileSeparator)
theFileSeparator
- the fileSeparator to setpublic void setPathSeparator(java.lang.String thePathSeparator)
thePathSeparator
- the pathSeparator to setpublic void setPrefix(java.lang.String thePrefix)
thePrefix
- the prefix to setpublic void setRegenerateFile(boolean theRegenerateFile)
theRegenerateFile
- the regenerateFile to setpublic boolean isStripVersion()
public void setStripVersion(boolean theStripVersion)
theStripVersion
- the stripVersion to setpublic void setLocalRepoProperty(java.lang.String localRepoProperty)