Package hudson.tasks.Maven

Examples of hudson.tasks.Maven.MavenInstallation


        // We need to add M2_HOME and the mvn binary to the PATH so if Maven
        // needs to run Maven it will pick the correct one.
        // This can happen if maven calls ANT which itself calls Maven
        // or if Maven calls itself e.g. maven-release-plugin
        MavenInstallation mvn = project.getParent().getMaven();
        if (mvn == null)
            throw new hudson.AbortException(Messages.MavenModuleSetBuild_NoMavenConfigured());
        mvn = mvn.forEnvironment(envs).forNode(Computer.currentComputer().getNode(), log);
        mvn.buildEnvVars(envs);
        return envs;
    }
View Full Code Here


    /**
     * Gets or creates a new maven process for launch.
     */
    public MavenProcess get(VirtualChannel owner, BuildListener listener, Factory factory) throws InterruptedException, IOException {
        String mavenOpts = factory.getMavenOpts();
        MavenInstallation installation = factory.getMavenInstallation(listener);
        JDK jdk = factory.getJava(listener);

        PerChannel list = get(owner);
        synchronized(list.processes) {
            for (Iterator<MavenProcess> itr = list.processes.iterator(); itr.hasNext();) {
View Full Code Here

    JDK varJDK = new JDK("varJDK", withVariable(defaultJDK.getHome()));
    hudson.getJDKs().add(varJDK);

    // Maven with a variable in its path
    configureDefaultMaven();
    MavenInstallation defaultMaven = hudson.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations()[0];
    MavenInstallation varMaven = new MavenInstallation("varMaven",
        withVariable(defaultMaven.getHome()), NO_PROPERTIES);
    hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(varMaven);

    // Ant with a variable in its path
        AntInstallation ant = configureDefaultAnt();
View Full Code Here

    protected MavenInstallation configureDefaultMaven() throws Exception {
        return configureDefaultMaven("apache-maven-2.2.1", MavenInstallation.MAVEN_20);
    }
   
    protected MavenInstallation configureMaven3() throws Exception {
        MavenInstallation mvn = configureDefaultMaven("apache-maven-3.0.1", MavenInstallation.MAVEN_30);
       
        MavenInstallation m3 = new MavenInstallation("apache-maven-3.0.1",mvn.getHome(), NO_PROPERTIES);
        hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3);
        return m3;
    }   
View Full Code Here

        // does it exists in the buildDirectory see maven-junit-plugin systemProperties
        // buildDirectory -> ${project.build.directory} (so no reason to be null ;-) )
        String buildDirectory = System.getProperty( "buildDirectory", "./target/classes/" );
        File mavenAlreadyInstalled = new File(buildDirectory, mavenVersion);
        if (mavenAlreadyInstalled.exists()) {
            MavenInstallation mavenInstallation = new MavenInstallation("default",mavenAlreadyInstalled.getAbsolutePath(), NO_PROPERTIES);
            hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
            return mavenInstallation;
        }
        String home = System.getProperty("maven.home");
        if(home!=null) {
            MavenInstallation mavenInstallation = new MavenInstallation("default",home, NO_PROPERTIES);
            if (mavenInstallation.meetsMavenReqVersion(createLocalLauncher(), mavenReqVersion)) {
                hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
                return mavenInstallation;
            }
        }

        // otherwise extract the copy we have.
        // this happens when a test is invoked from an IDE, for example.
        LOGGER.warning("Extracting a copy of Maven bundled in the test harness. " +
                "To avoid a performance hit, set the system property 'maven.home' to point to a Maven2 installation.");
        FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip");
        mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
        File mvnHome =  new File(buildDirectory);//createTmpDir();
        mvn.unzip(new FilePath(mvnHome));
        // TODO: switch to tar that preserves file permissions more easily
        if(!Functions.isWindows())
            GNUCLibrary.LIBC.chmod(new File(mvnHome,mavenVersion+"/bin/mvn").getPath(),0755);

        MavenInstallation mavenInstallation = new MavenInstallation("default",
                new File(mvnHome,mavenVersion).getAbsolutePath(), NO_PROPERTIES);
    hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
    return mavenInstallation;
    }
View Full Code Here

TOP

Related Classes of hudson.tasks.Maven.MavenInstallation

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.