Index: src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
===================================================================
--- src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java	(revision 605912)
+++ src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java	(working copy)
@@ -19,6 +19,7 @@
 package org.apache.maven.plugin.eclipse;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
@@ -432,6 +433,76 @@
         testProject( "project-38" );
     }
 
+    public void testProject39and40()
+        throws Exception
+    {
+        TempEclipseWorkspace workspace13 = new TempEclipseWorkspace( "eclipseWithDefault13", true );
+        TempEclipseWorkspace workspace15 = new TempEclipseWorkspace( "eclipseWithDefault15", false );
+        TempEclipseWorkspace rad7 = new TempEclipseWorkspace( "rad7WithDefault14", false );
+        doTestProject38and39( "project-39", workspace13, "", null );
+        doTestProject38and39( "project-39", workspace15, "J2SE-1.3", null );
+        doTestProject38and39( "project-39", rad7, "J2SE-1.3", null );
+        String jre131 = new java.io.File( "target/test-classes/eclipse/dummyJDK/1.3.1/bin/javac" ).getCanonicalPath();
+        doTestProject38and39( "project-40", workspace13, "JVM 1.3.1", jre131 );
+        doTestProject38and39( "project-40", workspace15, "JVM 1.3.1", jre131 );
+        doTestProject38and39( "project-40", rad7, "", jre131 );
+    }
+
+    public void testProject41()
+        throws Exception
+    {
+        TempEclipseWorkspace rad7 = new TempEclipseWorkspace( "rad7WithDefault14", false );
+        Properties properties = new Properties();
+        properties.setProperty( "eclipse.workspaceToConnect", rad7.workspaceLocation.getCanonicalPath() );
+        testProject( "project-41", properties, "clean", "eclipse" );
+        
+    }
+
+    public void testProject42()
+        throws Exception
+    {
+        TempEclipseWorkspace rad7 = new TempEclipseWorkspace( "rad7WithDefault14", false );
+        Properties properties = new Properties();
+        properties.setProperty( "eclipse.workspaceToConnect", rad7.workspaceLocation.getCanonicalPath() );
+        testProject( "project-42", properties, "clean", "eclipse" );
+        
+    }
+
+    public void doTestProject38and39( String project, TempEclipseWorkspace workspace, String expectedJRE, String jreExec )
+        throws Exception
+    {
+        Properties properties = new Properties();
+        properties.setProperty( "eclipse.workspaceToConnect", workspace.workspaceLocation.getCanonicalPath() );
+        if ( jreExec != null )
+        {
+            properties.setProperty( "maven.compiler.executable", jreExec );
+        }
+        testProject( project, properties, "clean", "eclipse" );
+
+        Xpp3Dom classpath =
+            Xpp3DomBuilder.build( new FileReader( getTestFile( "target/test-classes/projects/" + project
+                + "/.classpath" ) ) );
+
+        boolean foundDirectCompileAsProject = false;
+        String foundJRE = "";
+
+        Xpp3Dom[] classpathentries = classpath.getChildren( "classpathentry" );
+        for ( int index = 0; index < classpathentries.length; index++ )
+        {
+            if ( "/direct-compile".equals( classpathentries[index].getAttribute( "path" ) ) )
+            {
+                foundDirectCompileAsProject = true;
+            }
+            String path = classpathentries[index].getAttribute( "path" );
+            if ( "con".equals( classpathentries[index].getAttribute( "kind" ) ) && path.lastIndexOf( '/' ) > 0 )
+            {
+                foundJRE = path.substring( path.lastIndexOf( '/' ) + 1 );
+            }
+        }
+        assertTrue( foundDirectCompileAsProject );
+        assertEquals( expectedJRE, foundJRE );
+    }
+
     public void testJeeSimple()
         throws Exception
     {
Index: src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java
===================================================================
--- src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java	(revision 0)
+++ src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java	(revision 0)
@@ -0,0 +1,78 @@
+package org.apache.maven.plugin.eclipse;
+
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.eclipse.core.internal.localstore.ILocalStoreConstants;
+
+public class TempEclipseWorkspace
+{
+
+    File workspaceLocation;
+
+    public TempEclipseWorkspace( String testWorkspaceName, boolean usePathToProject )
+        throws Exception
+    {
+
+        File eclipseLocation = new java.io.File( "target/test-classes/eclipse" ).getCanonicalFile();
+
+        File jdkLocation = new File( eclipseLocation, "dummyJDK" );
+
+        this.workspaceLocation = new File( eclipseLocation, testWorkspaceName + "/workspace" ).getCanonicalFile();
+
+        File localizedIndicator = new File( this.workspaceLocation, ".localized" );
+        if ( !localizedIndicator.exists() )
+        {
+            File propertyfile =
+                new File( workspaceLocation,
+                          ".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs" );
+
+            preparePropertyFile( jdkLocation, propertyfile );
+
+            String projectLocation;
+            if ( usePathToProject )
+            {
+                projectLocation = "URI//file:" + ( new File( workspaceLocation, "direct-compile" ).getCanonicalPath() );
+            }
+            else
+            {
+                projectLocation = "";
+            }
+            FileOutputStream location =
+                new FileOutputStream(
+                                      new File( workspaceLocation,
+                                                ".metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location" ) );
+            DataOutputStream dataOutputStream = new DataOutputStream( location );
+            dataOutputStream.write( ILocalStoreConstants.BEGIN_CHUNK );
+            dataOutputStream.writeUTF( projectLocation );
+            dataOutputStream.write( ILocalStoreConstants.END_CHUNK );
+            dataOutputStream.close();
+            location.close();
+            localizedIndicator.createNewFile();
+        }
+
+    }
+
+    private static void preparePropertyFile( File jdkLocation, File propertyfile )
+        throws IOException, FileNotFoundException
+    {
+        Properties properties = new Properties();
+        properties.load( new FileInputStream( propertyfile ) );
+        properties.setProperty(
+                                "org.eclipse.jdt.launching.PREF_VM_XML",
+                                properties.getProperty( "org.eclipse.jdt.launching.PREF_VM_XML" ).replaceAll(
+                                                                                                              "__replace_with_test_dir__",
+                                                                                                              jdkLocation.getCanonicalPath() ) );
+        properties.store( new FileOutputStream( propertyfile ), "" );
+    }
+
+    public File getWorkspaceLocation()
+    {
+        return workspaceLocation;
+    }
+}
Index: src/test/resources/eclipse/rad7WithDefault14/workspace/direct-compile/.project
===================================================================
--- src/test/resources/eclipse/rad7WithDefault14/workspace/direct-compile/.project	(revision 0)
+++ src/test/resources/eclipse/rad7WithDefault14/workspace/direct-compile/.project	(revision 0)
@@ -0,0 +1,9 @@
+<projectDescription>
+  <name>direct-compile</name>
+  <comment/>
+  <projects/>
+  <buildSpec>
+  </buildSpec>
+  <natures>
+  </natures>
+</projectDescription>
\ No newline at end of file
Index: src/test/resources/eclipse/rad7WithDefault14/workspace/direct-compile/pom.xml
===================================================================
--- src/test/resources/eclipse/rad7WithDefault14/workspace/direct-compile/pom.xml	(revision 0)
+++ src/test/resources/eclipse/rad7WithDefault14/workspace/direct-compile/pom.xml	(revision 0)
@@ -0,0 +1,35 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>eclipsetest</groupId>
+  <artifactId>direct-compile</artifactId>
+  <version>1.0</version>
+  <distributionManagement>
+    <status>verified</status>
+  </distributionManagement>
+  <dependencies>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-compile</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-test</artifactId>
+      <version>1.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-provided</artifactId>
+      <version>1.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-optional</artifactId>
+      <version>1.0</version>
+      <optional>true</optional>
+    </dependency>
+  </dependencies>
+</project>
Index: src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs
===================================================================
--- src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs	(revision 0)
+++ src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs	(revision 0)
@@ -0,0 +1,3 @@
+#Thu Dec 20 11:16:55 CET 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.launching.PREF_VM_XML=<?xml version\="1.0" encoding\="UTF-8"?>\n<vmSettings defaultVM\="57,org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType18,was.vm.was.base.v6">\n<vmType id\="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType">\n<vm id\="1197975169456" javadocURL\="http\://java.sun.com/j2se/1.5.0/docs/api/" name\="jdk" path\="/opt/IBM2/SDP70/jdk"/>\n<vm id\="was.vm.was.express.v51" name\="WebSphere v5.1 Express JRE" path\="/opt/IBM2/SDP70/runtimes/base_v51_stub/java/jre"/>\n<vm id\="was.vm.was.base.v51" name\="WebSphere v5.1 JRE" path\="/opt/IBM2/SDP70/runtimes/base_v51_stub/java/jre"/>\n<vm id\="was.vm.was.base.v6" name\="WebSphere v6 JRE" path\="/opt/IBM2/SDP70/runtimes/base_v6_stub/java/jre"/>\n<vm id\="was.vm.was.base.v61" name\="WebSphere v6.1 JRE" path\="/opt/IBM2/SDP70/runtimes/base_v61_stub/java/jre"/>\n</vmType>\n</vmSettings>\n
Index: src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.server.core.prefs
===================================================================
--- src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.server.core.prefs	(revision 0)
+++ src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.server.core.prefs	(revision 0)
@@ -0,0 +1,4 @@
+#Thu Dec 20 10:12:38 CET 2007
+module-start-timeout=300000
+runtimes=<?xml version\="1.0" encoding\="UTF-8"?>\n<runtimes>\n  <runtime id\="was.express.v51" id-set\="true" location\="/opt/IBM2/SDP70/runtimes/express_v51_stub" locked\="true" name\="WebSphere Application Server v5.1 Express stub" runtime-type-id\="com.ibm.etools.websphere.runtime.v51.express" stub\="true" test-environment\="false" timestamp\="0"/>\n  <runtime id\="was.base.v51" id-set\="true" location\="/opt/IBM2/SDP70/runtimes/base_v51_stub" locked\="true" name\="WebSphere Application Server v5.1 stub" runtime-type-id\="com.ibm.etools.websphere.runtime.v51.base" stub\="true" test-environment\="false" timestamp\="0"/>\n  <runtime id\="was.base.v6" id-set\="true" location\="/opt/IBM2/SDP70/runtimes/base_v6_stub" locked\="true" name\="WebSphere Application Server v6.0 stub" runtime-type-id\="com.ibm.ws.ast.st.runtime.v60" stub\="true" test-environment\="false" timestamp\="0"/>\n  <runtime id\="was.base.v61" id-set\="true" location\="/opt/IBM2/SDP70/runtimes/base_v61_stub" locked\="true" name\="WebSphere Application Server v6.1 stub" runtime-type-id\="com.ibm.ws.ast.st.runtime.v61" stub\="true" test-environment\="false" timestamp\="0"/>\n  <runtime id\="JBoss v4.0" location\="/home/nir/Desktop/jboss-4.2.1.GA/jboss-4.2.1.GA/bin" name\="JBoss v4.0" runtime-type-id\="org.eclipse.jst.server.generic.runtime.jboss4" server_definition_id\="org.eclipse.jst.server.generic.runtime.jboss4" timestamp\="0">\n    <map key\="generic_server_instance_properties" serverRootDirectory\="/home/nir/Desktop/jboss-4.2.1.GA/jboss-4.2.1.GA"/>\n  </runtime>\n</runtimes>\n
+eclipse.preferences.version=1
Index: src/test/resources/eclipse/eclipseWithDefault13/workspace/direct-compile/.project
===================================================================
--- src/test/resources/eclipse/eclipseWithDefault13/workspace/direct-compile/.project	(revision 0)
+++ src/test/resources/eclipse/eclipseWithDefault13/workspace/direct-compile/.project	(revision 0)
@@ -0,0 +1,9 @@
+<projectDescription>
+  <name>direct-compile</name>
+  <comment/>
+  <projects/>
+  <buildSpec>
+  </buildSpec>
+  <natures>
+  </natures>
+</projectDescription>
\ No newline at end of file
Index: src/test/resources/eclipse/eclipseWithDefault13/workspace/direct-compile/pom.xml
===================================================================
--- src/test/resources/eclipse/eclipseWithDefault13/workspace/direct-compile/pom.xml	(revision 0)
+++ src/test/resources/eclipse/eclipseWithDefault13/workspace/direct-compile/pom.xml	(revision 0)
@@ -0,0 +1,35 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>eclipsetest</groupId>
+  <artifactId>direct-compile</artifactId>
+  <version>1.0</version>
+  <distributionManagement>
+    <status>verified</status>
+  </distributionManagement>
+  <dependencies>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-compile</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-test</artifactId>
+      <version>1.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-provided</artifactId>
+      <version>1.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-optional</artifactId>
+      <version>1.0</version>
+      <optional>true</optional>
+    </dependency>
+  </dependencies>
+</project>
Index: src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs
===================================================================
--- src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs	(revision 0)
+++ src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs	(revision 0)
@@ -0,0 +1,3 @@
+#Wed Jun 06 22:20:38 CEST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.launching.PREF_VM_XML=<?xml version\="1.0" encoding\="UTF-8"?>\n<vmSettings defaultVM\="52,org.eclipse.jdt.internal.launching.macosx.MacOSXType5,1.3" defaultVMConnector\="">\n<vmType id\="org.eclipse.jdt.internal.launching.macosx.MacOSXType">\n<vm id\="1.3" javadocURL\="http\://java.sun.com/j2se/1.3/docs/api/" name\="JVM 1.3" path\="__replace_with_test_dir__/1.3"/>\n<vm id\="1.3.1" javadocURL\="http\://java.sun.com/j2se/1.3/docs/api/" name\="JVM 1.3.1" path\="__replace_with_test_dir__/1.3.1"/>\n<vm id\="1.4" javadocURL\="http\://java.sun.com/j2se/1.4.2/docs/api/" name\="JVM 1.4" path\="__replace_with_test_dir__/1.4"/>\n<vm id\="1.4.2" javadocURL\="http\://java.sun.com/j2se/1.4.2/docs/api/" name\="JVM 1.4.2" path\="__replace_with_test_dir__/1.4.2"/>\n<vm id\="1.5" javadocURL\="http\://java.sun.com/j2se/1.5.0/docs/api/" name\="JVM 1.5" path\="__replace_with_test_dir__/1.5"/>\n<vm id\="1.5.0" javadocURL\="http\://java.sun.com/j2se/1.5.0/docs/api/" name\="JVM 1.5.0 (MacOS X Default)" path\="__replace_with_test_dir__/1.5.0"/>\n</vmType>\n</vmSettings>\n
Index: src/test/resources/eclipse/eclipseWithDefault15/workspace/direct-compile/.project
===================================================================
--- src/test/resources/eclipse/eclipseWithDefault15/workspace/direct-compile/.project	(revision 0)
+++ src/test/resources/eclipse/eclipseWithDefault15/workspace/direct-compile/.project	(revision 0)
@@ -0,0 +1,9 @@
+<projectDescription>
+  <name>direct-compile</name>
+  <comment/>
+  <projects/>
+  <buildSpec>
+  </buildSpec>
+  <natures>
+  </natures>
+</projectDescription>
\ No newline at end of file
Index: src/test/resources/eclipse/eclipseWithDefault15/workspace/direct-compile/pom.xml
===================================================================
--- src/test/resources/eclipse/eclipseWithDefault15/workspace/direct-compile/pom.xml	(revision 0)
+++ src/test/resources/eclipse/eclipseWithDefault15/workspace/direct-compile/pom.xml	(revision 0)
@@ -0,0 +1,35 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>eclipsetest</groupId>
+  <artifactId>direct-compile</artifactId>
+  <version>1.0</version>
+  <distributionManagement>
+    <status>verified</status>
+  </distributionManagement>
+  <dependencies>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-compile</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-test</artifactId>
+      <version>1.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-provided</artifactId>
+      <version>1.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>eclipsetest</groupId>
+      <artifactId>deps-direct-optional</artifactId>
+      <version>1.0</version>
+      <optional>true</optional>
+    </dependency>
+  </dependencies>
+</project>
Index: src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs
===================================================================
--- src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs	(revision 0)
+++ src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs	(revision 0)
@@ -0,0 +1,3 @@
+#Wed Jun 06 22:20:38 CEST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.launching.PREF_VM_XML=<?xml version\="1.0" encoding\="UTF-8"?>\n<vmSettings defaultVM\="52,org.eclipse.jdt.internal.launching.macosx.MacOSXType5,1.5" defaultVMConnector\="">\n<vmType id\="org.eclipse.jdt.internal.launching.macosx.MacOSXType">\n<vm id\="1.3" javadocURL\="http\://java.sun.com/j2se/1.3/docs/api/" name\="JVM 1.3" path\="__replace_with_test_dir__/1.3"/>\n<vm id\="1.3.1" javadocURL\="http\://java.sun.com/j2se/1.3/docs/api/" name\="JVM 1.3.1" path\="__replace_with_test_dir__/1.3.1"/>\n<vm id\="1.4" javadocURL\="http\://java.sun.com/j2se/1.4.2/docs/api/" name\="JVM 1.4" path\="__replace_with_test_dir__/1.4"/>\n<vm id\="1.4.2" javadocURL\="http\://java.sun.com/j2se/1.4.2/docs/api/" name\="JVM 1.4.2" path\="__replace_with_test_dir__/1.4.2"/>\n<vm id\="1.5" javadocURL\="http\://java.sun.com/j2se/1.5.0/docs/api/" name\="JVM 1.5" path\="__replace_with_test_dir__/1.5"/>\n<vm id\="1.5.0" javadocURL\="http\://java.sun.com/j2se/1.5.0/docs/api/" name\="JVM 1.5.0 (MacOS X Default)" path\="__replace_with_test_dir__/1.5.0"/>\n</vmType>\n</vmSettings>\n
Index: src/test/resources/projects/project-40/expected/.project
===================================================================
--- src/test/resources/projects/project-40/expected/.project	(revision 0)
+++ src/test/resources/projects/project-40/expected/.project	(revision 0)
@@ -0,0 +1,15 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-40</name>
+  <comment/>
+  <projects>
+    <project>direct-compile</project>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file
Index: src/test/resources/projects/project-40/src/main/java/DummyClass.txt
===================================================================
--- src/test/resources/projects/project-40/src/main/java/DummyClass.txt	(revision 0)
+++ src/test/resources/projects/project-40/src/main/java/DummyClass.txt	(revision 0)
@@ -0,0 +1,7 @@
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id: DummyClass.txt 359507 2005-12-28 13:14:19Z fgiust $
+ */
+public class DummyClass
+{
+}
Index: src/test/resources/projects/project-40/pom.xml
===================================================================
--- src/test/resources/projects/project-40/pom.xml	(revision 0)
+++ src/test/resources/projects/project-40/pom.xml	(revision 0)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eclipse</groupId>
+	<artifactId>maven-eclipse-plugin-test-project-40</artifactId>
+	<version>99.0</version>
+	<name>Maven</name>
+	<dependencies>
+		<dependency>
+			<groupId>eclipsetest</groupId>
+			<artifactId>direct-compile</artifactId>
+			<version>1.0</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<version>test</version>
+				<configuration></configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
Index: src/test/resources/projects/project-41/expected/.project
===================================================================
--- src/test/resources/projects/project-41/expected/.project	(revision 0)
+++ src/test/resources/projects/project-41/expected/.project	(revision 0)
@@ -0,0 +1,19 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-41</name>
+  <comment/>
+  <projects>
+    <project>direct-compile</project>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.wst.common.project.facet.core.builder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.wst.validation.validationbuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file
Index: src/test/resources/projects/project-41/expected/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
--- src/test/resources/projects/project-41/expected/.settings/org.eclipse.wst.common.project.facet.core.xml	(revision 0)
+++ src/test/resources/projects/project-41/expected/.settings/org.eclipse.wst.common.project.facet.core.xml	(revision 0)
@@ -0,0 +1,9 @@
+<faceted-project>
+  <fixed facet="jst.java"/>
+  <runtime name="WebSphere Application Server v5.1 Express stub"/>
+  <installed facet="com.ibm.websphere.extended.ear" version="5.1"/>
+  <installed facet="com.ibm.websphere.coexistence.ear" version="5.1"/>
+  <fixed facet="jst.ear"/>
+  <installed facet="jst.ear" version="1.4"/>
+  <installed facet="jst.java" version="1.4"/>
+</faceted-project>
\ No newline at end of file
Index: src/test/resources/projects/project-41/expected/.settings/org.eclipse.wst.common.component
===================================================================
--- src/test/resources/projects/project-41/expected/.settings/org.eclipse.wst.common.component	(revision 0)
+++ src/test/resources/projects/project-41/expected/.settings/org.eclipse.wst.common.component	(revision 0)
@@ -0,0 +1,11 @@
+<project-modules id="moduleCoreId" project-version="1.5.0">
+  <wb-module deploy-name="maven-eclipse-plugin-test-project-41">
+    <wb-resource deploy-path="/" source-path="target/eclipseEar"/>
+    <dependent-module archiveName="deps-direct-compile-1.0.jar" deploy-path="/" handle="module:/classpath/var/M2_REPO/eclipsetest/deps-direct-compile/1.0/deps-direct-compile-1.0.jar">
+      <dependency-type>uses</dependency-type>
+    </dependent-module>
+    <dependent-module archiveName="direct-compile.jar" deploy-path="/" handle="module:/resource/direct-compile/direct-compile">
+      <dependency-type>uses</dependency-type>
+    </dependent-module>
+  </wb-module>
+</project-modules>
\ No newline at end of file
Index: src/test/resources/projects/project-41/pom.xml
===================================================================
--- src/test/resources/projects/project-41/pom.xml	(revision 0)
+++ src/test/resources/projects/project-41/pom.xml	(revision 0)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eclipse</groupId>
+	<artifactId>maven-eclipse-plugin-test-project-41</artifactId>
+	<version>99.0</version>
+	<name>Maven</name>
+	<packaging>ear</packaging>
+	<dependencies>
+		<dependency>
+			<groupId>eclipsetest</groupId>
+			<artifactId>direct-compile</artifactId>
+			<version>1.0</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<version>test</version>
+				<configuration>
+					<wtpmanifest>true</wtpmanifest>
+					<wtpapplicationxml>true</wtpapplicationxml>
+					<wtpversion>1.5</wtpversion>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
Index: src/test/resources/projects/project-42/expected/.project
===================================================================
--- src/test/resources/projects/project-42/expected/.project	(revision 0)
+++ src/test/resources/projects/project-42/expected/.project	(revision 0)
@@ -0,0 +1,19 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-42</name>
+  <comment/>
+  <projects>
+    <project>direct-compile</project>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.wst.common.project.facet.core.builder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.wst.validation.validationbuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file
Index: src/test/resources/projects/project-42/expected/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
--- src/test/resources/projects/project-42/expected/.settings/org.eclipse.wst.common.project.facet.core.xml	(revision 0)
+++ src/test/resources/projects/project-42/expected/.settings/org.eclipse.wst.common.project.facet.core.xml	(revision 0)
@@ -0,0 +1,9 @@
+<faceted-project>
+  <fixed facet="jst.java"/>
+  <runtime name="WebSphere Application Server v6.0 stub"/>
+  <installed facet="com.ibm.websphere.extended.ear" version="6.0"/>
+  <installed facet="com.ibm.websphere.coexistence.ear" version="6.0"/>
+  <fixed facet="jst.ear"/>
+  <installed facet="jst.ear" version="1.4"/>
+  <installed facet="jst.java" version="1.4"/>
+</faceted-project>
\ No newline at end of file
Index: src/test/resources/projects/project-42/expected/.settings/org.eclipse.wst.common.component
===================================================================
--- src/test/resources/projects/project-42/expected/.settings/org.eclipse.wst.common.component	(revision 0)
+++ src/test/resources/projects/project-42/expected/.settings/org.eclipse.wst.common.component	(revision 0)
@@ -0,0 +1,11 @@
+<project-modules id="moduleCoreId" project-version="1.5.0">
+  <wb-module deploy-name="maven-eclipse-plugin-test-project-42">
+    <wb-resource deploy-path="/" source-path="target/eclipseEar"/>
+    <dependent-module archiveName="deps-direct-compile-1.0.jar" deploy-path="/" handle="module:/classpath/var/M2_REPO/eclipsetest/deps-direct-compile/1.0/deps-direct-compile-1.0.jar">
+      <dependency-type>uses</dependency-type>
+    </dependent-module>
+    <dependent-module archiveName="direct-compile.jar" deploy-path="/" handle="module:/resource/direct-compile/direct-compile">
+      <dependency-type>uses</dependency-type>
+    </dependent-module>
+  </wb-module>
+</project-modules>
\ No newline at end of file
Index: src/test/resources/projects/project-42/pom.xml
===================================================================
--- src/test/resources/projects/project-42/pom.xml	(revision 0)
+++ src/test/resources/projects/project-42/pom.xml	(revision 0)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eclipse</groupId>
+	<artifactId>maven-eclipse-plugin-test-project-42</artifactId>
+	<version>99.0</version>
+	<name>Maven</name>
+	<packaging>ear</packaging>
+	<dependencies>
+		<dependency>
+			<groupId>eclipsetest</groupId>
+			<artifactId>direct-compile</artifactId>
+			<version>1.0</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<version>test</version>
+				<configuration>
+					<wtpdefaultserver>6.0</wtpdefaultserver>
+					<wtpmanifest>true</wtpmanifest>
+					<wtpapplicationxml>true</wtpapplicationxml>
+					<wtpversion>1.5</wtpversion>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
Index: src/test/resources/projects/project-39/expected/.project
===================================================================
--- src/test/resources/projects/project-39/expected/.project	(revision 0)
+++ src/test/resources/projects/project-39/expected/.project	(revision 0)
@@ -0,0 +1,15 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-39</name>
+  <comment/>
+  <projects>
+    <project>direct-compile</project>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file
Index: src/test/resources/projects/project-39/src/main/java/DummyClass.txt
===================================================================
--- src/test/resources/projects/project-39/src/main/java/DummyClass.txt	(revision 0)
+++ src/test/resources/projects/project-39/src/main/java/DummyClass.txt	(revision 0)
@@ -0,0 +1,7 @@
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id: DummyClass.txt 359507 2005-12-28 13:14:19Z fgiust $
+ */
+public class DummyClass
+{
+}
Index: src/test/resources/projects/project-39/pom.xml
===================================================================
--- src/test/resources/projects/project-39/pom.xml	(revision 0)
+++ src/test/resources/projects/project-39/pom.xml	(revision 0)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eclipse</groupId>
+	<artifactId>maven-eclipse-plugin-test-project-39</artifactId>
+	<version>99.0</version>
+	<name>Maven</name>
+	<dependencies>
+		<dependency>
+			<groupId>eclipsetest</groupId>
+			<artifactId>direct-compile</artifactId>
+			<version>1.0</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<version>test</version>
+				<configuration></configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.3</source>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
Index: src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
===================================================================
--- src/main/java/org/apache/maven/plugin/ide/IdeUtils.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/ide/IdeUtils.java	(working copy)
@@ -266,7 +266,10 @@
         return (Xpp3Dom[]) configurationDomList.toArray( new Xpp3Dom[configurationDomList.size()] );
     }
 
