Package org.apache.maven.bootstrap.util

Examples of org.apache.maven.bootstrap.util.IsolatedClassLoader


    {
        System.out.println( "Checking for dependencies ..." );

        resolver.downloadDependencies( dependencies );

        IsolatedClassLoader cl;
        if ( parent == null )
        {
            cl = new IsolatedClassLoader();
        }
        else
        {
            cl = new IsolatedClassLoader( parent );
        }

        for ( Iterator i = dependencies.iterator(); i.hasNext(); )
        {
            Dependency dependency = (Dependency) i.next();

            File f = resolver.getArtifactFile( dependency );
            if ( !f.exists() )
            {
                String msg =
                    ( !resolver.isOnline() ? "; run again online" : "; there was a problem downloading it earlier" );
                throw new FileNotFoundException( "Missing dependency: " + dependency + msg );
            }

            // Classes won't be unloaded, but we might delete the JAR, so they need to be copied to a temporary location
            File newFile = File.createTempFile( "maven-bootstrap", "dep" );
            newFile.deleteOnExit();
            FileUtils.copyFile( f, newFile );
            cl.addURL( newFile.toURL() );
        }

        return cl;
    }
View Full Code Here


        for ( int i = 0; i < sources.length; i++ )
        {
            args.add( sources[i] );
        }

        IsolatedClassLoader cl = new IsolatedClassLoader();

        File toolsJar = new File( System.getProperty( "java.home" ), "../lib/tools.jar" );

        if ( toolsJar.exists() )
        {
            cl.addURL( toolsJar.toURL() );
        }

        Class c = cl.loadClass( "com.sun.tools.javac.Main" );

        ByteArrayOutputStream err = new ByteArrayOutputStream();

        Method compile = c.getMethod( "compile", new Class[]{String[].class} );
View Full Code Here

    {
        System.out.println( "Checking for dependencies ..." );

        resolver.downloadDependencies( dependencies );

        IsolatedClassLoader cl;
        if ( parent == null )
        {
            cl = new IsolatedClassLoader();
        }
        else
        {
            cl = new IsolatedClassLoader( parent );
        }

        for ( Iterator i = dependencies.iterator(); i.hasNext(); )
        {
            Dependency dependency = (Dependency) i.next();

            File f = resolver.getArtifactFile( dependency );
            if ( !f.exists() )
            {
                String msg =
                    ( !resolver.isOnline() ? "; run again online" : "; there was a problem downloading it earlier" );
                throw new FileNotFoundException( "Missing dependency: " + dependency + msg );
            }

            // Classes won't be unloaded, but we might delete the JAR, so they need to be copied to a temporary location
            File newFile = File.createTempFile( "maven-bootstrap", "dep" );
            newFile.deleteOnExit();
            FileUtils.copyFile( f, newFile );
            cl.addURL( newFile.toURL() );
        }

        return cl;
    }
View Full Code Here

    for (int i = 0; i < sources.length; i++) {
      args.add(sources[i]);
    }

    IsolatedClassLoader cl = new IsolatedClassLoader();

    File toolsJar = CommonUtil.getCompilerJar();
    if (toolsJar.exists()) {
      cl.addURL(toolsJar.toURI().toURL());
    }

    Class c = cl.loadClass("com.sun.tools.javac.Main");

    ByteArrayOutputStream err = new ByteArrayOutputStream();

    Method compile = c.getMethod("compile", new Class[]{String[].class});
View Full Code Here

    {
        System.out.println( "Checking for dependencies ..." );

        resolver.downloadDependencies( dependencies );

        IsolatedClassLoader cl;
        if ( parent == null )
        {
            cl = new IsolatedClassLoader();
        }
        else
        {
            cl = new IsolatedClassLoader( parent );
        }

        for ( Iterator i = dependencies.iterator(); i.hasNext(); )
        {
            Dependency dependency = (Dependency) i.next();

            File f = resolver.getArtifactFile( dependency );
            if ( !f.exists() )
            {
                String msg =
                    ( !resolver.isOnline() ? "; run again online" : "; there was a problem downloading it earlier" );
                throw new FileNotFoundException( "Missing dependency: " + dependency + msg );
            }

            // Classes won't be unloaded, but we might delete the JAR, so they need to be copied to a temporary location
            File newFile = File.createTempFile( "maven-bootstrap", "dep" );
            newFile.deleteOnExit();
            FileUtils.copyFile( f, newFile );
            cl.addURL( newFile.toURL() );
        }

        return cl;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.bootstrap.util.IsolatedClassLoader

Copyright © 2018 www.massapicom. 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.