|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.grails.cli.support.ClasspathConfigurer
public class ClasspathConfigurer extends java.lang.Object
Support class that configures the Grails classpath when executing command line scripts.
Constructor Summary | |
ClasspathConfigurer(PluginPathDiscoverySupport pluginPathSupport, BuildSettings settings, boolean skipPlugins)
|
|
ClasspathConfigurer(BuildSettings build, boolean skipPlugins)
|
Method Summary | |
---|---|
protected void
|
addDependenciesToURLs(java.util.Set excludes, java.util.List urls, java.util.List runtimeDeps)
|
protected void
|
addLibs(java.io.File dir, java.util.List urls, java.util.Collection excludes)
Adds all the JAR files in the given directory to the list of URLs. |
protected void
|
addPluginLibs(java.io.File pluginDir, java.util.List urls, BuildSettings settings)
Adds all the libraries in a plugin to the given list of URLs. |
protected void
|
addUrlsToRootLoader(java.net.URLClassLoader loader, java.net.URL[] urls)
|
static void
|
cleanResolveCache(BuildSettings settings)
|
java.net.URLClassLoader
|
configuredClassLoader()
|
protected java.net.URL[]
|
getClassLoaderUrls(BuildSettings settings, java.io.File cacheDir, java.util.Set excludes, boolean skipPlugins)
Creates a new root loader with the Grails libraries and the application's plugin libraries on the classpath. |
void
|
setExitOnResolveError(boolean exitOnResolveError)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructor Detail |
---|
public ClasspathConfigurer(PluginPathDiscoverySupport pluginPathSupport, BuildSettings settings, boolean skipPlugins)
public ClasspathConfigurer(BuildSettings build, boolean skipPlugins)
Method Detail |
---|
protected void addDependenciesToURLs(java.util.Set excludes, java.util.List urls, java.util.List runtimeDeps)
protected void addLibs(java.io.File dir, java.util.List urls, java.util.Collection excludes)
protected void addPluginLibs(java.io.File pluginDir, java.util.List urls, @SuppressWarnings("hiding") BuildSettings settings)
pluginDir
- The directory containing the plugin.urls
- The list of URLs to add the plugin JARs to.
protected void addUrlsToRootLoader(java.net.URLClassLoader loader, java.net.URL[] urls)
A Groovy RootLoader should be used to load GrailsScriptRunner, but this leaves us with a problem. If we want to extend its classpath by adding extra URLs, we have to use the addURL() method that is only public on RootLoader (it's protected on URLClassLoader). Unfortunately, due to the nature of Groovy's RootLoader a declared type of RootLoader in this class is not the same type as GrailsScriptRunner's class loader because the two are loaded by different class loaders.
In other words, we can't add URLs via the addURL() method because we can't "see" it from Java. Instead, we use reflection to invoke it.
loader
- The root loader whose classpath we want to extend.urls
- The URLs to add to the root loader's classpath.
public static void cleanResolveCache(BuildSettings settings)
public java.net.URLClassLoader configuredClassLoader()
protected java.net.URL[] getClassLoaderUrls(@SuppressWarnings("hiding") BuildSettings settings, java.io.File cacheDir, java.util.Set excludes, @SuppressWarnings("hiding") boolean skipPlugins)
public void setExitOnResolveError(boolean exitOnResolveError)
Groovy Documentation