-    public static String getProjectName( String template, IdeDependency dep )
+    /**
+     * Use {@link IdeDependency#getEclipseProjectName()} instead.
+     */
+    protected static String getProjectName( String template, IdeDependency dep )
     {
         return getProjectName( template, dep.getGroupId(), dep.getArtifactId(), dep.getVersion() );
     }
@@ -288,7 +291,7 @@
         return getProjectName( template, project.getGroupId(), project.getArtifactId(), project.getVersion() );
     }
 
-    public static String getProjectName( IdeDependency dep, boolean addVersionToProjectName )
+    private static String getProjectName( IdeDependency dep, boolean addVersionToProjectName )
     {
         return getProjectName( addVersionToProjectName ? PROJECT_NAME_WITH_VERSION_TEMPLATE
                         : PROJECT_NAME_DEFAULT_TEMPLATE, dep );
Index: src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
===================================================================
--- src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java	(working copy)
@@ -204,6 +204,24 @@
     private Logger logger;
 
     /**
+     * This eclipse workspace is read and all artifacts detected there will be connected as eclipse projects and will
+     * not be linked to the jars in the local repository. Requirement is that it was created with the similar wtp
+     * settings as the reactor projects, but the project name template my differ. The pom's in the workspace projects
+     * may not contain variables in the artefactId, groupId and version tags.
+     * 
+     * @parameter expression="${eclipse.workspaceToConnect}"
+     */
+    protected String workspace;
+
+    /**
+     * Limit the use of project references to the current workspaceToConnect. No project references will be created to
+     * projects in the reactor when they are not available in the workspace.
+     * 
+     * @parameter expression="${eclipse.limitProjectReferencesToWorkspace}" default-value="false"
+     */
+    protected boolean limitProjectReferencesToWorkspace;
+
+    /**
      * Getter for <code>artifactMetadataSource</code>.
      * 
      * @return Returns the artifactMetadataSource.
@@ -570,9 +588,9 @@
                         int dependencyDepth = node.getDepth();
                         Artifact art = node.getArtifact();
                         boolean isReactorProject = getUseProjectReferences() && isAvailableAsAReactorProject( art );
-
+                        boolean isWorkspaceProject = getUseProjectReferences() && isAvailableAsAWorkspaceProject( art );
                         // don't resolve jars for reactor projects
-                        if ( !isReactorProject )
+                        if ( !isReactorProject || ( limitProjectReferencesToWorkspace && !isWorkspaceProject ) )
                         {
                             try
                             {
@@ -596,8 +614,8 @@
                             }
                         }
 
-                        if ( !isReactorProject ||
-                            emittedReactorProjectId.add( art.getGroupId() + '-' + art.getArtifactId() ) )
+                        if ( !isReactorProject
+                            || emittedReactorProjectId.add( art.getGroupId() + '-' + art.getArtifactId() ) )
                         {
 
                             // the following doesn't work: art.getArtifactHandler().getPackaging() always returns "jar"
@@ -653,9 +671,13 @@
 
                             isOsgiBundle = osgiSymbolicName != null;
 
+                            boolean useProjectReference = ( isReactorProject && !limitProjectReferencesToWorkspace ) || // default
+                                ( limitProjectReferencesToWorkspace && isWorkspaceProject ) || // limitProjectReferencesToWorkspace
+                                ( !isReactorProject && isWorkspaceProject ); // default + workspace projects
+
                             IdeDependency dep =
                                 new IdeDependency( art.getGroupId(), art.getArtifactId(), art.getVersion(),
-                                                   art.getClassifier(), isReactorProject,
+                                                   art.getClassifier(), useProjectReference,
                                                    Artifact.SCOPE_TEST.equals( art.getScope() ),
                                                    Artifact.SCOPE_SYSTEM.equals( art.getScope() ),
                                                    Artifact.SCOPE_PROVIDED.equals( art.getScope() ),
@@ -783,8 +805,8 @@
             {
                 MavenProject reactorProject = (MavenProject) iter.next();
 
-                if ( reactorProject.getGroupId().equals( artifact.getGroupId() ) &&
-                    reactorProject.getArtifactId().equals( artifact.getArtifactId() ) )
+                if ( reactorProject.getGroupId().equals( artifact.getGroupId() )
+                    && reactorProject.getArtifactId().equals( artifact.getArtifactId() ) )
                 {
                     if ( reactorProject.getVersion().equals( artifact.getVersion() ) )
                     {
@@ -793,10 +815,10 @@
                     else
                     {
                         getLog().info(
-                                       "Artifact " +
-                                           artifact.getId() +
-                                           " already available as a reactor project, but with different version. Expected: " +
-                                           artifact.getVersion() + ", found: " + reactorProject.getVersion() );
+                                       "Artifact "
+                                           + artifact.getId()
+                                           + " already available as a reactor project, but with different version. Expected: "
+                                           + artifact.getVersion() + ", found: " + reactorProject.getVersion() );
                     }
                 }
             }
@@ -804,6 +826,48 @@
         return false;
     }
 
+    /**
+     * @return an array with all dependencies avaliable in the workspace, to be implemented by the subclasses.
+     */
+    protected IdeDependency[] getWorkspaceArtefacts()
+    {
+        return new IdeDependency[0];
+    }
+
+    /**
+     * Utility method that locates a project in the workspace for the given artifact.
+     * 
+     * @param artifact the artifact a project should produce.
+     * @return <code>true</code> if the artifact is produced by a reactor projectart.
+     */
+    private boolean isAvailableAsAWorkspaceProject( Artifact artifact )
+    {
+        IdeDependency[] workspaceArtefacts = getWorkspaceArtefacts();
+        for ( int index = 0; workspaceArtefacts != null && index < workspaceArtefacts.length; index++ )
+        {
+            IdeDependency workspaceArtefact = workspaceArtefacts[index];
+            if ( workspaceArtefact.getGroupId().equals( artifact.getGroupId() )
+                && workspaceArtefact.getArtifactId().equals( artifact.getArtifactId() ) )
+            {
+                if ( workspaceArtefact.getVersion().equals( artifact.getVersion() ) )
+                {
+                    workspaceArtefact.setAddedToClasspath( true );
+                    logger.debug( "Using workspace project: " + workspaceArtefact.getEclipseProjectName() );
+                    return true;
+                }
+                else
+                {
+                    getLog().info(
+                                   "Artifact "
+                                       + artifact.getId()
+                                       + " already available as a workspace project, but with different version. Expected: "
+                                       + artifact.getVersion() + ", found: " + workspaceArtefact.getVersion() );
+                }
+            }
+        }
+        return false;
+    }
+
     private Map createManagedVersionMap( ArtifactFactory artifactFactory, String projectId,
                                          DependencyManagement dependencyManagement )
         throws MojoExecutionException
@@ -967,8 +1031,8 @@
             if ( getLog().isDebugEnabled() )
             {
                 getLog().debug(
-                                "Searching for sources for " + dependency.getId() + ":" + dependency.getClassifier() +
-                                    " at " + dependency.getId() + ":" + classifier );
+                                "Searching for sources for " + dependency.getId() + ":" + dependency.getClassifier()
+                                    + " at " + dependency.getId() + ":" + classifier );
             }
 
             if ( !unavailableArtifactsCache.containsKey( dependency.getId() + ":" + classifier ) )
