Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2014-04-18 17:52:54 -0400
committerIgor Fedorenko2014-04-20 19:04:43 -0400
commit150c457edc53494dd4d48bb72454f998e08473e7 (patch)
treeff56198685d0ffd373c3d9405b93625ac930d327 /org.eclipse.m2e.launching
parent86e1ca34912a6da5882f6cc3283f84ed22bdf3b1 (diff)
downloadm2e-core-150c457edc53494dd4d48bb72454f998e08473e7.tar.gz
m2e-core-150c457edc53494dd4d48bb72454f998e08473e7.tar.xz
m2e-core-150c457edc53494dd4d48bb72454f998e08473e7.zip
432436 ability to configure maven installation extensions WIP
Change-Id: Iddef9107e5c75a287e4ca58cd04c898cc0177811 Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
Diffstat (limited to 'org.eclipse.m2e.launching')
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java3
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java48
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java20
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java5
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java1
5 files changed, 14 insertions, 63 deletions
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java
index ad3d7547..7f1cc6e3 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java
@@ -70,9 +70,6 @@ public interface MavenLaunchConstants {
public final String ATTR_RUNTIME = "M2_RUNTIME"; //$NON-NLS-1$
- // hidden (for now) list of workspace components to be pushed into maven runtime
- public final String ATTR_FORCED_COMPONENTS_LIST = "M2_FORCED_COMPONENTS_LIST"; //$NON-NLS-1$
-
public final String ATTR_DISABLED_EXTENSIONS = "M2_DISABLED_EXTENSIONS";
public final String ATTR_THREADS = "M2_THREADS"; //$NON-NLS-1$
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java
index 7b3c231c..3b625bb5 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java
@@ -14,14 +14,9 @@ package org.eclipse.m2e.internal.launch;
import java.io.File;
import java.net.URI;
import java.net.URL;
-import java.util.ArrayList;
import java.util.List;
import org.osgi.framework.Bundle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.ibm.icu.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
@@ -30,16 +25,10 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.osgi.util.NLS;
-import org.apache.maven.artifact.Artifact;
-
import org.eclipse.m2e.actions.MavenLaunchConstants;
import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.embedder.IMaven;
-import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration;
import org.eclipse.m2e.core.embedder.MavenRuntime;
import org.eclipse.m2e.core.embedder.MavenRuntimeManager;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
-import org.eclipse.m2e.core.project.IMavenProjectRegistry;
/**
@@ -48,7 +37,6 @@ import org.eclipse.m2e.core.project.IMavenProjectRegistry;
* @author Igor Fedorenko
*/
public class MavenLaunchUtils {
- private static final Logger log = LoggerFactory.getLogger(MavenLaunchUtils.class);
public static MavenRuntime getMavenRuntime(ILaunchConfiguration configuration) throws CoreException {
MavenRuntimeManager runtimeManager = MavenPlugin.getMavenRuntimeManager();
@@ -89,42 +77,6 @@ public class MavenLaunchUtils {
}
}
- public static void addUserComponents(ILaunchConfiguration configuration, IMavenLauncherConfiguration collector)
- throws CoreException {
- List<String> list = configuration.getAttribute(MavenLaunchConstants.ATTR_FORCED_COMPONENTS_LIST,
- new ArrayList<String>());
- if(list == null) {
- return;
- }
-
- IMavenProjectRegistry projectManager = MavenPlugin.getMavenProjectRegistry();
- IMaven maven = MavenPlugin.getMaven();
- for(String gav : list) {
- // groupId:artifactId:version
- StringTokenizer st = new StringTokenizer(gav, ":"); //$NON-NLS-1$
- String groupId = st.nextToken();
- String artifactId = st.nextToken();
- String version = st.nextToken();
-
- IMavenProjectFacade facade = projectManager.getMavenProject(groupId, artifactId, version);
-
- if(facade != null) {
- collector.addProjectEntry(facade);
- } else {
- String name = groupId + ":" + artifactId + ":" + version; //$NON-NLS-1$ //$NON-NLS-2$
- try {
- Artifact artifact = maven.resolve(groupId, artifactId, version, "jar", null, null, null); //$NON-NLS-1$
- File file = artifact.getFile();
- if(file != null) {
- collector.addArchiveEntry(file.getAbsolutePath());
- }
- } catch(CoreException ex) {
- log.error("Artifact not found " + name, ex);
- }
- }
- }
- }
-
/**
* @since 1.4
*/
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java
index 1b5cc1ec..91bcf3a1 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java
@@ -48,14 +48,23 @@ public class MavenLauncherConfigurationHandler implements IMavenLauncherConfigur
private LinkedHashMap<String, List<String>> realms = new LinkedHashMap<String, List<String>>();
- private List<String> forcedEntries = new ArrayList<String>();
-
- private List<String> curEntries = forcedEntries;
+ private List<String> curEntries;
public void addArchiveEntry(String entry) {
+ if(curEntries == null) {
+ throw new IllegalStateException();
+ }
curEntries.add(entry);
}
+ public void forceArchiveEntry(String entry) {
+ List<String> realm = realms.get(mainRealm);
+ if(realm == null) {
+ throw new IllegalStateException();
+ }
+ realm.add(0, entry);
+ }
+
public void addProjectEntry(IMavenProjectFacade facade) {
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFolder output = root.getFolder(facade.getOutputLocation());
@@ -105,11 +114,6 @@ public class MavenLauncherConfigurationHandler implements IMavenLauncherConfigur
continue;
}
out.write(NLS.bind("[{0}]\n", realm.getKey()));
- if(mainRealm.equals(realm.getKey())) {
- for(String entry : forcedEntries) {
- out.write(NLS.bind("load {0}\n", entry));
- }
- }
for(String entry : realm.getValue()) {
out.write(NLS.bind("load {0}\n", entry));
}
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java
index 2782e976..5779c3c7 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java
@@ -112,11 +112,10 @@ public class MavenRuntimeLaunchSupport {
boolean resolveWorkspaceArtifacts = configuration.getAttribute(ATTR_WORKSPACE_RESOLUTION, false);
MavenLauncherConfigurationHandler cwconf = new MavenLauncherConfigurationHandler();
+ runtime.createLauncherConfiguration(cwconf, monitor);
if(resolveWorkspaceArtifacts) {
- cwconf.addArchiveEntry(MavenLaunchUtils.getCliResolver(runtime));
+ cwconf.forceArchiveEntry(MavenLaunchUtils.getCliResolver(runtime));
}
- MavenLaunchUtils.addUserComponents(configuration, cwconf);
- runtime.createLauncherConfiguration(cwconf, monitor);
File cwconfFile;
try {
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java
index 7475edb7..6050ccc9 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java
@@ -90,7 +90,6 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
};
collector.addArchiveEntry(MavenLaunchUtils.getCliResolver(runtime));
- MavenLaunchUtils.addUserComponents(configuration, collector);
runtime.createLauncherConfiguration(collector, monitor);
IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath( //

Back to the top