Package hudson

Examples of hudson.FilePath$TunneledInterruptedException


        if(destDir.exists()) {
            // try to get the storage location if this is a multi-module project.
            final String moduleName = getModuleName(build, pom);
            // store at MavenModuleSet level and moduleName
            final FilePath target = build.getModuleSetRootDir().child("site").child(moduleName);
            try {
                listener.getLogger().printf("[JENKINS] Archiving site from %s to %s\n", destDir, target);
                new FilePath(destDir).copyRecursiveTo("**/*",target);
            } catch (IOException e) {
                Util.displayIOException(e,listener);
                e.printStackTrace(listener.fatalError("Unable to copy site from %s to %s",destDir,target));
                build.setResult(Result.FAILURE);
            }
View Full Code Here


        MavenInstallation m=null;
        File settingsLoc = null, remoteGlobalSettingsFromConfig = null;
        String profiles = null;
        Properties systemProperties = null;
        String privateRepository = null;
        FilePath remoteSettingsFromConfig = null;
       
        File tmpSettings = File.createTempFile( "jenkins", "temp-settings.xml" );
        try {
            AbstractProject project = build.getProject();
           
            if (project instanceof MavenModuleSet) {
                MavenModuleSet mavenModuleSet = ((MavenModuleSet) project);
                profiles = mavenModuleSet.getProfiles();
                systemProperties = mavenModuleSet.getMavenProperties();
               
                // olamy see 
                // we have to take about the settings use for the project
                // order tru configuration
                // TODO maybe in goals with -s,--settings last wins but not done in during pom parsing
                // or -Dmaven.repo.local
                // if not we must get ~/.m2/settings.xml then $M2_HOME/conf/settings.xml
               
                // TODO check if the remoteSettings has a localRepository configured and disabled it

                String settingsConfigId = mavenModuleSet.getSettingConfigId();
                String altSettingsPath = null;

                if (!StringUtils.isBlank(settingsConfigId)) {
                    SettingConfig config = SettingsProviderUtils.findSettings(settingsConfigId);
                    if (config == null) {
                        listener.getLogger().println(
                            " your Apache Maven build is setup to use a config with id " + settingsConfigId
                                + " but cannot find the config" );
                    } else {
                        listener.getLogger().println( "redeploy publisher using settings config with name " + config.name );
                        if (config.content != null ) {
                            remoteSettingsFromConfig = SettingsProviderUtils.copyConfigContentToFilePath( config, build.getWorkspace() );
                            altSettingsPath = remoteSettingsFromConfig.getRemote();
                        }
                    }
                }

                if (mavenModuleSet.getAlternateSettings() != null ) {
                    altSettingsPath = mavenModuleSet.getAlternateSettings();
                }

                String globalSettingsConfigId = mavenModuleSet.getGlobalSettingConfigId();
                if (!StringUtils.isBlank(globalSettingsConfigId)) {
                    SettingConfig config = SettingsProviderUtils.findSettings(globalSettingsConfigId);
                    if (config == null) {
                        listener.getLogger().println(
                            " your Apache Maven build is setup to use a global settings config with id "
                                + globalSettingsConfigId + " but cannot find the config" );
                    } else {
                        listener.getLogger().println( "redeploy publisher using global settings config with name " + config.name );
                        if (config.content != null ) {
                            remoteGlobalSettingsFromConfig = SettingsProviderUtils.copyConfigContentToFile( config );
                        }
                    }
                }
                Node buildNode = build.getBuiltOn();
               
                if(buildNode == null) {
                    // assume that build was made on master
                    buildNode = Jenkins.getInstance();
                }

                if (StringUtils.isBlank( altSettingsPath ) ) {
                    // get userHome from the node where job has been executed
                    String remoteUserHome = build.getWorkspace().act( new GetUserHome() );
                    altSettingsPath = remoteUserHome + "/.m2/settings.xml";
                }
               
                // we copy this file in the master in a  temporary file
                FilePath filePath = new FilePath( tmpSettings );
                FilePath remoteSettings = build.getWorkspace().child( altSettingsPath );
                if (!remoteSettings.exists()) {
                    // JENKINS-9084 we finally use $M2_HOME/conf/settings.xml as maven do
                   
                    String mavenHome =
                        ((MavenModuleSet) project).getMaven().forNode(buildNode, listener ).getHome();
                    String settingsPath = mavenHome + "/conf/settings.xml";
                    remoteSettings = build.getWorkspace().child( settingsPath);
                }
                listener.getLogger().println( "Maven RedeployPublished use remote " + (buildNode != null ? buildNode.getNodeName() : "local"
                                              + " maven settings from : " + remoteSettings.getRemote() );
                remoteSettings.copyTo( filePath );
                settingsLoc = tmpSettings;
               
            }

            MavenEmbedderRequest mavenEmbedderRequest = new MavenEmbedderRequest(listener,
View Full Code Here

        // 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);
        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",
View Full Code Here

        if (System.getenv("ANT_HOME") != null) {
            antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), NO_PROPERTIES);
        } else {
            LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " +
                    "To avoid a performance hit, set the environment variable ANT_HOME to point to an  Ant installation.");
            FilePath ant = hudson.getRootPath().createTempFile("ant", "zip");
            ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip"));
            File antHome = createTmpDir();
            ant.unzip(new FilePath(antHome));
            // TODO: switch to tar that preserves file permissions more easily
            if(!Functions.isWindows())
                GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755);

            antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES);
