Package groovy.lang

Examples of groovy.lang.GroovyClassLoader.addClasspath()


        try {
            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


            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

            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

        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

        final GroovyClassLoader astTransformClassLoader = new GroovyClassLoader(groovyCompilerClassLoader, null);
        // can't delegate to compileClasspathLoader because this would result in ASTTransformation interface
        // (which is implemented by the transform class) being loaded by compileClasspathClassLoader (which is
        // where the transform class is loaded from)
        for (File file : spec.getClasspath()) {
            astTransformClassLoader.addClasspath(file.getPath());
        }

        JavaAwareCompilationUnit unit = new JavaAwareCompilationUnit(configuration, compileClasspathClassLoader) {
            @Override
            public GroovyClassLoader getTransformLoader() {
View Full Code Here

        }

        GroovyClassLoader classLoader = new GroovyClassLoader(baseClassLoader);
        if (task.getCommandLine().getClasspath() != null) {
            for (String path : task.getCommandLine().getClasspath().list()) {
                classLoader.addClasspath(path);
            }
        }
       
        CompilerConfiguration configuration = new CompilerConfiguration();
        if (task.stacktrace) {
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.