[328974] Include dependent Java projects directly in classpath list to ensure source path resolution provides expected results.
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatPublishModuleVisitor.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatPublishModuleVisitor.java
index f56fcf8..ad87e57 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatPublishModuleVisitor.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatPublishModuleVisitor.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 IBM Corporation and others.
* 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
@@ -30,6 +30,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jst.server.tomcat.core.internal.wst.IModuleVisitor;
import org.eclipse.jst.server.tomcat.core.internal.xml.Factory;
import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
@@ -114,6 +115,13 @@
}
/**
+ * @see IModuleVisitor#visitDependentJavaProject(IJavaProject javaProject)
+ */
+ public void visitDependentJavaProject(IJavaProject javaProject) {
+ // Useful for finding source folders, so do nothing.
+ }
+
+ /**
* @see IModuleVisitor#visitDependentComponent(IPath, IPath)
*/
public void visitDependentComponent(IPath runtimePath, IPath workspacePath) {
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatSourcePathComputerDelegate.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatSourcePathComputerDelegate.java
index 713631a..d0ec269 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatSourcePathComputerDelegate.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatSourcePathComputerDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* 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
@@ -102,6 +102,17 @@
/**
* {@inheritDoc}
*/
+ public void visitDependentJavaProject(IJavaProject javaProject) {
+ // Ensure dependent projects are listed directly in the classpath list.
+ // This is needed because JavaRuntime.getSourceContainers() won't resolve them
+ // correctly if they have non-default output folders. In this case, they resolve to
+ // binary archive folders with no associated source folder for some reason.
+ runtimeClasspath.add(JavaRuntime
+ .newDefaultProjectClasspathEntry(javaProject));
+ }
+ /**
+ * {@inheritDoc}
+ */
public void visitDependentComponent(IPath runtimePath,
IPath workspacePath) {
// do nothing
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/wst/IModuleVisitor.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/wst/IModuleVisitor.java
index ec7279f..4666471 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/wst/IModuleVisitor.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/wst/IModuleVisitor.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 IBM Corporation and others.
* 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
@@ -12,6 +12,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
/**
@@ -41,6 +42,13 @@
void visitArchiveComponent(IPath runtimePath, IPath workspacePath);
/**
+ * Process Dependent Java project. Useful for determining
+ * source paths.
+ * @param IJavaProject dependent Java project
+ */
+ void visitDependentJavaProject(IJavaProject javaProject);
+
+ /**
* Process dependent component.
* @param runtimePath path for component at runtime
* @param workspacePath path to component in workspace
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/wst/ModuleTraverser.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/wst/ModuleTraverser.java
index 7643ddb..2fc4467 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/wst/ModuleTraverser.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/wst/ModuleTraverser.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 IBM Corporation and others.
* 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
@@ -275,6 +275,7 @@
if (!dependentProject.hasNature(JavaCore.NATURE_ID))
return;
IJavaProject project = JavaCore.create(dependentProject);
+ visitor.visitDependentJavaProject(project);
String name = component.getName(); // assume it is the same as URI