Class DependencyUtil
java.lang.Object
org.apache.maven.plugins.dependency.utils.DependencyUtil
Utility class with static helper methods.
- Author:
- Brian Fox
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringClean up configuration string before it can be tokenized.static StringgetFormattedFileName(org.apache.maven.artifact.Artifact artifact, boolean removeVersion) Builds the file name.static StringgetFormattedFileName(org.apache.maven.artifact.Artifact artifact, boolean removeVersion, boolean prependGroupId) Builds the file name.static StringgetFormattedFileName(org.apache.maven.artifact.Artifact artifact, boolean removeVersion, boolean prependGroupId, boolean useBaseVersion) Builds the file name.static StringgetFormattedFileName(org.apache.maven.artifact.Artifact artifact, boolean removeVersion, boolean prependGroupId, boolean useBaseVersion, boolean removeClassifier) Builds the file name.static FilegetFormattedOutputDirectory(boolean useSubdirsPerScope, boolean useSubdirsPerType, boolean useSubdirPerArtifact, boolean useRepositoryLayout, boolean removeVersion, boolean removeType, File outputDirectory, org.apache.maven.artifact.Artifact artifact) Formats the outputDirectory based on type.static voidWrites each line in the specified string to the log at info level.static voidWrites the specified string to the specified file.static voidDeprecated.specify an encoding instead of a log
- 
Constructor Details- 
DependencyUtilpublic DependencyUtil()
 
- 
- 
Method Details- 
getFormattedFileNamepublic static String getFormattedFileName(org.apache.maven.artifact.Artifact artifact, boolean removeVersion) Builds the file name. If removeVersion is set, then the file name must be reconstructed from the artifactId, Classifier (if used) and Type. Otherwise, this method returns the artifact file name.- Parameters:
- artifact- file to be formatted
- removeVersion- specifies if the version should be removed from the file name
- Returns:
- formatted file name in the format artifactId-[version]-[classifier].[type]
- See Also:
 
- 
getFormattedFileNamepublic static String getFormattedFileName(org.apache.maven.artifact.Artifact artifact, boolean removeVersion, boolean prependGroupId) Builds the file name. If removeVersion is set, then the file name must be reconstructed from the groupId (if prependGroupId is true) artifactId, Classifier (if used) and Type. Otherwise, this method returns the artifact file name.- Parameters:
- artifact- file to be formatted
- removeVersion- specifies if the version should be removed from the file name
- prependGroupId- specifies if the groupId should be prepended to the file name
- Returns:
- formatted file name in the format [groupId].artifactId-[version]-[classifier].[type]
 
- 
getFormattedFileNamepublic static String getFormattedFileName(org.apache.maven.artifact.Artifact artifact, boolean removeVersion, boolean prependGroupId, boolean useBaseVersion) Builds the file name. If removeVersion is set, then the file name must be reconstructed from the groupId (if prependGroupId is true) artifactId, Classifier (if used), and Type. Otherwise, this method returns the artifact file name.- Parameters:
- artifact- file to be formatted
- removeVersion- specifies if the version should be removed from the file name
- prependGroupId- specifies if the groupId should be prepended to the file name
- useBaseVersion- specifies if the baseVersion of the artifact should be used instead of the version
- Returns:
- formatted file name in the format [groupId].artifactId-[version]-[classifier].[type]
 
- 
getFormattedFileNamepublic static String getFormattedFileName(org.apache.maven.artifact.Artifact artifact, boolean removeVersion, boolean prependGroupId, boolean useBaseVersion, boolean removeClassifier) Builds the file name. If removeVersion is set, then the file name must be reconstructed from the groupId (if prependGroupId is true) artifactId, Classifier (if used) and Type. Otherwise, this method returns the artifact file name.- Parameters:
- artifact- file to be formatted
- removeVersion- specifies if the version should be removed from the file name
- prependGroupId- specifies if the groupId should be prepended to the file name
- useBaseVersion- specifies if the baseVersion of the artifact should be used instead of the version
- removeClassifier- specifies if the classifier of the artifact should be remved from the file name
- Returns:
- formatted file name in the format [groupId].artifactId-[version]-[classifier].[type]
 
- 
getFormattedOutputDirectorypublic static File getFormattedOutputDirectory(boolean useSubdirsPerScope, boolean useSubdirsPerType, boolean useSubdirPerArtifact, boolean useRepositoryLayout, boolean removeVersion, boolean removeType, File outputDirectory, org.apache.maven.artifact.Artifact artifact) Formats the outputDirectory based on type.- Parameters:
- useSubdirsPerScope- if a new subdirectory should be used for each scope
- useSubdirsPerType- if a new subdirectory should be used for each type
- useSubdirPerArtifact- if a new subdirectory should be used for each artifact
- useRepositoryLayout- if dependencies must be moved into a Maven repository layout. If set, other settings will be ignored.
- removeVersion- if the version must not be mentioned in the filename
- removeType- if the type must not be mentioned in the filename
- outputDirectory- base outputDirectory
- artifact- information about the artifact
- Returns:
- a formatted File object to use for output
 
- 
write@Deprecated public static void write(String string, File file, boolean append, org.apache.maven.plugin.logging.Log log) throws IOException Deprecated.specify an encoding instead of a logWrites the specified string to the specified file.- Parameters:
- string- the string to write
- file- the file to write to
- append- append to existing file or not
- log- ignored
- Throws:
- IOException- if an I/O error occurs
 
- 
writepublic static void write(String string, File file, boolean append, String encoding) throws IOException Writes the specified string to the specified file.- Parameters:
- string- the string to write
- file- the file to write to
- append- append to existing file or not
- encoding- character set name
- Throws:
- IOException- if an I/O error occurs
 
- 
logWrites each line in the specified string to the log at info level. The difference between callingDependencyUtil.log(s, log)andlog.info(s)is that the latter will put "[INFO]" in front of each line in the string whereas the former only outputs it once at the front of the string.- Parameters:
- string- the string to write
- log- where to log information
- Throws:
- IOException- if an I/O error occurs
 
- 
cleanToBeTokenizedStringClean up configuration string before it can be tokenized.- Parameters:
- str- the string which should be cleaned
- Returns:
- cleaned up string
 
 
-