Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.m2e.launching/src/org/eclipse/m2e/internal')
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java19
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenRuntimeLaunchSupport.java25
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java11
3 files changed, 29 insertions, 26 deletions
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 d8575fc4..c10804db 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,6 +14,7 @@ package org.eclipse.m2e.internal.launch;
import java.io.File;
import java.net.URI;
import java.net.URL;
+import java.util.Collections;
import java.util.List;
import org.osgi.framework.Bundle;
@@ -26,6 +27,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.osgi.util.NLS;
import org.eclipse.m2e.actions.MavenLaunchConstants;
+import org.eclipse.m2e.core.internal.Bundles;
import org.eclipse.m2e.core.internal.MavenPluginActivator;
import org.eclipse.m2e.core.internal.launch.AbstractMavenRuntime;
import org.eclipse.m2e.core.internal.launch.MavenRuntimeManagerImpl;
@@ -50,21 +52,22 @@ public class MavenLaunchUtils {
return runtime;
}
- public static String getCliResolver(AbstractMavenRuntime runtime) throws CoreException {
- String jarname;
+ public static List<String> getCliResolver(AbstractMavenRuntime runtime) {
+ String resolverBundleId;
String runtimeVersion = runtime.getVersion();
- if(runtimeVersion.startsWith("3.0")) { //$NON-NLS-1$
- jarname = "org.eclipse.m2e.cliresolver30.jar"; //$NON-NLS-1$
- } else if(runtimeVersion.startsWith("3.")) { //$NON-NLS-1$
- jarname = "org.eclipse.m2e.cliresolver31.jar"; //$NON-NLS-1$
+ if(runtimeVersion.startsWith("3.")) { //$NON-NLS-1$
+ resolverBundleId = "org.eclipse.m2e.workspace.cli"; //$NON-NLS-1$
} else {
- jarname = "org.eclipse.m2e.cliresolver.jar"; //$NON-NLS-1$
+ return Collections.emptyList(); // unsupported version of maven
}
- return getBundleEntry(MavenLaunchPlugin.getDefault().getBundle(), jarname);
+ Bundle resolver = Bundles.findDependencyBundle(MavenLaunchPlugin.getDefault().getBundle(), resolverBundleId);
+ return Bundles.getClasspathEntries(resolver);
}
/**
* Returns bundle entry path on local filesystem.
+ *
+ * @deprecated this method is not used by m2e internally and will be removed before 1.6
*/
public static String getBundleEntry(Bundle bundle, String entryPath) throws CoreException {
URL url = bundle.getEntry(entryPath);
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 ad631df1..e6fcc9a2 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
@@ -1,12 +1,9 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
- * 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
+ * Copyright (c) 2008-2010 Sonatype, Inc. 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:
- * Sonatype, Inc. - initial API and implementation
+ * Contributors: Sonatype, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.m2e.internal.launch;
@@ -39,7 +36,7 @@ import org.eclipse.jdt.launching.VMRunnerConfiguration;
import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration;
import org.eclipse.m2e.core.internal.MavenPluginActivator;
import org.eclipse.m2e.core.internal.launch.AbstractMavenRuntime;
-import org.eclipse.m2e.core.internal.project.WorkspaceStateWriter;
+import org.eclipse.m2e.workspace.WorkspaceState;
/**
@@ -50,9 +47,9 @@ import org.eclipse.m2e.core.internal.project.WorkspaceStateWriter;
* <p>
* Sets the following conventional launch configuration attributes.
* <ul>
- * <li>m2eclipse.workspace.state, full absolute path of m2e workspace state file. See {@link WorkspaceStateWriter} for
- * details of the state file format. Only set if workspace dependency resolution is enabled for the launch
- * configuration.</li>
+ * <li>WorkspaceState.SYSPROP_STATEFILE_LOCATION, full absolute path of m2e workspace state file. See
+ * {@link WorkspaceState} for details of the state file format. Only set if workspace dependency resolution is enabled
+ * for the launch configuration.</li>
* <li>maven.bootclasspath, maven runtime bootstrap classpath, normally only contains classworlds jar.</li>
* <li>maven.home, location of maven runtime, logical name is used for embedded and workspace runtimes</li>
* <li>classworlds.conf, location of classworlds configuration file, i.e. m2.conf</li>
@@ -115,7 +112,9 @@ public class MavenRuntimeLaunchSupport {
MavenLauncherConfigurationHandler cwconf = new MavenLauncherConfigurationHandler();
runtime.createLauncherConfiguration(cwconf, monitor);
if(resolveWorkspaceArtifacts) {
- cwconf.forceArchiveEntry(MavenLaunchUtils.getCliResolver(runtime));
+ for(String entry : MavenLaunchUtils.getCliResolver(runtime)) {
+ cwconf.forceArchiveEntry(entry);
+ }
}
File cwconfFile;
@@ -177,7 +176,7 @@ public class MavenRuntimeLaunchSupport {
// workspace artifact resolution
if(resolveWorkspaceArtifacts) {
File state = MavenPluginActivator.getDefault().getMavenProjectManager().getWorkspaceStateFile();
- properties.appendProperty("m2eclipse.workspace.state", quote(state.getAbsolutePath())); //$NON-NLS-1$
+ properties.appendProperty(WorkspaceState.SYSPROP_STATEFILE_LOCATION, quote(state.getAbsolutePath())); //$NON-NLS-1$
}
// maven.home
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 3ba8ef39..4be53593 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
@@ -72,7 +72,7 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
AbstractMavenRuntime runtime = MavenLaunchUtils.getMavenRuntime(configuration);
IMavenLauncherConfiguration collector = new IMavenLauncherConfiguration() {
- public void addArchiveEntry(String entry) throws CoreException {
+ public void addArchiveEntry(String entry) {
addArchiveRuntimeClasspathEntry(entries, entry);
}
@@ -90,7 +90,9 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
}
};
- collector.addArchiveEntry(MavenLaunchUtils.getCliResolver(runtime));
+ for(String entry : MavenLaunchUtils.getCliResolver(runtime)) {
+ collector.addArchiveEntry(entry);
+ }
runtime.createLauncherConfiguration(collector, monitor);
IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath( //
@@ -98,8 +100,7 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
return JavaRuntime.getSourceContainers(resolved);
}
- protected void addArchiveRuntimeClasspathEntry(List<IRuntimeClasspathEntry> entries, String entryPath)
- throws CoreException {
+ protected void addArchiveRuntimeClasspathEntry(List<IRuntimeClasspathEntry> entries, String entryPath) {
File entryFile = new File(entryPath);
if(!entryFile.exists()) {
@@ -149,7 +150,7 @@ public class MavenSourcePathComputer implements ISourcePathComputer {
}
private void addArchiveRuntimeClasspathEntry(List<IRuntimeClasspathEntry> entries, String entryPath, InputStream is)
- throws IOException, CoreException {
+ throws IOException {
Properties p = new Properties();
p.load(is);

Back to the top