Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2013-11-04 20:18:40 +0000
committerIgor Fedorenko2013-11-04 20:18:40 +0000
commitc33b31c48d0b0b61ea3bf645678530c540c65c3c (patch)
treef48ad1d5500ee91c14813dab11d9b13ed92594aa
parentc4049369f953c12023e9bf3b9e1ffa82a9e13158 (diff)
downloadm2e-core-c33b31c48d0b0b61ea3bf645678530c540c65c3c.tar.gz
m2e-core-c33b31c48d0b0b61ea3bf645678530c540c65c3c.tar.xz
m2e-core-c33b31c48d0b0b61ea3bf645678530c540c65c3c.zip
421015 fixed workspace runtime missing libraries in some cases
Added code to handle custom library classpath entries to workspace maven runtime. Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java27
1 files changed, 27 insertions, 0 deletions
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 8bcb34c2..1b5cc1ec 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
@@ -12,6 +12,7 @@
package org.eclipse.m2e.internal.launch;
import java.io.BufferedWriter;
+import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@@ -21,8 +22,13 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.util.NLS;
import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration;
@@ -56,6 +62,27 @@ public class MavenLauncherConfigurationHandler implements IMavenLauncherConfigur
if(output.isAccessible()) {
addArchiveEntry(output.getLocation().toFile().getAbsolutePath());
}
+ // add custom classpath entries
+ final IJavaProject javaProject = JavaCore.create(facade.getProject());
+ try {
+ for(IClasspathEntry cpe : javaProject.getRawClasspath()) {
+ if(cpe.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+ IResource resource = root.findMember(cpe.getPath());
+ if(resource != null) {
+ // workspace resource
+ addArchiveEntry(resource.getLocation().toOSString());
+ } else {
+ // external
+ File file = cpe.getPath().toFile();
+ if(file.exists()) {
+ addArchiveEntry(file.getAbsolutePath());
+ }
+ }
+ }
+ }
+ } catch(JavaModelException ex) {
+ // XXX to do what to do about this
+ }
}
public void addRealm(String realm) {

Back to the top