public Object call() throws Throwable { // by the time this method is invoked on the master, proxy points to a real object proxy.execute(program); return null; // ignore the result, as there's no point in sending it back }
public FilePath getRootDir() { return core.getRootDir(); }
/** * Called at the end of each maven ?goal?. * - so if the maven args are pmd:pmd checkstyle:checkstyle * this will get called twice. */ @Override public boolean postExecute( MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener, Throwable error) throws InterruptedException, IOException { build.execute(new BuildCallable<Void, IOException>() { public Void call(final MavenBuild build) throws IOException, InterruptedException { // Create the violations build action - if not already built. // This needes to be done here, otherwise aggregated actions // do not get created. // (aggreatedactions get created after the postExecute(), but // before the end() getCreateBuildAction(build); return null; } }); // Need to register the MavenReporter as a ProjectAction if (!registered) { build.registerAsProjectAction(this); registered = true; } return true; }
listener.getLogger().println("[JENKINS] ..."); listener.getLogger().println("[JENKINS] Code coverage reports would be enabled"); build.setResult(Result.UNSTABLE); return true; build.setResult(Result.UNSTABLE); return true; FilePath target = build.getRootDir(); Util.displayIOException(e, listener); e.printStackTrace(listener.fatalError("Unable to copy " + reportFilePath + " to " + target)); build.setResult(Result.FAILURE); Util.displayIOException(e, listener); e.printStackTrace(listener.fatalError("Unable to parse " + reportFilePath)); build.setResult(Result.FAILURE); final FilePath paintedSourcesPath = build.getProjectRootDir().child("cobertura"); paintedSourcesPath.mkdirs(); if (!build.execute(new MavenCoberturaActionAdder(listener))) { listener.getLogger().println("[JENKINS] Unable to add link to cobertura results"); build.setResult(Result.FAILURE); return true; build.setResult(Result.FAILURE); return true;
mavenBuildProxy.getArtifactsDir(), mavenBuildProxy.getProjectRootDir(), mavenBuildProxy.getRootDir(), new FilePath(pom.getBasedir()), mavenBuildProxy.getTimestamp()); return mavenBuildProxy.execute(new BuildProxyCallableHelper(buildProxy, ghostwriter, listener)); } catch (Exception e) { throw unwrapException(e, listener);
} catch (ComponentConfigurationException e) { e.printStackTrace(listener.fatalError(Messages.MavenJavadocArchiver_NoDestDir())); build.setResult(Result.FAILURE); return true; target = build.getModuleSetRootDir(); } else { listener.getLogger().println("[HUDSON] Archiving javadoc"); target = build.getProjectRootDir(); Util.displayIOException(e,listener); e.printStackTrace(listener.fatalError(Messages.MavenJavadocArchiver_FailedToCopy(destDir,target))); build.setResult(Result.FAILURE); build.registerAsAggregatedProjectAction(this); else build.registerAsProjectAction(this);
build.execute(new BuildCallable<Void, IOException>() { public Void call(final MavenBuild mavenBuild) throws IOException, InterruptedException { persistResult(result, mavenBuild); copyFilesWithAnnotationsToBuildFolder(logger, build.getRootDir(), result.getAnnotations());
} catch (ComponentConfigurationException e) { e.printStackTrace(listener.fatalError(Messages.SurefireArchiver_NoReportsDir())); build.setResult(Result.FAILURE); return true; return true; result.parse(System.currentTimeMillis() - build.getMilliSecsSinceBuildStart(), fileSet); int failCount = build.execute( new SurefireArchiverBuildCallable(r, listener)); markBuildAsSuccess(error,build.getMavenBuildInformation()); hasTestFailures.set(true);
} catch (ComponentConfigurationException e) { e.printStackTrace(listener.fatalError(Messages.SurefireArchiver_NoReportsDir())); build.setResult(Result.FAILURE); return true; result.parse(System.currentTimeMillis() - build.getMilliSecsSinceBuildStart(), ds); int failCount = build.execute(new BuildCallable<Integer, IOException>() { public Integer call(MavenBuild build) throws IOException, InterruptedException { SurefireReport sr = build.getAction(SurefireReport.class);
/** * In multi module builds, ascend to the parents until hitting the project * root. * * @param build * @param pom * * @return the relative path component to copy sites of multi module builds. * @throws IOException * @throws InterruptedException */ private FilePath getModulePath(MavenBuildProxy build, MavenProject pom) throws IOException, InterruptedException { String rootArtifactId = build.execute(new MavenSiteArchiverBuildCallable()); String path = ""; MavenProject currentLevel = pom; // build the path to the module by ascending to the parent pom until the root project while (!rootArtifactId.equals(currentLevel.getArtifactId())) { path = currentLevel.getArtifactId() + File.separator + path; currentLevel = currentLevel.getParent(); } return build.getModuleSetRootDir().child("site").child(path); }
build.execute(new MavenBuildProxyCallable(pomArtifact, mainArtifact, attachedArtifacts, repositoryUrl, repositoryId)); if (build.isArchivingDisabled()) { listener.getLogger().println("[JENKINS] Archiving disabled"); } else if (assemblies!=null) { String target = assembly.getName(); listener.getLogger().println("[JENKINS] Archiving "+ assembly+" to "+target); build.queueArchiving(target, assembly.getAbsolutePath());
public void registerAsProjectAction(MavenProjectActionBuilder builder) { core.registerAsProjectAction(builder); }
public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener, Throwable error) throws InterruptedException, IOException { if(!mojo.is("org.apache.maven.plugins","maven-site-plugin","site")) return true; File destDir; try { destDir = mojo.getConfigurationValue("outputDirectory", File.class); } catch (ComponentConfigurationException e) { e.printStackTrace(listener.fatalError("Unable to find the site output directory")); build.setResult(Result.FAILURE); return true; } 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("[HUDSON] 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); } build.registerAsAggregatedProjectAction(this); } return true; }
build.executeAsync(new MavenBuildProxy.BuildCallable<Void,IOException>() { public Void call(MavenBuild build) throws IOException, InterruptedException { if(mavenArtifacts.contains(assembly)) continue; // looks like this is already archived if (build.isArchivingDisabled()) { listener.getLogger().println("[HUDSON] Archiving disabled - not archiving " + assembly); FilePath target = build.getArtifactsDir().child(assembly.getName()); listener.getLogger().println("[HUDSON] Archiving "+ assembly+" to "+target); new FilePath(assembly).copyTo(target);
public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener, Throwable error) throws InterruptedException, IOException { if(!mojo.is("org.apache.maven.plugins","maven-site-plugin","site")) return true; if(build.isSiteArchivingDisabled()) { listener.getLogger().println("[JENKINS] Archiving disabled - not archiving site for " + pom.getName()); return true; } File destDir; try { destDir = mojo.getConfigurationValue("outputDirectory", File.class); } catch (ComponentConfigurationException e) { e.printStackTrace(listener.fatalError("Unable to find the site output directory")); build.setResult(Result.FAILURE); return true; } if(destDir != null && destDir.exists()) { // try to get the storage location if this is a multi-module project. final FilePath target = getModulePath(build, pom); 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); } build.registerAsAggregatedProjectAction(this); } return true; }
public void executeAsync(BuildCallable<?, ?> program) throws IOException { core.executeAsync(program); }
public MavenBuildInformation getMavenBuildInformation() { return super.core.getMavenBuildInformation(); }
public void setResult(Result result) { core.setResult(result); }
public FilePath getProjectRootDir() { return core.getProjectRootDir(); }
public FilePath getArtifactsDir() { return core.getArtifactsDir(); }