Class DependencyUtil
java.lang.Object
org.apache.maven.plugins.dependency.utils.DependencyUtil
Utility class with static helper methods
- Version:
- $Id$
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
clean up configuration string before it can be tokenizedprivate static String
getDependencyId
(org.apache.maven.artifact.Artifact artifact, boolean removeVersion) static String
getFormattedFileName
(org.apache.maven.artifact.Artifact artifact, boolean removeVersion) Builds the file name.static String
getFormattedFileName
(org.apache.maven.artifact.Artifact artifact, boolean removeVersion, boolean prependGroupId) Builds the file name.static String
getFormattedFileName
(org.apache.maven.artifact.Artifact artifact, boolean removeVersion, boolean prependGroupId, boolean useBaseVersion) Builds the file name.static String
getFormattedFileName
(org.apache.maven.artifact.Artifact artifact, boolean removeVersion, boolean prependGroupId, boolean useBaseVersion, boolean removeClassifier) Builds the file name.static File
getFormattedOutputDirectory
(boolean useSubdirsPerScope, boolean useSubdirsPerType, boolean useSubdirPerArtifact, boolean useRepositoryLayout, boolean removeVersion, File outputDirectory, org.apache.maven.artifact.Artifact artifact) Formats the outputDirectory based on type.static void
Writes the specified string to the log at info level.static String[]
mainly used to parse excludes,includes configurationstatic void
Writes the specified string to the specified file.
-
Constructor Details
-
DependencyUtil
public DependencyUtil()
-
-
Method Details
-
getFormattedFileName
public 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:
-
getFormattedFileName
public 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]
-
getFormattedFileName
public 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]
-
getFormattedFileName
public 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]
-
getFormattedOutputDirectory
public static File getFormattedOutputDirectory(boolean useSubdirsPerScope, boolean useSubdirsPerType, boolean useSubdirPerArtifact, boolean useRepositoryLayout, boolean removeVersion, File outputDirectory, org.apache.maven.artifact.Artifact artifact) Formats the outputDirectory based on type.- Parameters:
useSubdirsPerScope
- if a new sub directory should be used for each scope.useSubdirsPerType
- if a new sub directory should be used for each type.useSubdirPerArtifact
- if a new sub directory 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 filenameoutputDirectory
- base outputDirectory.artifact
- information about the artifact.- Returns:
- a formatted File object to use for output.
-
getDependencyId
private static String getDependencyId(org.apache.maven.artifact.Artifact artifact, boolean removeVersion) -
write
public static void write(String string, File file, boolean append, org.apache.maven.plugin.logging.Log log) throws IOException Writes the specified string to the specified file.- Parameters:
string
- the string to writefile
- the file to write toappend
- append to existing file or not.log
- where to send the logging output.- Throws:
IOException
- if an I/O error occurs
-
log
Writes the specified string to the log at info level.- Parameters:
string
- the string to writelog
- where to log information.- Throws:
IOException
- if an I/O error occurs
-
tokenizer
mainly used to parse excludes,includes configuration- Parameters:
str
- The string to be split.- Returns:
- The result items.
-
cleanToBeTokenizedString
clean up configuration string before it can be tokenized- Parameters:
str
- The str which should be cleaned.- Returns:
- cleaned up string.
-