org.apache.maven.plugin.dependency.utils
Class DependencyUtil

java.lang.Object
  extended by org.apache.maven.plugin.dependency.utils.DependencyUtil

public final class DependencyUtil
extends Object

Utility class with static helper methods

Version:
$Id: DependencyUtil.java 1085777 2011-03-26 18:13:19Z hboutemy $
Author:
Brian Fox

Constructor Summary
DependencyUtil()
           
 
Method Summary
static String cleanToBeTokenizedString(String str)
           
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 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 log(String string, org.apache.maven.plugin.logging.Log log)
          Writes the specified string to the log at info level.
static String[] tokenizer(String str)
           
static void write(String string, File file, boolean append, org.apache.maven.plugin.logging.Log log)
          Writes the specified string to the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DependencyUtil

public DependencyUtil()
Method Detail

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(Artifact, boolean, boolean)}.

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]

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:
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 filename
outputDirectory - base outputDirectory.
artifact - information about the artifact.
Returns:
a formatted File object to use for output.

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 write
file - the file to write to
Throws:
IOException - if an I/O error occurs

log

public static void log(String string,
                       org.apache.maven.plugin.logging.Log log)
                throws IOException
Writes the specified string to the log at info level.

Parameters:
string - the string to write
Throws:
IOException - if an I/O error occurs

tokenizer

public static String[] tokenizer(String str)

cleanToBeTokenizedString

public static String cleanToBeTokenizedString(String str)


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