View Full Code Here

        /**
         * Serves the site.
         */
        public DirectoryBrowserSupport doDynamic() {
            return new DirectoryBrowserSupport(this,new FilePath(getSiteDir(project)), project.getDisplayName()+" site", "help.gif", false);
        }
View Full Code Here

            listener.error("Maven '%s' doesn't have its home set",mvn.getName());
            throw new RunnerAbortedException();
        }

        boolean isMaster = getCurrentNode()== Jenkins.getInstance();
        FilePath slaveRoot=null;
        if(!isMaster)
            slaveRoot = getCurrentNode().getRootPath();

        ArgumentListBuilder args = new ArgumentListBuilder();
        JDK jdk = getJava(listener);
View Full Code Here

        protected Result doRun(final BuildListener listener) throws Exception {

          Result r = null;
          PrintStream logger = listener.getLogger();
            FilePath remoteSettings = null, remoteGlobalSettings = null;

            try {
             
                EnvVars envVars = getEnvironment(listener);
                MavenInstallation mvn = project.getMaven();
                if(mvn==null)
                    throw new AbortException(Messages.MavenModuleSetBuild_NoMavenConfigured());

                mvn = mvn.forEnvironment(envVars).forNode(Computer.currentComputer().getNode(), listener);
               
                MavenInformation mavenInformation = getModuleRoot().act( new MavenVersionCallable( mvn.getHome() ));
               
                String mavenVersion = mavenInformation.getVersion();
               
                MavenBuildInformation mavenBuildInformation = new MavenBuildInformation( mavenVersion );
               
                setMavenVersionUsed( mavenVersion );

                LOGGER.fine(getFullDisplayName()+" is building with mavenVersion " + mavenVersion + " from file " + mavenInformation.getVersionResourcePath());

                if(!project.isAggregatorStyleBuild()) {
                    parsePoms(listener, logger, envVars, mvn, mavenVersion);
                    // start module builds
                    logger.println("Triggering "+project.getRootModule().getModuleName());
                    project.getRootModule().scheduleBuild(new UpstreamCause((Run<?,?>)MavenModuleSetBuild.this));
                } else {
                    // do builds here
                    try {
                        List<BuildWrapper> wrappers = new ArrayList<BuildWrapper>();
                        for (BuildWrapper w : project.getBuildWrappersList())
                            wrappers.add(w);
                        ParametersAction parameters = getAction(ParametersAction.class);
                        if (parameters != null)
                            parameters.createBuildWrappers(MavenModuleSetBuild.this,wrappers);

                        for( BuildWrapper w : wrappers) {
                            Environment e = w.setUp(MavenModuleSetBuild.this, launcher, listener);
                            if(e==null)
                                return (r = Result.FAILURE);
                            buildEnvironments.add(e);
                            e.buildEnvVars(envVars); // #3502: too late for getEnvironment to do this
                        }

                      // run pre build steps
                      if(!preBuild(listener,project.getPrebuilders())
                        || !preBuild(listener,project.getPostbuilders())
                        || !preBuild(listener,project.getPublishers())){
                        r = FAILURE;
                            return r;
                      }

                      if(!build(listener,project.getPrebuilders().toList())){
                        r = FAILURE;
                            return r;
                  }

                        String settingsConfigId = project.getSettingConfigId();
                        if (StringUtils.isNotBlank(settingsConfigId)) {
                            SettingConfig settingsConfig = SettingsProviderUtils.findSettings(settingsConfigId);
                            if (settingsConfig == null) {
                                logger.println(" your Apache Maven build is setup to use a config with id " + settingsConfigId
                                                   + " but cannot find the config");
                            } else {
                                logger.println("using settings config with name " + settingsConfig.name);
                                if (settingsConfig.content != null ) {
                                    remoteSettings = SettingsProviderUtils.copyConfigContentToFilePath( settingsConfig, getWorkspace() );
                                    project.setAlternateSettings( remoteSettings.getRemote() );
                                }
                            }
                        }

                        String globalSettingsConfigId = project.getGlobalSettingConfigId();
                        if (StringUtils.isNotBlank(globalSettingsConfigId)) {
                            SettingConfig settingsConfig = SettingsProviderUtils.findSettings(globalSettingsConfigId);
                            if (settingsConfig == null) {
                                logger.println(" your Apache Maven build is setup to use a global settings config with id " + globalSettingsConfigId
                                                   + " but cannot find the config");
                            } else {
                                logger.println("using global settings config with name " + settingsConfig.name);
                                if (settingsConfig.content != null ) {
                                    remoteGlobalSettings = SettingsProviderUtils.copyConfigContentToFilePath( settingsConfig, getWorkspace() );
                                    project.globalSettingConfigPath = remoteGlobalSettings.getRemote();
                                }
                            }
                        } else {
                          // make sure the transient field is clean
                          project.globalSettingConfigPath = null;
                        }

                        parsePoms(listener, logger, envVars, mvn, mavenVersion); // #5428 : do pre-build *before* parsing pom
                        SplittableBuildListener slistener = new SplittableBuildListener(listener);
                        proxies = new HashMap<ModuleName, ProxyImpl2>();
                        List<ModuleName> changedModules = new ArrayList<ModuleName>();
                       
                        if (project.isIncrementalBuild() && !getChangeSet().isEmptySet()) {
                            changedModules.addAll(getUnbuildModulesSinceLastSuccessfulBuild());
                        }

                        for (MavenModule m : project.sortedActiveModules) {
                            MavenBuild mb = m.newBuild();
                            // JENKINS-8418
                            mb.setBuiltOnStr( getBuiltOnStr() );
                            // Check if incrementalBuild is selected and that there are changes -
                            // we act as if incrementalBuild is not set if there are no changes.
                            if (!MavenModuleSetBuild.this.getChangeSet().isEmptySet()
                                && project.isIncrementalBuild()) {
                                //If there are changes for this module, add it.
                                // Also add it if we've never seen this module before,
                                // or if the previous build of this module failed or was unstable.
                                if ((mb.getPreviousBuiltBuild() == null) ||
                                    (!getChangeSetFor(m).isEmpty())
                                    || (mb.getPreviousBuiltBuild().getResult().isWorseThan(Result.SUCCESS))) {
                                    changedModules.add(m.getModuleName());
                                }
                            }

                            mb.setWorkspace(getModuleRoot().child(m.getRelativePath()));
                            proxies.put(m.getModuleName(), mb.new ProxyImpl2(MavenModuleSetBuild.this,slistener));
                        }

                        // run the complete build here

                        // figure out the root POM location.
                        // choice of module root ('ws' in this method) is somewhat arbitrary
                        // when multiple CVS/SVN modules are checked out, so also check
                        // the path against the workspace root if that seems like what the user meant (see issue #1293)
                        String rootPOM = project.getRootPOM(envVars); // JENKINS-13822
                        FilePath pom = getModuleRoot().child(rootPOM);
                        FilePath parentLoc = getWorkspace().child(rootPOM);
                        if(!pom.exists() && parentLoc.exists())
                            pom = parentLoc;

                       
                        final ProcessCache.MavenProcess process;
                       
                        boolean maven3orLater = mavenBuildInformation.isMaven3OrLater();
                        if ( maven3orLater )
                        {
                            LOGGER.fine( "using maven 3 " + mavenVersion );
                            process =
                                MavenBuild.mavenProcessCache.get( launcher.getChannel(), slistener,
                                                                  new Maven3ProcessFactory( project, launcher, envVars, getMavenOpts(listener, envVars),
                                                                                            pom.getParent() ) );
                        }
                        else
                        {
                            LOGGER.fine( "using maven 2 " + mavenVersion );
                            process =
                                MavenBuild.mavenProcessCache.get( launcher.getChannel(), slistener,
                                                                  new MavenProcessFactory( project, launcher, envVars,getMavenOpts(listener, envVars),
                                                                                           pom.getParent() ) );
                        }
                        ArgumentListBuilder margs = new ArgumentListBuilder().add("-B").add("-f", pom.getRemote());
                        FilePath localRepo = project.getLocalRepository().locate(MavenModuleSetBuild.this);
                        if(localRepo!=null)
                            margs.add("-Dmaven.repo.local="+localRepo.getRemote());

                        if (project.globalSettingConfigPath != null)
                            margs.add("-gs" , project.globalSettingConfigPath);


                       
                        // If incrementalBuild is set
                        // and the previous build didn't specify that we need a full build
                        // and we're on Maven 2.1 or later
                        // and there's at least one module listed in changedModules,
                        // then do the Maven incremental build commands.
                        // If there are no changed modules, we're building everything anyway.
                        boolean maven2_1orLater = new ComparableVersion (mavenVersion).compareTo( new ComparableVersion ("2.1") ) >= 0;
                        boolean needsFullBuild = getPreviousCompletedBuild() != null &&
                            getPreviousCompletedBuild().getAction(NeedsFullBuildAction.class) != null;
                        if (project.isIncrementalBuild() && !needsFullBuild && maven2_1orLater && !changedModules.isEmpty()) {
                            margs.add("-amd");
                            margs.add("-pl", Util.join(changedModules, ","));
                        }

                        if (project.getAlternateSettings() != null) {
                            if (IOUtils.isAbsolute(project.getAlternateSettings())) {
                                margs.add("-s").add(project.getAlternateSettings());
                            } else {
                                FilePath mrSettings = getModuleRoot().child(project.getAlternateSettings());
                                FilePath wsSettings = getWorkspace().child(project.getAlternateSettings());
                                if (!wsSettings.exists() && mrSettings.exists())
                                    wsSettings = mrSettings;
                               
                                margs.add("-s").add(wsSettings.getRemote());
                            }
                        }

                       
                        final List<MavenArgumentInterceptorAction> argInterceptors = this.getBuild().getActions(MavenArgumentInterceptorAction.class);
View Full Code Here

     */
    public synchronized void dispose() throws IOException, InterruptedException {
        IOException x = null;
        for (File dir : tmpDirectories)
            try {
                new FilePath(dir).deleteRecursive();
            } catch (IOException e) {
                x = e;
            }
        tmpDirectories.clear();
        if (x!=null)    throw new IOException2("Failed to clean up temp dirs",x);
View Full Code Here

        new Thread("Disposing "+base) {
            public void run() {
                for (File dir : tbr)
                    try {
                        new FilePath(dir).deleteRecursive();
                    } catch (IOException e) {
                        e.printStackTrace();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
View Full Code Here

           
            this.nonRecursive = project.isNonRecursive();

            this.workspaceProper = build.getWorkspace().getRemote();
            LOGGER.fine("Workspace is " + workspaceProper);
            FilePath localRepo = project.getLocalRepository().locate(build);
            if (localRepo!=null) {
                this.privateRepository = localRepo.getRemote();
            } else {
                this.privateRepository = null;
            }
            // TODO maybe in goals with -s,--settings
            // or -Dmaven.repo.local
View Full Code Here

TOP

Related Classes of hudson.FilePath$TunneledInterruptedException

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.