expanded the list of exceptions allowed.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@4438 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-08-26 14:20:58 +00:00
1 parent b8fbbcc934
commit bf03fb031c
3 files changed
+29 -33

No files matched your search

@@ -46,10 +46,6 @@ public class PluginManagerInterceptor implements PluginManagerListener, Lifecycl
/**
* Called by {@link MavenBuild} to connect this object to the rest of Hudson objects,
* namely {@link MavenBuild}.
*
* <p>
* We can't do this in the constructor because this object is created by
* Plexus along with the rest of Maven objects.
*/
public PluginManagerInterceptor(MavenBuildProxy buildProxy, MavenReporter[] reporters, BuildListener listener) {
this.buildProxy = buildProxy;
@@ -60,31 +56,17 @@ public class PluginManagerInterceptor implements PluginManagerListener, Lifecycl
/**
* Called before the whole build.
*/
public void preBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException {
try {
for (MavenReporter r : reporters)
r.preBuild(buildProxy,rm.getTopLevelProject(),listener);
} catch (InterruptedException e) {
throw new BuildFailureException("aborted",e);
} catch (IOException e) {
throw new BuildFailureException(e.getMessage(),e);
}
public void preBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException, IOException, InterruptedException {
for (MavenReporter r : reporters)
r.preBuild(buildProxy,rm.getTopLevelProject(),listener);
}
public void postBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException {
try {
fireLeaveModule();
buildProxy.setExecutedMojos(executedMojos);
for (MavenReporter r : reporters)
r.postBuild(buildProxy,rm.getTopLevelProject(),listener);
} catch (InterruptedException e) {
throw new BuildFailureException("aborted",e);
} catch (IOException e) {
throw new BuildFailureException(e.getMessage(),e);
} catch (AbortException e) {
throw new BuildFailureException("aborted",e);
}
public void postBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException, IOException, InterruptedException {
fireLeaveModule();
buildProxy.setExecutedMojos(executedMojos);
for (MavenReporter r : reporters)
r.postBuild(buildProxy,rm.getTopLevelProject(),listener);
}
public void preExecute(MavenProject project, MojoExecution exec, PlexusConfiguration mergedConfig, ExpressionEvaluator eval) throws IOException, InterruptedException, AbortException {
@@ -5,6 +5,10 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.monitor.event.EventDispatcher;
import java.io.IOException;
import hudson.maven.agent.AbortException;
/**
* {@link LifecycleExecutor} interceptor.
*
@@ -29,13 +33,21 @@ public class LifecycleExecutorInterceptor extends DefaultLifecycleExecutor {
}
public void execute(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException {
if(listener!=null)
listener.preBuild(session,rm,dispatcher);
try {
super.execute(session, rm, dispatcher);
} finally {
if(listener!=null)
listener.postBuild(session,rm,dispatcher);
listener.preBuild(session,rm,dispatcher);
try {
super.execute(session, rm, dispatcher);
} finally {
if(listener!=null)
listener.postBuild(session,rm,dispatcher);
}
} catch (InterruptedException e) {
throw new BuildFailureException("aborted",e);
} catch (IOException e) {
throw new BuildFailureException(e.getMessage(),e);
} catch (AbortException e) {
throw new BuildFailureException("aborted",e);
}
}
}
@@ -5,6 +5,8 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.monitor.event.EventDispatcher;
import java.io.IOException;
/**
* Event notification for the start/end of the maven execution.
*
@@ -16,6 +18,6 @@ import org.apache.maven.monitor.event.EventDispatcher;
* @author Kohsuke Kawaguchi
*/
public interface LifecycleExecutorListener {
void preBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException;
void postBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException;
void preBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException, InterruptedException, IOException;
void postBuild(MavenSession session, ReactorManager rm, EventDispatcher dispatcher) throws BuildFailureException, LifecycleExecutionException, InterruptedException, IOException;
}