public class MavenUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MAVEN_UNKNOWN_ERROR
Maven unknown error message.
|
Constructor and Description |
---|
MavenUtils() |
Modifier and Type | Method and Description |
---|---|
static MavenJellyContext |
createContext(java.io.File descriptorDirectory)
Create a jelly context given a descriptor directory.
|
static MavenJellyContext |
createContext(java.io.File descriptorDirectory,
MavenJellyContext parentContext)
Create a jelly context given a descriptor directory and parent jelly context.
|
static void |
displayClassLoaderContents(com.werken.forehead.ForeheadClassLoader classLoader)
Debugging function.
|
static java.lang.String[] |
getFiles(java.io.File directory,
java.lang.String includes)
Get a set of files from a specifed directory with a set of includes.
|
static java.lang.String[] |
getFiles(java.io.File directory,
java.lang.String includes,
java.lang.String excludes)
Get a set of files from a specifed directory with a set of includes.
|
static java.util.List |
getGoalListFromCsv(java.lang.String goalCsv)
Get a list of goals from a CSV list.
|
static Project |
getJellyProject(Project project)
Take the POM and interpolate the value of the project's context to create a new version of the POM with expanded
context values.
|
static java.lang.String |
getMessage(java.lang.String messageId)
Retrieve a user message.
|
static java.lang.String |
getMessage(java.lang.String messageId,
java.lang.Object variable)
Retrieve a user message.
|
static Project |
getNonJellyProject(java.io.File projectDescriptor,
MavenJellyContext parentContext,
boolean useParentPom)
Get a project, but not a Jelly-ised project.
|
static Project |
getProject(java.io.File projectDescriptor)
Create a Project object given a file descriptor.
|
static Project |
getProject(java.io.File projectDescriptor,
MavenJellyContext parentContext)
Create a Project object given a file descriptor, and a parent context
|
static Project |
getProject(java.io.File projectDescriptor,
MavenJellyContext parentContext,
boolean useParentPom)
Create a Project object given a file descriptor and optionally a parent Jelly context.
|
static java.util.List |
getProjects(java.io.File directory,
java.lang.String includes,
java.lang.String excludes)
This is currently used for the reactor but may be generally useful.
|
static java.util.List |
getProjects(java.io.File directory,
java.lang.String includes,
java.lang.String excludes,
MavenJellyContext context)
This is currently used for the reactor but may be generally useful.
|
static void |
integrateMapInContext(java.util.Map map,
MavenJellyContext context)
Integrate a Map of key:value pairs into a
MavenJellyContext . |
static java.lang.String |
makeAbsolutePath(java.io.File basedir,
java.lang.String dir)
Resolve directory against a base directory if it is not already absolute.
|
static java.lang.String |
makeRelativePath(java.io.File basedir,
java.lang.String path)
Convert an absolute path to a relative path if it is under a given base directory.
|
static java.util.Map |
mergeMaps(java.util.Map[] maps)
Take a series of
Map s and merge them where the ordering of the array from 0..n is the dominant
order. |
static java.util.Map |
mergeMaps(java.util.Map dominantMap,
java.util.Map recessiveMap)
Take a dominant and recessive Map and merge the key:value pairs where the recessive Map may add key:value pairs
to the dominant Map but may not override any existing key:value pairs.
|
public static final java.lang.String MAVEN_UNKNOWN_ERROR
public static Project getProject(java.io.File projectDescriptor) throws MavenException
projectDescriptor
- a maven project.xmlMavenException
- when any errors occurpublic static Project getProject(java.io.File projectDescriptor, MavenJellyContext parentContext) throws MavenException
projectDescriptor
- The file to create the project fromparentContext
- the parent Maven Jelly ContextMavenException
- when any error happens.public static Project getProject(java.io.File projectDescriptor, MavenJellyContext parentContext, boolean useParentPom) throws MavenException
projectDescriptor
- a maven project.xml File
parentContext
- the parent context for the new projectuseParentPom
- whether a parent project should be respectedMavenException
- when any errors occurpublic static Project getNonJellyProject(java.io.File projectDescriptor, MavenJellyContext parentContext, boolean useParentPom) throws MavenException, java.io.IOException
projectDescriptor
- the project fileparentContext
- the parent context for the new projectuseParentPom
- whether a parent project should be respectedMavenException
- when there are errors reading the descriptorjava.io.IOException
- when resolving file names and pathspublic static java.util.List getProjects(java.io.File directory, java.lang.String includes, java.lang.String excludes) throws MavenException
directory
- the directory to scan for maven projectsincludes
- the pattern that matches a project that you want includedexcludes
- the pattern that matches a project that you don't want includedProject
sMavenException
- when anything goes wrong.public static java.util.List getProjects(java.io.File directory, java.lang.String includes, java.lang.String excludes, MavenJellyContext context) throws MavenException
directory
- the directory to scan for maven projectsincludes
- Patterns to include.excludes
- Patterns to exclude.context
- the parent contextProject
sMavenException
- when anything goes wrong.public static Project getJellyProject(Project project) throws java.lang.Exception
project
- the maven POMjava.lang.Exception
- when there are errors reading FIXMEpublic static java.lang.String[] getFiles(java.io.File directory, java.lang.String includes)
directory
- Directory to scan.includes
- Comma separated list of includes.public static java.lang.String[] getFiles(java.io.File directory, java.lang.String includes, java.lang.String excludes)
directory
- Directory to scan.includes
- Comma separated list of includes.excludes
- Comma separated list of excludes.public static java.util.Map mergeMaps(java.util.Map dominantMap, java.util.Map recessiveMap)
dominantMap
- Dominant Map.recessiveMap
- Recessive Map.public static java.util.Map mergeMaps(java.util.Map[] maps)
Map
s and merge them where the ordering of the array from 0..n is the dominant
order.maps
- An array of Maps to merge.public static MavenJellyContext createContext(java.io.File descriptorDirectory)
descriptorDirectory
- The directory from which to pull the standard maven properties files from.public static MavenJellyContext createContext(java.io.File descriptorDirectory, MavenJellyContext parentContext)
descriptorDirectory
- The directory from which to pull the standard maven properties files from.parentContext
- The parent jelly context.public static void integrateMapInContext(java.util.Map map, MavenJellyContext context)
MavenJellyContext
. The values in the Map may be
CompositeExpression
s that need to be evaluated before being placed into the context.map
- Map to integrate into the provided jelly context.context
- Jelly context to integrate the map into.public static java.lang.String getMessage(java.lang.String messageId)
messageId
- Id of message type to use.public static java.lang.String getMessage(java.lang.String messageId, java.lang.Object variable)
messageId
- Id of message type to use.variable
- Value to substitute for ${1} in the given message.public static java.lang.String makeAbsolutePath(java.io.File basedir, java.lang.String dir) throws java.io.IOException
basedir
- the base directory for relative pathsdir
- the directory to resolvejava.io.IOException
- if canonical path failspublic static java.lang.String makeRelativePath(java.io.File basedir, java.lang.String path) throws java.io.IOException
basedir
- the base directory for relative pathspath
- the directory to resolvejava.io.IOException
- if canonical path failspublic static java.util.List getGoalListFromCsv(java.lang.String goalCsv)
goalCsv
- the goalspublic static void displayClassLoaderContents(com.werken.forehead.ForeheadClassLoader classLoader)
classLoader
- the class loaderCopyright © 2001-2013 Apache Software Foundation. All Rights Reserved.