Package groovy.lang

Examples of groovy.lang.GroovyClassLoader.addClasspath()


            Path classpath = getClasspath() != null ? getClasspath() : new Path(getProject());
            final String[] pe = classpath.list();
            final GroovyClassLoader loader = new GroovyClassLoader(getClass().getClassLoader());
            for (String file : pe) {
                loader.addClasspath(file);
            }
            scriptExtensions.addAll(SourceExtensionHandler.getRegisteredExtensions(loader));
        }
    }
}
View Full Code Here


        for (String path : pathsToAdd) {
          if (path.startsWith("file:/")) {
            URL url = new URL(path);
            classLoader.addURL(url);
            classLoader.addClasspath(url.getFile());
          } else {
            classLoader.addURL(new URL("file:///" + path));
            classLoader.addClasspath(path);
          }
        }
View Full Code Here

            URL url = new URL(path);
            classLoader.addURL(url);
            classLoader.addClasspath(url.getFile());
          } else {
            classLoader.addURL(new URL("file:///" + path));
            classLoader.addClasspath(path);
          }
        }

      } catch (IOException e) {
        errorReporter.addLoadingError(pluginId, "Error while looking for dependencies in '" + mainScriptUrl + "'. " + e.getMessage());
View Full Code Here

            javaHome = javaHome.substring(0, javaHome.length() - 4);
        }
        File toolsJar = new File((javaHome + "/lib/tools.jar"));
        if (toolsJar.exists()) {
            GroovyClassLoader loader = cu.getClassLoader();
            loader.addClasspath(toolsJar.getAbsolutePath());
            return loader.loadClass(main);
        }
       
        throw new ClassNotFoundException("unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings");
    }
View Full Code Here

            javaHome = javaHome.substring(0, javaHome.length() - 4);
        }
        File toolsJar = new File((javaHome + "/lib/tools.jar"));
        if (toolsJar.exists()) {
            GroovyClassLoader loader = cu.getClassLoader();
            loader.addClasspath(toolsJar.getAbsolutePath());
            return loader.loadClass(main);
        }

        throw new ClassNotFoundException("unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings");
    }
View Full Code Here

       
        Path classpath = getClasspath() != null ? getClasspath() : new Path(getProject());
        final String[] pe = classpath.list();
        final GroovyClassLoader loader = new GroovyClassLoader(getClass().getClassLoader());
        for (String file : pe) {
          loader.addClasspath(file);
        }
        scriptExtensions.addAll(SourceExtensionHandler.getRegisteredExtensions(loader));
      }
    }
}
View Full Code Here

        System.out.println("Test started");
        for (int i = 0; i != 100; ++i ) {
                System.out.println("Iter " + i);
                final GroovyClassLoader groovyLoader = new GroovyClassLoader ();
                groovyLoader.addClasspath(path);

                Class _script1Class = null;
                try {
                    _script1Class = groovyLoader.loadClass("Script1", true, true);
                } catch (ClassNotFoundException e) {
View Full Code Here

            javaHome = javaHome.substring(0, javaHome.length() - 4);
        }
        File toolsJar = new File((javaHome + "/lib/tools.jar"));
        if (toolsJar.exists()) {
            GroovyClassLoader loader = cu.getClassLoader();
            loader.addClasspath(toolsJar.getAbsolutePath());
            return loader.loadClass(main);
        }
       
        throw new ClassNotFoundException("unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings");
    }
View Full Code Here

        Path path = getClasspath();
        if (path != null) {
            final String[] filePaths = path.list();
            for (int i = 0; i < filePaths.length; i++) {
                String filePath = filePaths[i];
                gcl.addClasspath(filePath);
            }
        }

        return gcl;
    }
View Full Code Here

        }
        try{
            GroovyClassLoader gcl = new GroovyClassLoader(TestUtil.class.getClassLoader());
            File[] dependencies = ConfigUtil.getTestDependencies();
            for(File dependency: dependencies) {
                gcl.addClasspath(dependency.getAbsolutePath());
            }

            Class testClass = gcl.parseClass(script, "__GenRESTTestCase__");

            TestSuite suite = new GroovyTestSuite();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.