ClasspathConfigurer (Grails 2.3.8)
Date: 2014-04-24

Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.cli.support
[Java] Class ClasspathConfigurer

    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.

Authors:
  Graeme Rocher

Since:
  2.0

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)`
`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(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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

### ClasspathConfigurer

    public ClasspathConfigurer(PluginPathDiscoverySupport pluginPathSupport, BuildSettings settings, boolean skipPlugins)

### ClasspathConfigurer

    public ClasspathConfigurer(BuildSettings build, boolean skipPlugins)

Method Detail

### addDependenciesToURLs

    protected void addDependenciesToURLs(java.util.Set excludes, java.util.List urls, java.util.List runtimeDeps)

### addLibs

    protected void addLibs(java.io.File dir, java.util.List urls, java.util.Collection excludes)

### addPluginLibs

    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.
  Parameters:
    `pluginDir` - The directory containing the plugin.
    `urls` - The list of URLs to add the plugin JARs to.
    settings

### addUrlsToRootLoader

    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.

  Parameters:
    `loader` - The root loader whose classpath we want to extend.
    `urls` - The URLs to add to the root loader's classpath.

### cleanResolveCache

    public static void cleanResolveCache(BuildSettings settings)

### configuredClassLoader

    public java.net.URLClassLoader configuredClassLoader()

### getClassLoaderUrls

    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.

### setExitOnResolveError

    public void setExitOnResolveError(boolean exitOnResolveError)

Groovy Documentation