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 }
@SuppressWarnings("serial") private Settings receiveSettingsFromMaster(final MavenBuildProxy build) throws IOException, InterruptedException { return build.execute(new BuildCallable<Settings, IOException>() { @Override public Settings call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return new SerializableSettings(GlobalSettings.instance()); }}); }
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 <V, T extends Throwable> V execute(BuildCallable<V, T> program) throws T, IOException, InterruptedException { return core.execute(program); }
public <V, T extends Throwable> V execute(BuildCallable<V, T> program) throws T, IOException, InterruptedException { return core.execute(program); }
/** * Returns whether we already have a result for this build. * * @param build * the current build. * @return <code>true</code> if we already have a task result action. * @throws IOException * in case of an IO error * @throws InterruptedException * if the call has been interrupted */ @SuppressWarnings("serial") private Boolean hasResultAction(final MavenBuildProxy build) throws IOException, InterruptedException { return build.execute(new BuildCallable<Boolean, IOException>() { public Boolean call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return mavenBuild.getAction(getResultActionClass()) != null; } }); }
/** * Returns whether we already have a result for this build. * * @param build * the current build. * @return <code>true</code> if we already have a task result action. * @throws IOException * in case of an IO error * @throws InterruptedException * if the call has been interrupted */ @SuppressWarnings("serial") private Boolean hasResultAction(final MavenBuildProxy build) throws IOException, InterruptedException { return build.execute(new BuildCallable<Boolean, IOException>() { public Boolean call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return mavenBuild.getAction(getResultActionClass()) != null; } }); }
/** * Returns whether we already have a result for this build. * * @param build * the current build. * @return <code>true</code> if we already have a task result action. * @throws IOException * in case of an IO error * @throws InterruptedException * if the call has been interrupted */ @SuppressWarnings("serial") private Boolean hasResultAction(final MavenBuildProxy build) throws IOException, InterruptedException { return build.execute(new BuildCallable<Boolean, IOException>() { @Override public Boolean call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return mavenBuild.getAction(getResultActionClass()) != null; } }); }
/** * Returns whether we already have a result for this build. * * @param build * the current build. * @return <code>true</code> if we already have a task result action. * @throws IOException * in case of an IO error * @throws InterruptedException * if the call has been interrupted */ @SuppressWarnings("serial") private Boolean hasResultAction(final MavenBuildProxy build) throws IOException, InterruptedException { return build.execute(new BuildCallable<Boolean, IOException>() { @Override public Boolean call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return mavenBuild.getAction(getResultActionClass()) != null; } }); }
private void registerResultsOnMaster(final MavenBuildProxy build, final ParserResult result, final PluginLogger logger) throws IOException, InterruptedException { @SuppressWarnings("serial") String resultLog = build.execute(new BuildCallable<String, IOException>() { @Override public String call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return registerResults(result, mavenBuild); } }); logger.logLines(resultLog); }
/** * Returns the current result of the build. * * @param build * the build proxy * @return the current result of the build * @throws IOException * if the results could not be read * @throws InterruptedException * if the user canceled the operation */ private Result getCurrentResult(final MavenBuildProxy build) throws IOException, InterruptedException { return build.execute(new BuildResultCallable()); }
/** * Returns the current result of the build. * * @param build * the build proxy * @return the current result of the build * @throws IOException * if the results could not be read * @throws InterruptedException * if the user canceled the operation */ private Result getCurrentResult(final MavenBuildProxy build) throws IOException, InterruptedException { return build.execute(new BuildResultCallable()); }
/** * Returns the current result of the build. * * @param build * the build proxy * @return the current result of the build * @throws IOException * if the results could not be read * @throws InterruptedException * if the user canceled the operation */ private Result getCurrentResult(final MavenBuildProxy build) throws IOException, InterruptedException { return build.execute(new BuildResultCallable()); }
/** * Returns the current result of the build. * * @param build * the build proxy * @return the current result of the build * @throws IOException * if the results could not be read * @throws InterruptedException * if the user canceled the operation */ private Result getCurrentResult(final MavenBuildProxy build) throws IOException, InterruptedException { return build.execute(new BuildResultCallable()); }
/** * In multi module builds pomBaseDir of the parent project is the same as parent build module root. * * @param build * @param pom * * @return the relative path component to copy sites of multi module builds. * @throws IOException */ private String getModuleName(MavenBuildProxy build, MavenProject pom) throws IOException { final String moduleRoot; try { moduleRoot = build.execute(new BuildCallable<String, IOException>() { //@Override public String call(MavenBuild mavenBuild) throws IOException, InterruptedException { return mavenBuild.getParentBuild().getModuleRoot().getRemote(); } }); } catch (InterruptedException e) { throw new RuntimeException(e); } final File pomBaseDir = pom.getBasedir(); final File remoteWorkspaceDir = new File(moduleRoot); if (pomBaseDir.equals(remoteWorkspaceDir)) { return ""; } else { return pom.getArtifactId(); } }
/** * 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; }
/** * 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>() { @Override 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; }
/** * 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); }
public boolean preExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener) throws InterruptedException, IOException { if(mojo.pluginName.groupId.equals("org.apache.maven.plugins") && keys.contains(mojo.pluginName.artifactId+':'+mojo.getGoal())) { // touch <archive><manifestEntries><Build-Numer>#n Map<String,String> props = build.execute(new BuildInfoRecorderBuildCallable()); PlexusConfiguration archive = mojo.configuration.getChild("archive"); PlexusConfiguration manifestEntries = archive.getChild("manifestEntries",true); for (Entry<String,String> e : props.entrySet()) { if(manifestEntries.getChild(e.getKey(),false)!=null) continue; // if the configuration is already given, use that. XmlPlexusConfiguration configuration = new XmlPlexusConfiguration(e.getKey()); configuration.setValue(e.getValue()); manifestEntries.addChild(configuration); } } return super.preExecute(build, pom, mojo, listener); }
public boolean preExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener) throws InterruptedException, IOException { if(mojo.pluginName.groupId.equals("org.apache.maven.plugins") && keys.contains(mojo.pluginName.artifactId+':'+mojo.getGoal())) { // touch <archive><manifestEntries><Build-Numer>#n Map<String,String> props = build.execute(new BuildCallable<Map<String,String>,IOException>() { public Map<String,String> call(MavenBuild build) throws IOException, InterruptedException { Map<String,String> r = new HashMap<String, String>(); r.put("Hudson-Build-Number",String.valueOf(build.getNumber())); r.put("Hudson-Project",build.getParent().getParent().getName()); r.put("Hudson-Version",Hudson.VERSION); return r; } }); PlexusConfiguration archive = mojo.configuration.getChild("archive"); PlexusConfiguration manifestEntries = archive.getChild("manifestEntries",true); for (Entry<String,String> e : props.entrySet()) { if(manifestEntries.getChild(e.getKey(),false)!=null) continue; // if the configuration is already given, use that. XmlPlexusConfiguration configuration = new XmlPlexusConfiguration(e.getKey()); configuration.setValue(e.getValue()); manifestEntries.addChild(configuration); } } return super.preExecute(build, pom, mojo, listener); }