Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2014-07-08 03:27:26 -0400
committerIgor Fedorenko2014-07-08 03:27:26 -0400
commit5e88523e8378af0e34745589c9f18f08f60af44b (patch)
treefc73d19ed138e107f80cc91005e0b450f16a2b0d /org.eclipse.m2e.core
parent2b6eace30686c8e2961d64a8b508aa231d0c9d61 (diff)
downloadm2e-core-5e88523e8378af0e34745589c9f18f08f60af44b.tar.gz
m2e-core-5e88523e8378af0e34745589c9f18f08f60af44b.tar.xz
m2e-core-5e88523e8378af0e34745589c9f18f08f60af44b.zip
439097 capture mojo execution exceptions stack traces
Change-Id: I689ce91d1e0c78a4960a2291ecd0d5414127b74b Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
Diffstat (limited to 'org.eclipse.m2e.core')
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/BuildProblemInfo.java14
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilderImpl.java2
2 files changed, 14 insertions, 2 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/BuildProblemInfo.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/BuildProblemInfo.java
index 40e989b5..9d91bbe3 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/BuildProblemInfo.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/BuildProblemInfo.java
@@ -11,6 +11,8 @@
package org.eclipse.m2e.core.internal.builder;
+import com.google.common.base.Throwables;
+
import org.eclipse.m2e.core.internal.markers.MavenProblemInfo;
import org.eclipse.m2e.core.internal.markers.SourceLocation;
import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
@@ -18,7 +20,15 @@ import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
class BuildProblemInfo extends MavenProblemInfo {
public BuildProblemInfo(Throwable error, MojoExecutionKey mojoExecutionKey, SourceLocation markerLocation) {
- super(
- error.getMessage() + (mojoExecutionKey == null ? "" : " (" + mojoExecutionKey.getKeyString() + ')'), markerLocation); //$NON-NLS-1$
+ super(formatMessage(error, mojoExecutionKey), markerLocation); //$NON-NLS-1$
+ }
+
+ private static String formatMessage(Throwable error, MojoExecutionKey mojoExecutionKey) {
+ StringBuilder msg = new StringBuilder(error.getMessage());
+ if(mojoExecutionKey != null) {
+ msg.append(" (").append(mojoExecutionKey.getKeyString()).append(')');
+ }
+ msg.append("\n\n").append(Throwables.getStackTraceAsString(error));
+ return msg.toString();
}
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilderImpl.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilderImpl.java
index a39897ff..ff7339cf 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilderImpl.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilderImpl.java
@@ -157,6 +157,7 @@ public class MavenBuilderImpl {
}
}
} catch(Exception e) {
+ log.debug("Unexpected build exception", e);
buildErrors.put(e, null);
} finally {
snapshot.restore(mavenProject);
@@ -217,6 +218,7 @@ public class MavenBuilderImpl {
MavenExecutionResult result = session.getResult();
if(result.hasExceptions()) {
for(Throwable e : result.getExceptions()) {
+ log.debug("Exception during execution {}", mojoExecutionKey, e);
buildErrors.put(e, mojoExecutionKey);
}
result.getExceptions().clear();

Back to the top