Skip to content

Commit

Permalink
[FIXED JENKINS-15025] Maven-Tycho 0.15.0 build - no additional info i…
Browse files Browse the repository at this point in the history
…n console log about compilation failure

Rename Maven3ResultProcessor to Maven3FailureLogger and move to package visibility.
Method processFailure (now logFailures) only logs failure details, restore
execution result check in Maven3Builder.
  • Loading branch information
Nikolas Falco committed Oct 10, 2013
1 parent 0cb0175 commit 721e379
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/main/java/hudson/maven/Maven3Builder.java
Expand Up @@ -127,11 +127,11 @@ public Result call() throws IOException {

Method launchMethod = maven3MainClass.getMethod( "launch", String[].class );

/*Integer res = (Integer) */launchMethod.invoke(null, new Object[] {goals.toArray(new String[goals.size()])} );
Integer res = (Integer) launchMethod.invoke(null, new Object[] {goals.toArray(new String[goals.size()])} );

//int r = Maven3Main.launch( goals.toArray(new String[goals.size()]));

// int r = res.intValue();
int r = res.intValue();

// now check the completion status of async ops
long startTime = System.nanoTime();
Expand All @@ -158,11 +158,11 @@ public Result call() throws IOException {
//mavenExecutionResult = Maven3Launcher.getMavenExecutionResult();

// manage of Maven error threaded as in MavenCli, delegated by Maven3Launcher.launch
Maven3ResultProcessor summary = new Maven3ResultProcessor(mavenExecutionListener.logger);
Maven3FailureLogger summary = new Maven3FailureLogger(mavenExecutionListener.logger);
summary.processCLIArguments(goals);
boolean isFail = summary.processFailure(mavenExecutionResult);
summary.logFailures(mavenExecutionResult);

if(isFail) {
if(r==0 && mavenExecutionResult.getThrowables().isEmpty()) {
if(mavenExecutionListener.hasTestFailures()){
return Result.UNSTABLE;
}
Expand Down
Expand Up @@ -15,19 +15,19 @@
import org.jvnet.hudson.maven3.listeners.HudsonMavenExecutionResult;
import org.jvnet.hudson.maven3.listeners.MavenProjectInfo;

public class Maven3ResultProcessor {
/* package */ class Maven3FailureLogger {

private org.slf4j.Logger slf4jLogger;
boolean showErrors = false; // default from DefaultMavenExecutionRequest.showErrors
boolean failNever = false; // default from DefaultMavenExecutionRequest.reactorFailureBehavior

public Maven3ResultProcessor( org.slf4j.Logger slf4jLogger )
public Maven3FailureLogger( org.slf4j.Logger slf4jLogger )
{
this.slf4jLogger = slf4jLogger;
}

// partial copy paste of MavenCli.execute()
public boolean processFailure(HudsonMavenExecutionResult result) {
public void logFailures(HudsonMavenExecutionResult result) {
if ( !result.getThrowables().isEmpty() )
{
ExceptionHandler handler = new DefaultExceptionHandler();
Expand All @@ -54,7 +54,7 @@ public boolean processFailure(HudsonMavenExecutionResult result) {
{
slf4jLogger.error( "To see the full stack trace of the errors, re-run Maven with the -e switch." );
}
if ( !slf4jLogger.isDebugEnabled() )
if ( !slf4jLogger.isDebugEnabled() ) // TODO fix me, this is not the same log of Maven3 process
{
slf4jLogger.error( "Re-run Maven using the -X switch to enable full debug logging." );
}
Expand All @@ -81,18 +81,8 @@ public boolean processFailure(HudsonMavenExecutionResult result) {
if ( failNever )
{
slf4jLogger.info( "Build failures were ignored." );

return false;
}
else
{
return true;
}
}
else
{
return false;
}
}

// copy paste of MavenCli.logSummary()
Expand Down

0 comments on commit 721e379

Please sign in to comment.