Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2013-04-27 22:49:29 -0400
committerIgor Fedorenko2013-05-04 12:43:23 -0400
commit21c23445bd0d5f8a966ea118a92ae218afd2e02e (patch)
tree09fdde29c14bb73cd4278e29108b10171daa86b2
parent8f19e57f772ec9d8bd748652127db4cd19b2ea01 (diff)
downloadm2e-core-21c23445bd0d5f8a966ea118a92ae218afd2e02e.tar.gz
m2e-core-21c23445bd0d5f8a966ea118a92ae218afd2e02e.tar.xz
m2e-core-21c23445bd0d5f8a966ea118a92ae218afd2e02e.zip
perf: don't refresh project facade during full build
Changed maven builder to refresh facade when project pom.xml has changed or facade is not available or facade is stale. Use cached facade instance in all other cases. This improves performance in common case when project configuration update and clean build are performed as one user operations. May cause stale facade cache when full build is invoked right after out-of-workspace pom.xml change. This is (and always was) an edge case, if this happens, the workaround is to manually invoke project configuration update. Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java
index 9faf9596..6562d046 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java
@@ -197,11 +197,22 @@ public class MavenBuilder extends IncrementalProjectBuilder implements DeltaProv
/*package*/IMavenProjectFacade getProjectFacade(final IFile pomResource, final IProject project,
final IProgressMonitor monitor) throws CoreException {
+
+ // facade refresh should be forced whenever pom.xml has changed
+ // there is no delta info for full builds
+ // but these are usually forced from Project/Clean
+ // so assume pom did not change
+ boolean force = false;
+
IResourceDelta delta = getDelta(project);
+ if(delta != null) {
+ delta = delta.findMember(pomResource.getFullPath());
+ force = delta != null && delta.getKind() == IResourceDelta.CHANGED;
+ }
IMavenProjectFacade projectFacade = projectManager.create(getProject(), monitor);
- if(delta == null || projectFacade == null || projectFacade.isStale()) {
+ if(force || projectFacade == null || projectFacade.isStale()) {
projectManager.refresh(Collections.singleton(pomResource), monitor);
projectFacade = projectManager.create(project, monitor);
if(projectFacade == null) {

Back to the top