@Override void preExecute(MavenProject project, MojoInfo info) throws IOException, InterruptedException, AbortException { for (MavenReporter r : reporters) if(!r.preExecute(buildProxy,project,info,listener)) throw new AbortException(r+" failed"); startTime = System.currentTimeMillis(); }
@Override void preExecute(MavenProject project, MojoInfo info) throws IOException, InterruptedException, AbortException { for (MavenReporter r : reporters.get(moduleName)) if(!r.preExecute(buildProxy,project,info,listener)) throw new AbortException(r+" failed"); startTime = System.currentTimeMillis(); }
void preExecute(MavenProject project, MojoInfo mojoInfo) throws IOException, InterruptedException, hudson.maven.agent.AbortException { ModuleName name = new ModuleName(project); MavenBuildProxy proxy = proxies.get(name); for (MavenReporter r : reporters.get(name)) if(!r.preExecute(proxy,project,mojoInfo,listener)) throw new hudson.maven.agent.AbortException(r+" failed"); mojoStartTime = System.currentTimeMillis(); }
void preExecute(MavenProject project, MojoInfo mojoInfo) throws IOException, InterruptedException, hudson.maven.agent.AbortException { ModuleName name = new ModuleName(project); MavenBuildProxy proxy = proxies.get(name); for (MavenReporter r : reporters.get(name)) if(!r.preExecute(proxy,project,mojoInfo,listener)) throw new hudson.maven.agent.AbortException(r+" failed"); mojoStartTime = System.currentTimeMillis(); }
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); }
private void recordMojoStarted(ExecutionEvent event) { long startTime = initMojoStartTime( event.getProject() ); MavenProject mavenProject = event.getProject(); MojoInfo mojoInfo = new MojoInfo(event,startTime); List<MavenReporter> mavenReporters = getMavenReporters( mavenProject ); MavenBuildProxy2 mavenBuildProxy2 = getMavenBuildProxy2( mavenProject ); if (mavenBuildProxy2 == null) return; for (MavenReporter mavenReporter : fixNull(mavenReporters)) { try { mavenReporter.preExecute( mavenBuildProxy2, mavenProject, mojoInfo, maven3Builder.listener); } catch ( InterruptedException e ) { e.printStackTrace(); } catch ( IOException e ) { e.printStackTrace(); } } }
public void reccordMojoStarted( ExecutionEvent event ) { initMojoStartTime( event.getProject() ); MavenProject mavenProject = event.getProject(); XmlPlexusConfiguration xmlPlexusConfiguration = new XmlPlexusConfiguration( event.getMojoExecution().getConfiguration() ); Mojo mojo = null;//getMojo( event.getMojoExecution(), event.getSession() ); MojoInfo mojoInfo = new MojoInfo( event.getMojoExecution(), mojo, xmlPlexusConfiguration, getExpressionEvaluator( event.getSession(), event.getMojoExecution() ) ); List<MavenReporter> mavenReporters = getMavenReporters( mavenProject ); MavenBuildProxy2 mavenBuildProxy2 = getMavenBuildProxy2( mavenProject ); if (mavenReporters != null) { for (MavenReporter mavenReporter : mavenReporters) { try { mavenReporter.preExecute( mavenBuildProxy2, mavenProject, mojoInfo, maven3Builder.listener); } catch ( InterruptedException e ) { e.printStackTrace(); } catch ( IOException e ) { e.printStackTrace(); } } } }