Index: org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java
===================================================================
--- org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java	(revision 681731)
+++ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java	(working copy)
@@ -76,6 +76,8 @@
 
     boolean alphaOrder;
 
+    boolean resolveInWorkspace;
+
     /**
      * Constructor
      * 
@@ -184,6 +186,9 @@
                 // return false, so it is fine
                 alphaOrder = Boolean.valueOf(value).booleanValue();
                 isProjectSpecific = true;
+            } else if (parameter[0].equals("resolveInWorkspace")) {
+                resolveInWorkspace = Boolean.valueOf(value).booleanValue();
+                isProjectSpecific = true;
             }
         }
         if (isProjectSpecific) {
@@ -245,6 +250,8 @@
                 path.append(URLEncoder.encode(Boolean.toString(retrieveSync), "UTF-8"));
                 path.append("&alphaOrder=");
                 path.append(URLEncoder.encode(Boolean.toString(alphaOrder), "UTF-8"));
+                path.append("&resolveInWorkspace=");
+                path.append(URLEncoder.encode(Boolean.toString(this.resolveInWorkspace), "UTF-8"));
             }
         } catch (UnsupportedEncodingException e) {
             String message = "The UTF-8 encoding support is required is endecode the path of the container.";
@@ -357,6 +364,13 @@
         return alphaOrder;
     }
 
+    public boolean isResolveInWorkspace() {
+        if (this.ivySettingsPath == null) {
+            return IvyPlugin.getPreferenceStoreHelper().isResolveInWorkspace();
+        }
+        return resolveInWorkspace;
+    }
+
     public boolean isProjectSpecific() {
         return ivySettingsPath != null;
     }
Index: org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java
===================================================================
--- org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java	(revision 681731)
+++ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java	(working copy)
@@ -105,6 +105,8 @@
 
     Button alphaOrderCheck;
 
+    Button resolveInWorkspaceCheck;
+
     Button projectSpecificButton;
 
     Button browse;
@@ -160,6 +162,7 @@
             conf.retrievePattern = retrievePatternText.getText();
             conf.retrieveSync = retrieveSyncButton.getSelection();
             conf.alphaOrder = alphaOrderCheck.getSelection();
+            conf.resolveInWorkspace = resolveInWorkspaceCheck.getSelection();
         } else {
             conf.ivySettingsPath = null;
         }
@@ -515,6 +518,13 @@
         alphaOrderCheck
                 .setToolTipText("Order alphabetically the artifacts in the classpath container");
 
+        resolveInWorkspaceCheck = new Button(this.configComposite, SWT.CHECK);
+        resolveInWorkspaceCheck.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
+                false, 2, 1));
+        resolveInWorkspaceCheck.setText("Resolve dependencies in workspace");
+        resolveInWorkspaceCheck
+                .setToolTipText("Will replace jars on the classpath with workspace projects");
+
         return composite;
     }
 
@@ -538,6 +548,7 @@
             retrievePatternText.setText(conf.retrievePattern);
             retrieveSyncButton.setSelection(conf.retrieveSync);
             alphaOrderCheck.setSelection(conf.alphaOrder);
+            resolveInWorkspaceCheck.setSelection(this.conf.resolveInWorkspace);
         } else {
             projectSpecificButton.setSelection(false);
             IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper();
@@ -551,6 +562,7 @@
             retrievePatternText.setText(helper.getRetrievePattern());
             retrieveSyncButton.setSelection(helper.getRetrieveSync());
             alphaOrderCheck.setSelection(helper.isAlphOrder());
+            resolveInWorkspaceCheck.setSelection(helper.isResolveInWorkspace());
         }
 
         updateFieldsStatus();
@@ -570,6 +582,7 @@
         retrievePatternText.setEnabled(doRetrieveButton.getSelection() && projectSpecific);
         retrieveSyncButton.setEnabled(doRetrieveButton.getSelection() && projectSpecific);
         alphaOrderCheck.setEnabled(projectSpecific);
+        resolveInWorkspaceCheck.setEnabled(projectSpecific);
     }
 
     File getFile(File startingDirectory) {
Index: org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
===================================================================
--- org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java	(revision 681732)
+++ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java	(working copy)
@@ -25,6 +25,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -46,17 +47,22 @@
 import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.descriptor.DefaultArtifact;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.core.report.ResolveReport;
 import org.apache.ivy.core.resolve.DownloadOptions;
+import org.apache.ivy.core.resolve.IvyNode;
 import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.core.retrieve.RetrieveOptions;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
 import org.apache.ivy.plugins.report.XmlReportParser;
 import org.apache.ivy.plugins.repository.TransferEvent;
 import org.apache.ivy.plugins.repository.TransferListener;
 import org.apache.ivy.util.Message;
 import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -66,8 +72,11 @@
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathContainer;
 import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
 
 /**
  * Eclipse classpath container that will contain the ivy resolved entries.
@@ -165,6 +174,16 @@
         }
     }
 
+    private Map listDependencies(ResolveReport r) {
+        Map result = new HashMap();
+        for (Object d : r.getDependencies()) {
+            IvyNode node = (IvyNode) d;
+            ModuleRevisionId moduleId = node.getId();
+            result.put(moduleId.getName(), moduleId);
+        }
+        return result;
+    }
+
     protected IStatus run(IProgressMonitor monitor) {
         Message.info("resolving dependencies of " + conf.ivyXmlPath);
         _monitor = monitor;
@@ -187,7 +206,7 @@
                 ClassLoader old = Thread.currentThread().getContextClassLoader();
                 Thread.currentThread().setContextClassLoader(IvyResolveJob.class.getClassLoader());
                 try {
-
+                    Map dependencies = Collections.EMPTY_MAP;
                     if (_usePreviousResolveIfExist) {
                         if (conf.confs.size() == 1 && "*".equals(conf.confs.get(0))) {
                             confs = md.getConfigurationsNames();
@@ -205,7 +224,7 @@
                                     .getConfigurationResolveReportInCache(
                                         ResolveOptions.getDefaultResolveId(md), confs[i]);
                             boolean resolved = false;
-                            if (report.exists()) {
+                            if (report.exists() && !conf.isResolveInWorkspace()) {
                                 // found a report, try to parse it.
                                 try {
                                     XmlReportParser parser = new XmlReportParser();
@@ -229,6 +248,7 @@
                                                 .toArray(new String[conf.confs.size()])));
                                 all.addAll(Arrays.asList(r.getArtifactsReports(null, false)));
                                 confs = r.getConfigurations();
+                                dependencies = listDependencies(r);
                                 problemMessages.addAll(r.getAllProblemMessages());
                                 maybeRetrieve(md, confs);
 
@@ -245,6 +265,8 @@
                             false)));
                         confs = report.getConfigurations();
 
+                        dependencies = listDependencies(report);
+
                         if (_monitor.isCanceled()) {
                             status[0] = Status.CANCEL_STATUS;
                             return;
@@ -255,7 +277,7 @@
 
                     warnIfDuplicates(all);
 
-                    classpathEntries[0] = artifacts2ClasspathEntries(all);
+                    classpathEntries[0] = artifacts2ClasspathEntries(all, dependencies);
                 } catch (ParseException e) {
                     String errorMsg = "Error while parsing the ivy file " + conf.ivyXmlPath + "\n"
                             + e.getMessage();
@@ -380,26 +402,109 @@
         }
     }
 
-    private IClasspathEntry[] artifacts2ClasspathEntries(Collection all) {
+    private IClasspathEntry[] artifacts2ClasspathEntries(Collection all,
+            Map dependencies) {
         IClasspathEntry[] classpathEntries;
         Collection paths = new LinkedHashSet();
+
+        Map idToJProject = new HashMap();
+        if (conf.isResolveInWorkspace()) {
+            try {
+                IJavaProject[] projects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot())
+                        .getJavaProjects();
+                for (int i = 0; i < projects.length; i++) {
+                    IJavaProject javaProject = projects[i];
+                    IClasspathEntry[] entries = javaProject.getRawClasspath();
+                    for (int j = 0; j < entries.length; j++) {
+                        IClasspathEntry entry = entries[j];
+                        ModuleDescriptor md = findModuleDescriptor(javaProject, entry);
+                        if (md != null) {
+                            idToJProject.put(md.getModuleRevisionId().getModuleId(), javaProject);
+                        }
+                    }
+                }
+
+            } catch (JavaModelException e) {
+                e.printStackTrace();
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+
         for (Iterator iter = all.iterator(); iter.hasNext();) {
             ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
-            if (artifact.getLocalFile() != null && accept(artifact.getArtifact())) {
-                Path classpathArtifact = new Path(artifact.getLocalFile().getAbsolutePath());
-                Path sourcesArtifact = getSourcesArtifactPath(artifact, all);
-                Path javadocArtifact = getJavadocArtifactPath(artifact, all);
-                paths.add(JavaCore.newLibraryEntry(classpathArtifact, getSourceAttachment(
-                    classpathArtifact, sourcesArtifact), getSourceAttachmentRoot(classpathArtifact,
-                    sourcesArtifact), null, getExtraAttribute(classpathArtifact, javadocArtifact),
-                    false));
+
+            boolean usedProject = false;
+            if (conf.isResolveInWorkspace()) {
+                ModuleId moduleId = artifact.getArtifact().getModuleRevisionId().getModuleId();
+                String moduleName = moduleId.getName();
+                ModuleRevisionId moduleRevisionId = (ModuleRevisionId) dependencies.get(moduleName);
+                if (moduleRevisionId != null) {
+                    IJavaProject project = (IJavaProject) idToJProject.get(moduleId);
+                    if (project != null && project.exists() && project.isOpen()) {
+                        IClasspathEntry entry = JavaCore.newProjectEntry(project.getPath());
+                        if (entry != null && !paths.contains(entry)) {
+                            paths.add(entry);
+                        }
+                        usedProject = true;
+                    }
+                }
             }
+
+            if (!usedProject) {
+                if (artifact.getLocalFile() != null && accept(artifact.getArtifact())) {
+                    Path classpathArtifact = new Path(artifact.getLocalFile().getAbsolutePath());
+                    Path sourcesArtifact = getSourcesArtifactPath(artifact, all);
+                    Path javadocArtifact = getJavadocArtifactPath(artifact, all);
+                    paths.add(JavaCore.newLibraryEntry(classpathArtifact, getSourceAttachment(
+                        classpathArtifact, sourcesArtifact), getSourceAttachmentRoot(
+                        classpathArtifact, sourcesArtifact), null, getExtraAttribute(
+                        classpathArtifact, javadocArtifact), false));
+                }
+            }
+
         }
         classpathEntries = (IClasspathEntry[]) paths.toArray(new IClasspathEntry[paths.size()]);
 
         return classpathEntries;
     }
 
+    /*
+     * Finds and parses the ivy.xml file for the supplied project's classpath container
+     */
+    private ModuleDescriptor findModuleDescriptor(IJavaProject javaProject, IClasspathEntry entry)
+            throws ParseException, JavaModelException {
+
+        if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
+            IPath path = entry.getPath();
+            if (IvyClasspathUtil.isIvyClasspathContainer(path)) {
+                IClasspathContainer cp = JavaCore.getClasspathContainer(path, javaProject);
+
+                if (cp instanceof IvyClasspathContainer) {
+                    IvyClasspathContainer c = (IvyClasspathContainer) cp;
+
+                    // TODO Can these be cached? Need to invalidate using delta listener.
+                    try {
+                        IFile iFile = c.getIvyFile();
+                        File ivyFile = new File(iFile.getLocation().toOSString());
+                        URL ivyURL = ivyFile.toURL();
+                        ModuleDescriptor md;
+
+                        md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor(
+                            this.ivy.getSettings(), ivyURL, true); // EG: try to validate even at
+                        // refresh
+
+                        return md;
+                    } catch (Exception e) {
+                        throw new ParseException(
+                                "Error loading Ivy file for " + c.getDescription(), 0);
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
     private Path getSourcesArtifactPath(ArtifactDownloadReport adr, Collection all) {
         Artifact artifact = adr.getArtifact();
         _monitor.subTask("searching sources for " + artifact);
Index: org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
===================================================================
--- org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java	(revision 681710)
+++ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java	(working copy)
@@ -116,7 +116,8 @@
                             || event.getProperty() == PreferenceConstants.DO_RETRIEVE
                             || event.getProperty() == PreferenceConstants.RETRIEVE_PATTERN
                             || event.getProperty() == PreferenceConstants.RETRIEVE_SYNC
-                            || event.getProperty() == PreferenceConstants.ALPHABETICAL_ORDER) {
+                            || event.getProperty() == PreferenceConstants.ALPHABETICAL_ORDER
+                            || event.getProperty() == PreferenceConstants.RESOLVE_IN_WORKSPACE) {
                         prefStoreChanged();
                     }
                 } catch (JavaModelException e) {
Index: org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
===================================================================
--- org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java	(revision 681730)
+++ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java	(working copy)
@@ -61,6 +61,7 @@
 
         prefStore.setDefault(PreferenceConstants.RETRIEVE_SYNC, false);
         prefStore.setDefault(PreferenceConstants.ALPHABETICAL_ORDER, false);
+        prefStore.setDefault(PreferenceConstants.RESOLVE_IN_WORKSPACE, false);
     }
 
     public String getIvyOrg() {
@@ -111,4 +112,8 @@
         return prefStore.getBoolean(PreferenceConstants.ALPHABETICAL_ORDER);
     }
 
+    public boolean isResolveInWorkspace() {
+        return prefStore.getBoolean(PreferenceConstants.RESOLVE_IN_WORKSPACE);
+    }
+
 }
Index: org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
===================================================================
--- org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java	(revision 681730)
+++ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java	(working copy)
@@ -216,10 +216,21 @@
         spacerData.horizontalSpan = 3;
         spacer.setLayoutData(spacerData);
 
+        BooleanFieldEditor resolveInWorkspace = new BooleanFieldEditor(
+                PreferenceConstants.RESOLVE_IN_WORKSPACE,
+                "Resolve dependencies to workspace projects (will remove jars on your classpath which are in the cache and depend on projects in your workspace)",
+                fieldParent);
+        addField(resolveInWorkspace);
+
         spacer = new Label(fieldParent, SWT.NONE);
         spacerData = new GridData();
         spacerData.horizontalSpan = 3;
         spacer.setLayoutData(spacerData);
+
+        spacer = new Label(fieldParent, SWT.NONE);
+        spacerData = new GridData();
+        spacerData.horizontalSpan = 3;
+        spacer.setLayoutData(spacerData);
         spacer.setText("Editor information");
         spacer = new Label(fieldParent, SWT.SEPARATOR | SWT.HORIZONTAL);
         spacer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
Index: org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
===================================================================
--- org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java	(revision 681730)
+++ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java	(working copy)
@@ -56,4 +56,6 @@
 
     public static final String ALPHABETICAL_ORDER = "order.alphabetical";
 
+    public static final String RESOLVE_IN_WORKSPACE = "resolveInWorkspace";
+
 }
