|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.groovy.grails.cli.support.ClasspathConfigurer
public class ClasspathConfigurer
Support class that configures the Grails classpath when executing command line scripts.
| Constructor Summary | |
|---|---|
ClasspathConfigurer(grails.util.BuildSettings build,
boolean skipPlugins)
|
|
ClasspathConfigurer(PluginPathDiscoverySupport pluginPathSupport,
grails.util.BuildSettings settings,
boolean skipPlugins)
|
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClasspathConfigurer(PluginPathDiscoverySupport pluginPathSupport,
grails.util.BuildSettings settings,
boolean skipPlugins)
public ClasspathConfigurer(grails.util.BuildSettings build,
boolean skipPlugins)
| Method Detail |
|---|
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.MalformedURLException
protected 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.MalformedURLException
protected void addLibs(java.io.File dir,
java.util.List<java.net.URL> urls,
java.util.Collection<?> excludes)
throws java.net.MalformedURLException
java.net.MalformedURLException
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 void setExitOnResolveError(boolean exitOnResolveError)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||