Package org.liquibase.maven.plugins
Class MavenUtils
java.lang.Object
org.liquibase.maven.plugins.MavenUtils
A Utilities class for Maven plugins.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClassLoader
getArtifactClassloader
(org.apache.maven.project.MavenProject project, boolean includeArtifact, boolean includeTestOutputDirectory, Class clazz, org.apache.maven.plugin.logging.Log log, boolean verbose) Obtains aClassLoader
that can load from the Maven project dependencies.static Field
getDeclaredField
(Class<?> clazz, String keyPropertyName) 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.
-
Field Details
-
LOG_SEPARATOR
- See Also:
-
-
Constructor Details
-
MavenUtils
public MavenUtils()
-
-
Method Details
-
getArtifactClassloader
public static ClassLoader getArtifactClassloader(org.apache.maven.project.MavenProject project, boolean includeArtifact, boolean includeTestOutputDirectory, Class clazz, org.apache.maven.plugin.logging.Log log, boolean verbose) throws MalformedURLException Obtains aClassLoader
that can load from the Maven project dependencies. If the dependencies have not been resolved (or there are none) then this will just end up delegating to the parentClassLoader
of this class.- Returns:
- The ClassLoader that can load the resolved dependencies for the Maven project.
- Throws:
MalformedURLException
- If any of the dependencies cannot be resolved into a URL.
-
getDeclaredField
public static Field getDeclaredField(Class<?> clazz, String keyPropertyName) throws 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.keyPropertyName
- The name of the field to retrieve.- Returns:
- The
Field
identified by the field name. - Throws:
NoSuchFieldException
- If the field was not found in the class or any of its super classes.
-