org.apache.maven.plugin.dependency
Class BuildClasspathMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.dependency.AbstractDependencyMojo
          extended by org.apache.maven.plugin.dependency.AbstractDependencyFilterMojo
              extended by org.apache.maven.plugin.dependency.BuildClasspathMojo
All Implemented Interfaces:
java.util.Comparator, org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

public class BuildClasspathMojo
extends AbstractDependencyFilterMojo
implements java.util.Comparator

This goal will output a classpath string of dependencies from the local repository to a file or log.

Since:
2.0-alpha-2
Version:
$Id: BuildClasspathMojo.java 728546 2008-12-21 22:56:51Z bentmann $
Author:
ankostis
Is defined by the goal name:
build-classpath
Is bound to the specified phase of the standard build lifecycle:
generate-sources
Requires the dependencies in this specified scope:
test

Field Summary
 
Fields inherited from class org.apache.maven.plugin.dependency.AbstractDependencyFilterMojo
classifier, excludeArtifactIds, excludeClassifiers, excludeGroupIds, excludeScope, excludeTransitive, excludeTypes, includeArtifactIds, includeClassifiers, includeGroupIds, includeScope, includeTypes, markersDirectory, overWriteIfNewer, overWriteReleases, overWriteSnapshots, type
 
Fields inherited from class org.apache.maven.plugin.dependency.AbstractDependencyMojo
archiverManager, artifactCollector, artifactMetadataSource, factory, local, outputAbsoluteArtifactFilename, project, reactorProjects, remoteRepos, resolver, silent
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
BuildClasspathMojo()
           
 
Method Summary
protected  void appendArtifactPath(org.apache.maven.artifact.Artifact art, java.lang.StringBuffer sb)
          Appends the artifact path into the specified stringBuffer.
protected  void attachFile(java.lang.String cpString)
           
 int compare(java.lang.Object arg1, java.lang.Object arg2)
          Compares artifacts lexicographically, using pattern [group_id][artifact_id][version].
 void execute()
          Main entry into mojo.
 java.io.File getCpFile()
           
 java.lang.String getFileSeparator()
           
 java.lang.String getLocalRepoProperty()
           
protected  org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter getMarkedArtifactFilter()
           
 java.lang.String getPathSeparator()
           
 java.lang.String getPrefix()
           
 boolean isFileSepSet()
           
 boolean isPathSepSet()
           
 boolean isRegenerateFile()
           
 boolean isStripVersion()
           
protected  java.lang.String readClasspathFile()
          Reads into a string the file specified by the mojo param 'outputFile'.
 void setCpFile(java.io.File theCpFile)
           
 void setFileSeparator(java.lang.String theFileSeparator)
           
 void setFileSepSet(boolean isFileSepSet)
           
 void setLocalRepoProperty(java.lang.String localRepoProperty)
           
 void setPathSeparator(java.lang.String thePathSeparator)
           
 void setPathSepSet(boolean isPathSepSet)
           
 void setPrefix(java.lang.String thePrefix)
           
 void setRegenerateFile(boolean theRegenerateFile)
           
 void setStripVersion(boolean theStripVersion)
           
 
Methods inherited from class org.apache.maven.plugin.dependency.AbstractDependencyFilterMojo
filterMarkedDependencies, getClassifierTranslatedDependencies, getDependencySets, getMarkersDirectory, getResolvedDependencies, setMarkersDirectory
 
Methods inherited from class org.apache.maven.plugin.dependency.AbstractDependencyMojo
copyFile, getArchiverManager, getArtifactCollector, getArtifactMetadataSource, getFactory, getLocal, getLog, getProject, getRemoteRepos, getResolver, setArchiverManager, setArtifactCollector, setArtifactMetadataSource, setFactory, setLocal, setRemoteRepos, setResolver, unpack, unpack
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

BuildClasspathMojo

public BuildClasspathMojo()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Main entry into mojo. Gets the list of dependencies and iterates through calling copyArtifact.

Specified by:
execute in interface org.apache.maven.plugin.Mojo
Throws:
org.apache.maven.plugin.MojoExecutionException - with a message if an error occurs.
See Also:
#getDependencies, #copyArtifact(Artifact, boolean)

attachFile

protected void attachFile(java.lang.String cpString)
                   throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

appendArtifactPath

protected void appendArtifactPath(org.apache.maven.artifact.Artifact art,
                                  java.lang.StringBuffer sb)
Appends the artifact path into the specified stringBuffer.

Parameters:
art -
sb -

readClasspathFile

protected java.lang.String readClasspathFile()
                                      throws java.io.IOException
Reads into a string the file specified by the mojo param 'outputFile'. Assumes, the instance variable 'outputFile' is not null.

Returns:
the string contained in the classpathFile, if exists, or null ortherwise.
Throws:
org.apache.maven.plugin.MojoExecutionException
java.io.IOException

compare

public int compare(java.lang.Object arg1,
                   java.lang.Object arg2)
Compares artifacts lexicographically, using pattern [group_id][artifact_id][version].

Specified by:
compare in interface java.util.Comparator
Parameters:
arg1 - first object
arg2 - second object
Returns:
the value 0 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.

getMarkedArtifactFilter

protected org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter getMarkedArtifactFilter()
Specified by:
getMarkedArtifactFilter in class AbstractDependencyFilterMojo

getCpFile

public java.io.File getCpFile()
Returns:
the outputFile

setCpFile

public void setCpFile(java.io.File theCpFile)
Parameters:
theCpFile - the outputFile to set

getFileSeparator

public java.lang.String getFileSeparator()
Returns:
the fileSeparator

setFileSeparator

public void setFileSeparator(java.lang.String theFileSeparator)
Parameters:
theFileSeparator - the fileSeparator to set

getPathSeparator

public java.lang.String getPathSeparator()
Returns:
the pathSeparator

setPathSeparator

public void setPathSeparator(java.lang.String thePathSeparator)
Parameters:
thePathSeparator - the pathSeparator to set

getPrefix

public java.lang.String getPrefix()
Returns:
the prefix

setPrefix

public void setPrefix(java.lang.String thePrefix)
Parameters:
thePrefix - the prefix to set

isRegenerateFile

public boolean isRegenerateFile()
Returns:
the regenerateFile

setRegenerateFile

public void setRegenerateFile(boolean theRegenerateFile)
Parameters:
theRegenerateFile - the regenerateFile to set

isStripVersion

public boolean isStripVersion()
Returns:
the stripVersion

setStripVersion

public void setStripVersion(boolean theStripVersion)
Parameters:
theStripVersion - the stripVersion to set

getLocalRepoProperty

public java.lang.String getLocalRepoProperty()

setLocalRepoProperty

public void setLocalRepoProperty(java.lang.String localRepoProperty)

isFileSepSet

public boolean isFileSepSet()

setFileSepSet

public void setFileSepSet(boolean isFileSepSet)

isPathSepSet

public boolean isPathSepSet()

setPathSepSet

public void setPathSepSet(boolean isPathSepSet)


Copyright © 2002-2009 The Apache Software Foundation. All Rights Reserved.