Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2013-09-11 21:58:04 -0400
committerIgor Fedorenko2013-09-11 21:58:04 -0400
commite295642d6f9fcc89e79889a98166f3eb824944f3 (patch)
tree5013151839231434f6ef0ffb6e504623e24c679a
parentb3871a00a6a1f1f11cf58db9a2b212fcdb5f3a89 (diff)
downloadm2e-core-e295642d6f9fcc89e79889a98166f3eb824944f3.tar.gz
m2e-core-e295642d6f9fcc89e79889a98166f3eb824944f3.tar.xz
m2e-core-e295642d6f9fcc89e79889a98166f3eb824944f3.zip
better report project configurator exceptions
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties1
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java20
3 files changed, 22 insertions, 1 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java
index f857c338..5c5d95c4 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java
@@ -22,6 +22,8 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.m2e.core.internal.messages"; //$NON-NLS-1$
+ public static String AbstractLifecycleMapping_could_not_update_project_configuration;
+
public static String AbstractProjectConfigurator_error_missing_nature;
public static String AbstractTransferListenerAdapter_4;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties
index fed4d6a7..227ff9e7 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties
@@ -1,3 +1,4 @@
+AbstractLifecycleMapping_could_not_update_project_configuration=Could not update project {0} configuration
AbstractProjectConfigurator_error_missing_nature=Project does not have required nature
AbstractTransferListenerAdapter_4=0% {0}
AbstractTransferListenerAdapter_byte=B
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java
index 9676c981..857d83bf 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java
@@ -17,18 +17,26 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.osgi.util.NLS;
import org.apache.maven.model.Build;
import org.apache.maven.project.MavenProject;
import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.internal.M2EUtils;
+import org.eclipse.m2e.core.internal.Messages;
import org.eclipse.m2e.core.internal.builder.MavenBuilderImpl;
import org.eclipse.m2e.core.internal.embedder.MavenProjectMutableState;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
@@ -41,6 +49,8 @@ import org.eclipse.m2e.core.project.IMavenProjectFacade;
*/
public abstract class AbstractLifecycleMapping implements ILifecycleMapping {
+ private static final Logger log = LoggerFactory.getLogger(AbstractLifecycleMapping.class);
+
private String name;
protected String id;
@@ -106,7 +116,15 @@ public abstract class AbstractLifecycleMapping implements ILifecycleMapping {
if(monitor.isCanceled()) {
throw new OperationCanceledException();
}
- configurator.configure(request, monitor.newChild(1));
+ try {
+ configurator.configure(request, monitor.newChild(1));
+ } catch(RuntimeException e) {
+ String message = NLS.bind(Messages.AbstractLifecycleMapping_could_not_update_project_configuration,
+ projectFacade.getProject().getName());
+ // oddly, CoreException stack trace is not shown in UI nor logged anywhere.
+ log.warn(message, e);
+ throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, message, e));
+ }
}
} finally {
snapshot.restore(mavenProject);

Back to the top