Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Tanasenko2016-05-19 05:58:17 -0400
committerAnton Tanasenko2016-05-19 05:58:17 -0400
commiteda7b06ed9b67c50768b5a7c1db164c5c71f1f39 (patch)
tree84cdd889fb74fb2feb5f78edfae327bfe063dc20
parent8831217581c793aac6d62691d9e24da262d70e82 (diff)
downloadm2e-core-project_artifacts_cache.tar.gz
m2e-core-project_artifacts_cache.tar.xz
m2e-core-project_artifacts_cache.zip
Project artifacts cacheproject_artifacts_cache
Change-Id: Ia3a4c7a3d1a1adb47fbc563b6b1baeda16c79ec0 Signed-off-by: Anton Tanasenko <atg.sleepless@gmail.com>
-rw-r--r--m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/DefaultMavenComponentContributor.java3
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseProjectArtifactsCache.java51
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java2
4 files changed, 57 insertions, 1 deletions
diff --git a/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml
index 799e774b..fd9fff1e 100644
--- a/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml
+++ b/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml
@@ -23,7 +23,7 @@
<properties>
<!-- maven core version -->
- <maven-core.version>3.3.9</maven-core.version>
+ <maven-core.version>3.4.0-SNAPSHOT</maven-core.version>
<!-- below are m2e-specific addons -->
<plexus-build-api.version>0.0.7</plexus-build-api.version>
<okhttp-connector.version>0.16.0</okhttp-connector.version>
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/DefaultMavenComponentContributor.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/DefaultMavenComponentContributor.java
index 81336679..e01d4c72 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/DefaultMavenComponentContributor.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/DefaultMavenComponentContributor.java
@@ -17,6 +17,7 @@ import org.apache.maven.classrealm.ClassRealmManagerDelegate;
import org.apache.maven.plugin.ExtensionRealmCache;
import org.apache.maven.plugin.PluginArtifactsCache;
import org.apache.maven.plugin.PluginRealmCache;
+import org.apache.maven.plugin.ProjectArtifactsCache;
import org.apache.maven.plugin.internal.PluginDependenciesResolver;
import org.apache.maven.project.ProjectRealmCache;
import org.apache.maven.project.artifact.MavenMetadataCache;
@@ -27,6 +28,7 @@ import org.eclipse.m2e.core.internal.project.EclipseExtensionRealmCache;
import org.eclipse.m2e.core.internal.project.EclipseMavenMetadataCache;
import org.eclipse.m2e.core.internal.project.EclipsePluginArtifactsCache;
import org.eclipse.m2e.core.internal.project.EclipsePluginRealmCache;
+import org.eclipse.m2e.core.internal.project.EclipseProjectArtifactsCache;
import org.eclipse.m2e.core.internal.project.EclipseProjectRealmCache;
import org.eclipse.m2e.core.internal.project.registry.EclipsePluginDependenciesResolver;
@@ -40,6 +42,7 @@ public class DefaultMavenComponentContributor implements IMavenComponentContribu
binder.bind(PluginRealmCache.class, EclipsePluginRealmCache.class, null);
binder.bind(PluginArtifactsCache.class, EclipsePluginArtifactsCache.class, null);
binder.bind(PluginDependenciesResolver.class, EclipsePluginDependenciesResolver.class, null);
+ binder.bind(ProjectArtifactsCache.class, EclipseProjectArtifactsCache.class, null);
binder.bind(BuildContext.class, EclipseBuildContext.class, null);
binder.bind(ClassRealmManagerDelegate.class, EclipseClassRealmManagerDelegate.class,
EclipseClassRealmManagerDelegate.ROLE_HINT);
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseProjectArtifactsCache.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseProjectArtifactsCache.java
new file mode 100644
index 00000000..b38f957e
--- /dev/null
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseProjectArtifactsCache.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Igor Fedorenko
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Igor Fedorenko - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.m2e.core.internal.project;
+
+import java.io.File;
+import java.util.Set;
+
+import javax.inject.Singleton;
+
+import org.apache.maven.plugin.DefaultProjectArtifactsCache;
+import org.apache.maven.project.MavenProject;
+
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+
+
+@Singleton
+@SuppressWarnings("synthetic-access")
+public class EclipseProjectArtifactsCache extends DefaultProjectArtifactsCache implements IManagedCache {
+
+ private final ProjectCachePlunger<Key> plunger = new ProjectCachePlunger<Key>() {
+ protected void flush(Key cacheKey) {
+ cache.remove(cacheKey);
+ }
+ };
+
+ @Override
+ public void register(MavenProject project, Key cacheKey, CacheRecord record) {
+ plunger.register(project, cacheKey);
+ }
+
+ @Override
+ public Set<File> removeProject(File pom, ArtifactKey mavenProject, boolean forceDependencyUpdate) {
+ return plunger.removeProject(pom, forceDependencyUpdate);
+ };
+
+ @Override
+ public void flush() {
+ super.flush();
+ plunger.flush();
+ }
+
+}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
index b2d09bda..dfd6afa6 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
@@ -68,6 +68,7 @@ import org.apache.maven.plugin.ExtensionRealmCache;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.PluginArtifactsCache;
import org.apache.maven.plugin.PluginRealmCache;
+import org.apache.maven.plugin.ProjectArtifactsCache;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.project.ProjectRealmCache;
@@ -1120,6 +1121,7 @@ public class ProjectRegistryManager {
affected.addAll(flushMavenCache(PluginRealmCache.class, pom, key, force));
affected.addAll(flushMavenCache(MavenMetadataCache.class, pom, key, force));
affected.addAll(flushMavenCache(PluginArtifactsCache.class, pom, key, force));
+ affected.addAll(flushMavenCache(ProjectArtifactsCache.class, pom, key, force));
return affected;
}

Back to the top