public class ClasspathConfigurer
extends java.lang.Object
| Constructor and Description |
|---|
ClasspathConfigurer(grails.util.BuildSettings build,
boolean skipPlugins) |
ClasspathConfigurer(PluginPathDiscoverySupport pluginPathSupport,
grails.util.BuildSettings settings,
boolean skipPlugins) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDependenciesToURLs(java.util.Set<java.lang.String> excludes,
java.util.List<java.net.URL> urls,
java.util.List<java.io.File> runtimeDeps) |
protected void |
addLibs(java.io.File dir,
java.util.List<java.net.URL> 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<java.net.URL> urls,
grails.util.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)
A Groovy RootLoader should be used to load GrailsScriptRunner,
but this leaves us with a problem.
|
static void |
cleanResolveCache(grails.util.BuildSettings settings) |
java.net.URLClassLoader |
configuredClassLoader() |
protected java.net.URL[] |
getClassLoaderUrls(grails.util.BuildSettings settings,
java.io.File cacheDir,
java.util.Set<java.lang.String> 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) |
public ClasspathConfigurer(PluginPathDiscoverySupport pluginPathSupport, grails.util.BuildSettings settings, boolean skipPlugins)
public ClasspathConfigurer(grails.util.BuildSettings build,
boolean skipPlugins)
public java.net.URLClassLoader configuredClassLoader()
protected java.net.URL[] getClassLoaderUrls(grails.util.BuildSettings settings,
java.io.File cacheDir,
java.util.Set<java.lang.String> excludes,
boolean skipPlugins)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic static void cleanResolveCache(grails.util.BuildSettings settings)
protected void addDependenciesToURLs(java.util.Set<java.lang.String> excludes,
java.util.List<java.net.URL> urls,
java.util.List<java.io.File> runtimeDeps)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionprotected void addPluginLibs(java.io.File pluginDir,
java.util.List<java.net.URL> urls,
grails.util.BuildSettings settings)
throws java.net.MalformedURLException
pluginDir - The directory containing the plugin.urls - The list of URLs to add the plugin JARs to.settings - java.net.MalformedURLExceptionprotected void addLibs(java.io.File dir,
java.util.List<java.net.URL> urls,
java.util.Collection<?> excludes)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionprotected 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 void setExitOnResolveError(boolean exitOnResolveError)