org.liquibase.maven.plugins
Class MavenUtils
java.lang.Object
org.liquibase.maven.plugins.MavenUtils
public class MavenUtils
- extends java.lang.Object
A Utilities class for Maven plugins.
- Author:
- Peter Murray
|
Method Summary |
static java.lang.ClassLoader |
getArtifactClassloader(org.apache.maven.project.MavenProject project,
boolean includeArtifact,
boolean includeTestOutputDirectory,
java.lang.Class clazz,
org.apache.maven.plugin.logging.Log log,
boolean verbose)
Obtains a ClassLoader that can load from the Maven project dependencies. |
static java.sql.Connection |
getDatabaseConnection(java.lang.ClassLoader classLoader,
java.lang.String driver,
java.lang.String url,
java.lang.String username,
java.lang.String password)
|
static java.lang.reflect.Field |
getDeclaredField(java.lang.Class clazz,
java.lang.String fieldName)
Recursively searches for the field specified by the fieldName in the class and all
the super classes until it either finds it, or runs out of parents. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG_SEPARATOR
public static final java.lang.String LOG_SEPARATOR
- See Also:
- Constant Field Values
MavenUtils
public MavenUtils()
getArtifactClassloader
public static java.lang.ClassLoader getArtifactClassloader(org.apache.maven.project.MavenProject project,
boolean includeArtifact,
boolean includeTestOutputDirectory,
java.lang.Class clazz,
org.apache.maven.plugin.logging.Log log,
boolean verbose)
throws java.net.MalformedURLException
- Obtains a
ClassLoader that can load from the Maven project dependencies. If
the dependencies have not be resolved (or there are none) then this will just end up
delegating to the parent ClassLoader of this class.
- Returns:
- The ClassLoader that can load the resolved dependencies for the Maven
project.
- Throws:
java.net.MalformedURLException - If any of the dependencies cannot be resolved
into a URL.
getDatabaseConnection
public static java.sql.Connection getDatabaseConnection(java.lang.ClassLoader classLoader,
java.lang.String driver,
java.lang.String url,
java.lang.String username,
java.lang.String password)
throws LiquibaseException
- Throws:
LiquibaseException
getDeclaredField
public static java.lang.reflect.Field getDeclaredField(java.lang.Class clazz,
java.lang.String fieldName)
throws java.lang.NoSuchFieldException
- Recursively searches for the field specified by the fieldName in the class and all
the super classes until it either finds it, or runs out of parents.
- Parameters:
clazz - The Class to start searching from.fieldName - The name of the field to retrieve.
- Returns:
- The
Field identified by the field name.
- Throws:
java.lang.NoSuchFieldException - If the field was not found in the class or any of its
super classes.
Copyright © 2010 Liquibase.org. All Rights Reserved.