Index: src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java	(working copy)
@@ -35,6 +35,7 @@
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations;
 import org.apache.maven.plugin.eclipse.writers.EclipseClasspathWriter;
 import org.apache.maven.plugin.eclipse.writers.EclipseManifestWriter;
 import org.apache.maven.plugin.eclipse.writers.EclipseOSGiManifestWriter;
@@ -364,6 +365,15 @@
      */
     private boolean wtpapplicationxml;
 
+    /**
+     * What WTP defined server to use for deployment informations.
+     * 
+     * @parameter expression="${eclipse.wtpdefaultserver}"
+     */
+    private String wtpdefaultserver;
+
+    private WorkspaceConfiguration workspaceConfiguration;
+
     protected boolean isJavaProject()
     {
         return isJavaProject;
@@ -710,12 +720,13 @@
     protected void verifyClasspathContainerListIsComplete()
     {
         boolean containsJREContainer = false;
-        // Check if classpathContainer contains a JRE (default, alternate or Execution Environment)
+        // Check if classpathContainer contains a JRE (default, alternate or
+        // Execution Environment)
         for ( Iterator iter = classpathContainers.iterator(); iter.hasNext(); )
         {
             Object classPathContainer = iter.next();
-            if ( classPathContainer != null &&
-                classPathContainer.toString().startsWith( COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER ) )
+            if ( classPathContainer != null
+                && classPathContainer.toString().startsWith( COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER ) )
             {
                 containsJREContainer = true;
                 break;
@@ -906,6 +917,8 @@
 
         EclipseWriterConfig config = new EclipseWriterConfig();
 
+        config.setWorkspaceConfiguration( getWorkspaceConfiguration() );
+
         config.setProjectNameTemplate( calculateProjectNameTemplate() );
 
         String projectName = IdeUtils.getProjectName( config.getProjectNameTemplate(), project );
@@ -982,15 +995,14 @@
                         Xpp3Dom groupId = warDefinitions[index].getChild( "groupId" );
                         Xpp3Dom artifactId = warDefinitions[index].getChild( "artifactId" );
                         Xpp3Dom contextRoot = warDefinitions[index].getChild( "contextRoot" );
-                        if ( groupId != null && artifactId != null && contextRoot != null &&
-                            groupId.getValue() != null && artifactId.getValue() != null &&
-                            contextRoot.getValue() != null )
+                        if ( groupId != null && artifactId != null && contextRoot != null && groupId.getValue() != null
+                            && artifactId.getValue() != null && contextRoot.getValue() != null )
                         {
                             getLog().info(
-                                           "Found context root definition for " + groupId.getValue() + ":" +
-                                               artifactId.getValue() + " " + contextRoot.getValue() );
-                            if ( this.project.getArtifactId().equals( artifactId.getValue() ) &&
-                                this.project.getGroupId().equals( groupId.getValue() ) )
+                                           "Found context root definition for " + groupId.getValue() + ":"
+                                               + artifactId.getValue() + " " + contextRoot.getValue() );
+                            if ( this.project.getArtifactId().equals( artifactId.getValue() )
+                                && this.project.getGroupId().equals( groupId.getValue() ) )
                             {
                                 config.setContextName( contextRoot.getValue() );
                             }
@@ -998,9 +1010,9 @@
                         else
                         {
                             getLog().info(
-                                           "Found incomplete ear configuration in " + reactorProject.getGroupId() +
-                                               ":" + reactorProject.getGroupId() + " found " +
-                                               warDefinitions[index].toString() );
+                                           "Found incomplete ear configuration in " + reactorProject.getGroupId() + ":"
+                                               + reactorProject.getGroupId() + " found "
+                                               + warDefinitions[index].toString() );
                         }
                     }
                 }
@@ -1075,8 +1087,14 @@
     protected void fillDefaultClasspathContainers( String packaging )
     {
         classpathContainers = new ArrayList();
-        classpathContainers.add( COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER );
 
+        if ( getWorkspaceConfiguration().getDefaultClasspathContainer() != null )
+        {
+            getLog().info(
+                           "Adding default classpath contaigner: "
+                               + getWorkspaceConfiguration().getDefaultClasspathContainer() );
+            classpathContainers.add( getWorkspaceConfiguration().getDefaultClasspathContainer() );
+        }
         if ( pde )
         {
             classpathContainers.add( REQUIRED_PLUGINS_CONTAINER );
@@ -1287,6 +1305,43 @@
      */
     public String getProjectNameForArifact( Artifact artifact )
     {
+        IdeDependency[] workspaceArtefacts = getWorkspaceArtefacts();
+        for ( int index = 0; workspaceArtefacts != null && index < workspaceArtefacts.length; index++ )
+        {
+            IdeDependency workspaceArtefact = workspaceArtefacts[index];
+            if ( workspaceArtefact.isAddedToClasspath()
+                && workspaceArtefact.getGroupId().equals( artifact.getGroupId() )
+                && workspaceArtefact.getArtifactId().equals( artifact.getArtifactId() ) )
+            {
+                if ( workspaceArtefact.getVersion().equals( artifact.getVersion() ) )
+                {
+                    return workspaceArtefact.getEclipseProjectName();
+                }
+            }
+        }
         return IdeUtils.getProjectName( calculateProjectNameTemplate(), artifact );
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected IdeDependency[] getWorkspaceArtefacts()
+    {
+        return getWorkspaceConfiguration().getWorkspaceArtefacts();
+    }
+
+    public WorkspaceConfiguration getWorkspaceConfiguration()
+    {
+        if ( workspaceConfiguration == null )
+        {
+            workspaceConfiguration = new WorkspaceConfiguration();
+            if ( this.workspace != null )
+            {
+                workspaceConfiguration.setWorkspaceDirectory( new File( this.workspace ) );
+            }
+            new ReadWorkspaceLocations().init( getLog(), this.workspaceConfiguration, this.project,
+                                               this.wtpdefaultserver );
+        }
+        return workspaceConfiguration;
+    }
 }
Index: src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java	(working copy)
@@ -27,6 +27,7 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.eclipse.EclipsePlugin;
 import org.apache.maven.plugin.eclipse.EclipseSourceDir;
+import org.apache.maven.plugin.eclipse.WorkspaceConfiguration;
 import org.apache.maven.plugin.ide.IdeDependency;
 import org.apache.maven.project.MavenProject;
 
@@ -144,6 +145,18 @@
      */
     private float wtpVersion;
 
+    private WorkspaceConfiguration workspaceConfiguration;
+    
+    public WorkspaceConfiguration getWorkspaceConfiguration()
+    {
+        return workspaceConfiguration;
+    }
+
+    public void setWorkspaceConfiguration( WorkspaceConfiguration workspaceConfiguration )
+    {
+        this.workspaceConfiguration = workspaceConfiguration;
+    }
+
     /**
      * Getter for <code>deps</code>.
      * 
Index: src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java	(working copy)
@@ -194,7 +194,7 @@
                 if ( dep.isReferencedProject() )
                 {
                     writer.startElement( "project" ); //$NON-NLS-1$
-                    writer.writeText( IdeUtils.getProjectName( config.getProjectNameTemplate(), dep ) );
+                    writer.writeText( dep.getEclipseProjectName());
                     writer.endElement();
                 }
             }
Index: src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java	(working copy)
@@ -376,7 +376,7 @@
 
         if ( dep.isReferencedProject() && !config.isPde() )
         {
-            path = "/" + IdeUtils.getProjectName( config.getProjectNameTemplate(), dep ); //$NON-NLS-1$
+            path = "/" + dep.getEclipseProjectName(); //$NON-NLS-1$
             kind = ATTR_SRC;
         }
         else if ( dep.isReferencedProject() && config.isPde() )
@@ -428,11 +428,19 @@
                 else
                 {
                     String fullPath = artifactPath.getPath();
+                    String relativePath = IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, new File( fullPath ), false );
 
-                    path = M2_REPO + "/" //$NON-NLS-1$
-                        + IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, new File( fullPath ), false );
-
-                    kind = ATTR_VAR; //$NON-NLS-1$
+                    if ( !new File( relativePath ).isAbsolute() )
+                    {
+                        path = M2_REPO + "/" //$NON-NLS-1$
+                            + relativePath;
+                        kind = ATTR_VAR; //$NON-NLS-1$
+                    } 
+                    else
+                    {
+                        path = relativePath;
+                        kind = ATTR_LIB;
+                    }
                 }
 
                 if ( dep.getSourceAttachment() != null )
Index: src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java	(working copy)
@@ -183,7 +183,7 @@
                     log.debug( "RadWebSettingsWriter: dependency " + dependency.toString() +
                         " selected for inclusion as lib-module" );
 
-                    String depName = IdeUtils.getProjectName( config.getProjectNameTemplate(), dependency );
+                    String depName = dependency.getEclipseProjectName();
                     String depJar = dependency.getArtifactId() + ".jar";
 
                     writer.startElement( WEBSETTINGS_LIBMODULE );
Index: src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java	(working copy)
@@ -88,6 +88,8 @@
 
     private static final String XMLNS_SCHEMA_LOCATION = "xmlns:schemaLocation";
 
+    private static final String XSI_SCHEMA_LOCATION = "xsi:schemaLocation";
+
     private static final String XMLNS_XMI = "xmlns:xmi";
 
     private static final String XMLNS_XSI = "xmlns:xsi";
@@ -223,8 +225,8 @@
             {
                 if ( !destination.exists() && !destination.mkdirs() )
                 {
-                    throw new IOException( "Could not create destination directory '" + destination.getAbsolutePath() +
-                        "'." );
+                    throw new IOException( "Could not create destination directory '" + destination.getAbsolutePath()
+                        + "'." );
                 }
 
                 copyDirectoryStructure( file, destination );
@@ -244,7 +246,18 @@
         result.setAttribute( EclipseWtpApplicationXMLWriter.VERSION, "1.4" );
         result.setAttribute( EclipseWtpApplicationXMLWriter.XMLNS, "http://java.sun.com/xml/ns/j2ee" );
         result.setAttribute( EclipseWtpApplicationXMLWriter.XMLNS_XSI, "http://www.w3.org/2001/XMLSchema-instance" );
-        result.setAttribute( EclipseWtpApplicationXMLWriter.XMLNS_SCHEMA_LOCATION,
+
+        // special case for development websphere's ....
+        String locationAttribute;
+        if ( this.config.getWorkspaceConfiguration().getWebsphereVersion() != null )
+        {
+            locationAttribute = EclipseWtpApplicationXMLWriter.XSI_SCHEMA_LOCATION;
+        }
+        else
+        {
+            locationAttribute = EclipseWtpApplicationXMLWriter.XMLNS_SCHEMA_LOCATION;
+        }
+        result.setAttribute( locationAttribute,
                              "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" );
         result.addChild( new Xpp3Dom( EclipseWtpApplicationXMLWriter.APPLICATION_XML_DESCRIPTION ) );
         Xpp3Dom name = new Xpp3Dom( EclipseWtpApplicationXMLWriter.APPLICATION_XML_DISPLAY_NAME );
Index: src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java	(working copy)
@@ -46,6 +46,10 @@
     extends AbstractWtpResourceWriter
 {
 
+    private static final String FACET_COM_IBM_WEBSPHERE_COEXISTENCE_EAR = "com.ibm.websphere.coexistence.ear"; //$NON-NLS-1$
+
+    private static final String FACET_COM_IBM_WEBSPHERE_EXTENDED_EAR = "com.ibm.websphere.extended.ear"; //$NON-NLS-1$
+
     private static final String FACET_JST_EAR = "jst.ear"; //$NON-NLS-1$
 
     private static final String FACET_JST_UTILITY = "jst.utility"; //$NON-NLS-1$
@@ -140,6 +144,23 @@
         }
         else if ( Constants.PROJECT_PACKAGING_EAR.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$
         {
+            if ( this.config.getWorkspaceConfiguration().getWebsphereVersion() != null )
+            {
+                writer.startElement( "runtime" );
+                writer.addAttribute( "name", config.getWorkspaceConfiguration().getDefaultDeployServerName() );
+                writer.endElement(); // runtime
+
+                writer.startElement( ELT_INSTALLED );
+                writer.addAttribute( ATTR_FACET, FACET_COM_IBM_WEBSPHERE_EXTENDED_EAR );
+                writer.addAttribute( ATTR_VERSION, this.config.getWorkspaceConfiguration().getWebsphereVersion() );
+                writer.endElement(); // installed
+
+                writer.startElement( ELT_INSTALLED );
+                writer.addAttribute( ATTR_FACET, FACET_COM_IBM_WEBSPHERE_COEXISTENCE_EAR );
+                writer.addAttribute( ATTR_VERSION, this.config.getWorkspaceConfiguration().getWebsphereVersion() );
+                writer.endElement(); // installed
+
+            }
             writer.startElement( ELT_FIXED );
             writer.addAttribute( ATTR_FACET, FACET_JST_EAR );
             writer.endElement(); // fixed
@@ -147,6 +168,7 @@
             writer.addAttribute( ATTR_FACET, FACET_JST_EAR );
             writer.addAttribute( ATTR_VERSION, JeeUtils.resolveJeeVersion( config.getProject() ) );
             writer.endElement(); // installed
+
         }
         else if ( Constants.PROJECT_PACKAGING_JAR.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$
         {
Index: src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java	(working copy)
@@ -208,10 +208,19 @@
             else
             {
                 File localRepositoryFile = new File( localRepository.getBasedir() );
+                String relativePath = IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, repoFile, false );
 
-                handle = "module:/classpath/var/M2_REPO/" //$NON-NLS-1$
-                    +
-                    IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, repoFile, false );
+                if ( !new File( relativePath ).isAbsolute() )
+                {
+                    handle = "module:/classpath/var/M2_REPO/" //$NON-NLS-1$
+                        + relativePath;
+                }
+                else 
+                {
+                    handle = "module:/classpath/lib/" //$NON-NLS-1$
+                        +
+                        IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), repoFile, false );
+                }
             }
             if ( Constants.PROJECT_PACKAGING_EAR.equals( this.config.getPackaging() ) && !"/".equals( deployPath ) )
             {
Index: src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java	(revision 0)
+++ src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java	(revision 0)
@@ -0,0 +1,527 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.maven.plugin.eclipse.reader;
+
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.jar.JarFile;
+
+import org.apache.maven.plugin.eclipse.WorkspaceConfiguration;
+import org.apache.maven.plugin.ide.IdeDependency;
+import org.apache.maven.plugin.ide.IdeUtils;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.eclipse.core.internal.localstore.SafeChunkyInputStream;
+
+/**
+ * Scan the eclipse workspace and create a array with {@link IdeDependency} for all found artefacts.
+ * 
+ * @author Richard van Nieuwenhoven
+ * @version $Id: $
+ */
+public class ReadWorkspaceLocations
+{
+
+    private static final String BINARY_LOCATION_FILE = ".location";
+
+    private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS =
+        ".metadata/.plugins/org.eclipse.core.resources/.projects";
+
+    private static final String[] PARENT_VERSION = new String[] { "parent", "version" };
+
+    private static final String[] PARENT_GROUP_ID = new String[] { "parent", "groupId" };
+
+    private static final String[] PACKAGING = new String[] { "packaging" };
+
+    private static final String[] VERSION = new String[] { "version" };
+
+    private static final String[] GROUP_ID = new String[] { "groupId" };
+
+    private static final String[] ARTEFACT_ID = new String[] { "artifactId" };
+
+    private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_LAUNCHING_PREFS =
+        ".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs";
+
+    private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_VM_KEY =
+        "org.eclipse.jdt.launching.PREF_VM_XML";
+
+    private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_SERVER_PREFS =
+        ".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.server.core.prefs";
+
+    private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_RUNTIMES_KEY = "runtimes";
+
+    private static final String CLASSPATHENTRY_DEFAULT = "org.eclipse.jdt.launching.JRE_CONTAINER";
+
+    private static final String CLASSPATHENTRY_STANDARD =
+        CLASSPATHENTRY_DEFAULT + "/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/";
+
+    private static final String CLASSPATHENTRY_FORMAT = ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT + "/{0}/{1}";
+
+    public void init( Log log, WorkspaceConfiguration workspaceConfiguration, MavenProject project,
+                      String wtpDefaultServer )
+    {
+        detectDefaultJREContaigner( workspaceConfiguration, project, log );
+        readWorkspace( workspaceConfiguration, log );
+        detectWTPDefaultServer( log, workspaceConfiguration, wtpDefaultServer );
+    }
+
+    private void detectWTPDefaultServer( Log log, WorkspaceConfiguration workspaceConfiguration, String wtpDefaultServer )
+    {
+        HashMap servers = readDefinedServers( workspaceConfiguration, log );
+        if ( wtpDefaultServer != null )
+        {
+            Set ids = servers.keySet();
+            // first we try the exact match
+            Iterator idIterator = ids.iterator();
+            while ( workspaceConfiguration.getDefaultDeployServerId() == null && idIterator.hasNext() )
+            {
+                String id = (String) idIterator.next();
+                String name = (String) servers.get( id );
+                if ( wtpDefaultServer.equals( id ) || wtpDefaultServer.equals( name ) )
+                {
+                    workspaceConfiguration.setDefaultDeployServerId( id );
+                    workspaceConfiguration.setDefaultDeployServerName( name );
+                }
+            }
+            if ( workspaceConfiguration.getDefaultDeployServerId() == null )
+            {
+                log.info( "no exact wtp server match." );
+                // now we will try the substring match
+                idIterator = ids.iterator();
+                while ( workspaceConfiguration.getDefaultDeployServerId() == null && idIterator.hasNext() )
+                {
+                    String id = (String) idIterator.next();
+                    String name = (String) servers.get( id );
+                    if ( id.indexOf( wtpDefaultServer ) >= 0 || name.indexOf( wtpDefaultServer ) >= 0 )
+                    {
+                        workspaceConfiguration.setDefaultDeployServerId( id );
+                        workspaceConfiguration.setDefaultDeployServerName( name );
+                    }
+                }
+            }
+        }
+        if ( workspaceConfiguration.getDefaultDeployServerId() == null && servers.size() > 0 )
+        {
+            // now take the default server
+            log.info( "no substring wtp server match." );
+            workspaceConfiguration.setDefaultDeployServerId( (String) servers.get( "" ) );
+            workspaceConfiguration.setDefaultDeployServerName( (String) servers.get( workspaceConfiguration.getDefaultDeployServerId() ) );
+        }
+        log.info( "Using as WTP server : " + workspaceConfiguration.getDefaultDeployServerName() );
+    }
+
+    /**
+     * Take the compiler executable and try to find a JRE that contains that compiler.
+     * 
+     * @param rawExecutable the executable with the complete path.
+     * @param jreMap the map with defined JRE's.
+     * @param logger the logger to log the error's
+     * @return the found container or null if non found.
+     */
+    private String getContaignerFromExecutable( String rawExecutable, Map jreMap, Log logger )
+    {
+        String foundContaigner = null;
+        if ( rawExecutable != null )
+        {
+            String executable;
+            try
+            {
+                executable = new File( rawExecutable ).getCanonicalPath();
+                logger.debug( "detected executable: " + executable );
+            }
+            catch ( Exception e )
+            {
+                return null;
+            }
+            File executableFile = new File( executable );
+            while ( executableFile != null )
+            {
+                foundContaigner = (String) jreMap.get( executableFile.getPath() );
+                if ( foundContaigner != null )
+                {
+                    logger.debug( "detected classpathContaigner from executable: " + foundContaigner );
+                    return foundContaigner;
+
+                }
+                executableFile = executableFile.getParentFile();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Search the default JREContainer from eclipse for the current MavenProject
+     * 
+     * @param workspaceLocation the location of the workspace.
+     * @param project the maven project the get the configuration
+     * @param logger the logger for errors
+     */
+    private void detectDefaultJREContaigner( WorkspaceConfiguration workspaceConfiguration, MavenProject project,
+                                             Log logger )
+    {
+        String defaultJREContainer = ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT;
+        if ( workspaceConfiguration.getWorkspaceDirectory() != null )
+        {
+            Map jreMap = readAvailableJREs( workspaceConfiguration.getWorkspaceDirectory(), logger );
+            if ( jreMap != null )
+            {
+                String foundContaigner =
+                    getContaignerFromExecutable( System.getProperty( "maven.compiler.executable" ), jreMap, logger );
+                if ( foundContaigner == null )
+                {
+                    foundContaigner =
+                        getContaignerFromExecutable( IdeUtils.getCompilerPluginSetting( project, "executable" ),
+                                                     jreMap, logger );
+                }
+                if ( foundContaigner == null )
+                {
+                    String sourceVersion = IdeUtils.getCompilerSourceVersion( project );
+                    foundContaigner = (String) jreMap.get( sourceVersion );
+                    if ( foundContaigner != null )
+                    {
+                        logger.debug( "detected classpathContaigner from sourceVersion(" + sourceVersion + "): "
+                            + foundContaigner );
+                    }
+                }
+                if ( foundContaigner == null )
+                {
+                    foundContaigner = getContaignerFromExecutable( System.getProperty( "java.home" ), jreMap, logger );
+                }
+                if ( foundContaigner != null )
+                {
+                    defaultJREContainer = foundContaigner;
+                }
+
+            }
+        }
+        workspaceConfiguration.setDefaultClasspathContainer( defaultJREContainer );
+    }
+
+    /**
+     * Get the project location for a project in the eclipse metadata.
+     * 
+     * @param workspaceLocation the location of the workspace
+     * @param project the project subdirectory in the metadata
+     * @return the full path to the project.
+     */
+    private String getProjectLocation( File workspaceLocation, File project )
+    {
+        String projectLocation = null;
+        File location = new File( project, ReadWorkspaceLocations.BINARY_LOCATION_FILE );
+        if ( location.exists() )
+        {
+            try
+            {
+                SafeChunkyInputStream fileInputStream = new SafeChunkyInputStream( location );
+                DataInputStream dataInputStream = new DataInputStream( fileInputStream );
+                String file = dataInputStream.readUTF().trim();
+
+                if ( file.length() > 0 )
+                {
+                    file = file.substring( file.indexOf( ':' ) + 1 );
+                    while ( !Character.isLetterOrDigit( file.charAt( 0 ) ) )
+                    {
+                        file = file.substring( 1 );
+                    }
+                    if ( file.indexOf( ':' ) < 0 )
+                    {
+                        file = File.separator + file;
+                    }
+                    projectLocation = file;
+                }
+
+            }
+            catch ( FileNotFoundException e )
+            {
+                projectLocation = "unknown";
+            }
+            catch ( IOException e )
+            {
+                projectLocation = "unknown";
+            }
+        }
+        if ( projectLocation == null )
+        {
+            File projectBase = new File( workspaceLocation, project.getName() );
+            if ( projectBase.isDirectory() )
+            {
+                projectLocation = projectBase.getAbsolutePath();
+            }
+        }
+        return projectLocation;
+    }
+
+    /**
+     * get a value from a dom element.
+     * 
+     * @param element the element to get a value from
+     * @param elementNames the sub elements to get
+     * @param defaultValue teh default value if the value was null or empty
+     * @return the value of the dome element.
+     */
+    private String getValue( Xpp3Dom element, String[] elementNames, String defaultValue )
+    {
+        String value = null;
+        Xpp3Dom dom = element;
+        for ( int index = 0; dom != null && index < elementNames.length; index++ )
+        {
+            dom = dom.getChild( elementNames[index] );
+        }
+        if ( dom != null )
+        {
+            value = dom.getValue();
+        }
+        if ( value == null || value.trim().length() == 0 )
+        {
+            return defaultValue;
+        }
+        else
+        {
+            return value;
+        }
+    }
+
+    /**
+     * Read the artefact information from the pom in the project location and the eclipse project name from the .project
+     * file.
+     * 
+     * @param projectLocation the location of the project
+     * @param logger the logger to report errors and debug info.
+     * @return an {@link IdeDependency} or null.
+     * @throws FileNotFoundException
+     * @throws XmlPullParserException
+     * @throws IOException
+     */
+    private IdeDependency readArtefact( String projectLocation, Log logger )
+        throws FileNotFoundException, XmlPullParserException, IOException
+    {
+        File projectFile = new File( new File( projectLocation ), ".project" );
+        String eclipseProjectName = new File( projectLocation ).getName();
+        if ( projectFile.exists() )
+        {
+            Xpp3Dom project = Xpp3DomBuilder.build( new FileReader( projectFile ) );
+            eclipseProjectName = getValue( project, new String[] { "name" }, eclipseProjectName );
+        }
+        File pomFile = new File( new File( projectLocation ), "pom.xml" );
+        if ( pomFile.exists() )
+        {
+            Xpp3Dom pom = Xpp3DomBuilder.build( new FileReader( pomFile ) );
+
+            String artifact = getValue( pom, ReadWorkspaceLocations.ARTEFACT_ID, null );
+            String group =
+                getValue( pom, ReadWorkspaceLocations.GROUP_ID, getValue( pom, ReadWorkspaceLocations.PARENT_GROUP_ID,
+                                                                          null ) );
+            String version =
+                getValue( pom, ReadWorkspaceLocations.VERSION, getValue( pom, ReadWorkspaceLocations.PARENT_VERSION,
+                                                                         null ) );
+            String packageing = getValue( pom, ReadWorkspaceLocations.PACKAGING, "jar" );
+
+            logger.debug( "found workspace artefact " + group + ":" + artifact + ":" + version + " " + packageing
+                + " (" + eclipseProjectName + ")" + " -> " + projectLocation );
+            return new IdeDependency( group, artifact, version, packageing, true, false, false, false, false, null,
+                                      packageing, false, null, 0, eclipseProjectName );
+        }
+        else
+        {
+            logger.debug( "ignored workspace project NO pom available " + projectLocation );
+            return null;
+        }
+    }
+
+    private HashMap readDefinedServers( WorkspaceConfiguration workspaceConfiguration, Log logger )
+    {
+        HashMap detectedRuntimes = new HashMap();
+        if ( workspaceConfiguration.getWorkspaceDirectory() != null )
+        {
+            Xpp3Dom runtimesElement = null;
+            try
+            {
+                File prefs =
+                    new File( workspaceConfiguration.getWorkspaceDirectory(),
+                              ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_SERVER_PREFS );
+                Properties properties = new Properties();
+                properties.load( new FileInputStream( prefs ) );
+                runtimesElement =
+                    Xpp3DomBuilder.build( new StringReader(
+                                                            properties.getProperty( ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_RUNTIMES_KEY ) ) );
+            }
+            catch ( Exception e )
+            {
+                logger.error( "Could not read workspace wtp server runtimes preferences", e );
+            }
+
+            if ( runtimesElement != null )
+            {
+                Xpp3Dom[] runtimeArray = runtimesElement.getChildren( "runtime" );
+                for ( int index = 0; runtimeArray != null && index < runtimeArray.length; index++ )
+                {
+                    String id = runtimeArray[index].getAttribute( "id" );
+                    String name = runtimeArray[index].getAttribute( "name" );
+                    if ( detectedRuntimes.isEmpty() )
+                    {
+                        logger.debug( "Using WTP runtime with id: \"" + id + "\" as default runtime" );
+                        detectedRuntimes.put( "", id );
+                    }
+                    detectedRuntimes.put( id, name );
+                    logger.debug( "Detected WTP runtime with id: \"" + id + "\" and name: \"" + name + "\"" );
+                }
+            }
+        }
+        return detectedRuntimes;
+    }
+
+    /**
+     * Read the JRE definition configured in the workspace. They will be put in a HashMap with as key there path and as
+     * value the JRE constant. a second key is included with the JRE version as a key.
+     * 
+     * @param workspaceLocation the workspace location
+     * @param logger the logger to error messages
+     * @return the map with found jre's
+     */
+    private HashMap readAvailableJREs( File workspaceLocation, Log logger )
+    {
+        HashMap jreMap = new HashMap();
+        jreMap.put( "1.2", CLASSPATHENTRY_STANDARD + "J2SE-1.2" );
+        jreMap.put( "1.3", CLASSPATHENTRY_STANDARD + "J2SE-1.3" );
+        jreMap.put( "1.4", CLASSPATHENTRY_STANDARD + "J2SE-1.4" );
+        jreMap.put( "1.5", CLASSPATHENTRY_STANDARD + "J2SE-1.5" );
+        jreMap.put( "5", jreMap.get( "1.5" ) );
+        jreMap.put( "1.6", CLASSPATHENTRY_STANDARD + "JavaSE-1.6" );
+        jreMap.put( "6", jreMap.get( "1.6" ) );
+        Xpp3Dom vms;
+        try
+        {
+            File prefs =
+                new File( workspaceLocation,
+                          ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_LAUNCHING_PREFS );
+            Properties properties = new Properties();
+            properties.load( new FileInputStream( prefs ) );
+            vms =
+                Xpp3DomBuilder.build( new StringReader(
+                                                        properties.getProperty( ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_VM_KEY ) ) );
+        }
+        catch ( Exception e )
+        {
+            logger.error( "Could not read workspace JRE preferences", e );
+            return jreMap;
+        }
+        String defaultJRE = vms.getAttribute( "defaultVM" ).trim();
+        Xpp3Dom[] vmTypes = vms.getChildren( "vmType" );
+        for ( int vmTypeIndex = 0; vmTypeIndex < vmTypes.length; vmTypeIndex++ )
+        {
+            String typeId = vmTypes[vmTypeIndex].getAttribute( "id" );
+            Xpp3Dom[] vm = vmTypes[vmTypeIndex].getChildren( "vm" );
+            for ( int vmIndex = 0; vmIndex < vm.length; vmIndex++ )
+            {
+                try
+                {
+                    String path = vm[vmIndex].getAttribute( "path" );
+                    String name = vm[vmIndex].getAttribute( "name" );
+                    String vmId = vm[vmIndex].getAttribute( "id" ).trim();
+                    String classpathEntry =
+                        MessageFormat.format( ReadWorkspaceLocations.CLASSPATHENTRY_FORMAT,
+                                              new Object[] { typeId, name } );
+                    String jrePath = new File( path ).getCanonicalPath();
+                    JarFile rtJar = new JarFile( new File( new File( jrePath ), "jre/lib/rt.jar" ) );
+                    String version = rtJar.getManifest().getMainAttributes().getValue( "Specification-Version" );
+                    if ( defaultJRE.endsWith( "," + vmId ) )
+                    {
+                        jreMap.put( jrePath, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT );
+                        jreMap.put( version, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT );
+                        logger.debug( "Default Classpath Contaigner version: " + version + "  location: " + jrePath );
+                    }
+                    else if ( !jreMap.containsKey( jrePath ) )
+                    {
+                        if ( !jreMap.containsKey( version ) )
+                        {
+                            jreMap.put( version, classpathEntry );
+                        }
+                        jreMap.put( jrePath, classpathEntry );
+                        logger.debug( "Additional Classpath Contaigner version: " + version + " " + classpathEntry
+                            + " location: " + jrePath );
+                    }
+                    else
+                    {
+                        logger.debug( "Ignored (duplicated) additional Classpath Contaigner version: " + version + " "
+                            + classpathEntry + " location: " + jrePath );
+                    }
+                }
+                catch ( IOException e )
+                {
+                    logger.warn( "Could not interpret entry: " + vm.toString() );
+                }
+            }
+        }
+        return jreMap;
+    }
+
+    /**
+     * Scan the eclipse workspace and create a array with {@link IdeDependency} for all found artifacts.
+     * 
+     * @param workspaceLocation the location of the eclipse workspace.
+     * @param logger the logger to report errors and debug info.
+     */
+    private void readWorkspace( WorkspaceConfiguration workspaceConfiguration, Log logger )
+    {
+        ArrayList dependencys = new ArrayList();
+        if ( workspaceConfiguration.getWorkspaceDirectory() != null )
+        {
+            File workspace =
+                new File( workspaceConfiguration.getWorkspaceDirectory(),
+                          ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS );
+
+            File[] directories = workspace.listFiles();
+            for ( int index = 0; directories != null && index < directories.length; index++ )
+            {
+                File project = directories[index];
+                if ( project.isDirectory() )
+                {
+                    try
+                    {
+                        String projectLocation =
+                            getProjectLocation( workspaceConfiguration.getWorkspaceDirectory(), project );
+                        if ( projectLocation != null )
+                        {
+                            IdeDependency ideDependency = readArtefact( projectLocation, logger );
+                            if ( ideDependency != null )
+                            {
+                                dependencys.add( ideDependency );
+                            }
+                        }
+                    }
+                    catch ( Exception e )
+                    {
+                        logger.warn( "could not read workspace project:" + project );
+                    }
+                }
+            }
+        }
+        workspaceConfiguration.setWorkspaceArtefacts( (IdeDependency[]) dependencys.toArray( new IdeDependency[dependencys.size()] ) );
+    }
+}
Index: src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java
===================================================================
--- src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java	(revision 605911)
+++ src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java	(working copy)
@@ -4,6 +4,7 @@
 import java.net.URL;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.ide.IdeDependency;
 
 public class WorkspaceConfiguration
 {
@@ -15,6 +16,14 @@
 
     private ArtifactRepository localRepository;
 
+    private String defaultClasspathContainer;
+
+    private IdeDependency[] workspaceArtefacts;
+
+    private String defaultDeployServerId;
+
+    private String defaultDeployServerName;
+
     public File getWorkspaceDirectory()
     {
         return this.workspaceDirectory;
@@ -55,4 +64,71 @@
         this.localRepository = localRepository;
     }
 
+    public String getDefaultClasspathContainer()
+    {
+        return defaultClasspathContainer;
+    }
+
+    public void setDefaultClasspathContainer( String defaultClasspathContainer )
+    {
+        this.defaultClasspathContainer = defaultClasspathContainer;
+    }
+
+    public IdeDependency[] getWorkspaceArtefacts()
+    {
+        return workspaceArtefacts;
+    }
+
+    public void setWorkspaceArtefacts( IdeDependency[] workspaceArtefacts )
+    {
+        this.workspaceArtefacts = workspaceArtefacts;
+    }
+
+    public String getDefaultDeployServerId()
+    {
+        return defaultDeployServerId;
+    }
+
+    public void setDefaultDeployServerId( String defaultDeployServerId )
+    {
+        this.defaultDeployServerId = defaultDeployServerId;
+    }
+
+    public String getDefaultDeployServerName()
+    {
+        return defaultDeployServerName;
+    }
+
+    public void setDefaultDeployServerName( String defaultDeployServerName )
+    {
+        this.defaultDeployServerName = defaultDeployServerName;
+    }
+
+    /**
+     * @return the defined websphere server version and null if the target is no websphere.
+     */
+    public String getWebsphereVersion()
+    {
+        if ( getDefaultDeployServerId() != null && getDefaultDeployServerId().startsWith( "was." ) )
+        {
+            if ( getDefaultDeployServerId().indexOf( "v61" ) >= 0)
+            {
+                return "6.1";
+            }
+            if ( getDefaultDeployServerId().indexOf( "v6" ) >= 0)
+            {
+                return "6.0";
+            }
+            if ( getDefaultDeployServerId().indexOf( "v51" ) >= 0)
+            {
+                return "5.1";
+            }
+            if ( getDefaultDeployServerId().indexOf( "v5" ) >= 0)
+            {
+                return "5.0";
+            }
+        }
+        return null;
+    }
+
 }
Index: pom.xml
===================================================================
--- pom.xml	(revision 605911)
+++ pom.xml	(working copy)
@@ -186,5 +186,28 @@
       <version>3.8.2</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.eclipse.core</groupId>
+      <artifactId>resources</artifactId>
+      <version>[3.1.0,4.0.0)</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.eclipse.ant</groupId>
+          <artifactId>core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.core</groupId>
+          <artifactId>expressions</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.core</groupId>
+          <artifactId>filesystem</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.core</groupId>
+          <artifactId>runtime</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
   </dependencies>
 </project>

