Merging with r473095 from trunk, in preparation for merging this code to the trunk.

git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/branches/MECLIPSE-137@474380 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java b/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
index dad5424..54fa5ef 100644
--- a/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
+++ b/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
@@ -169,7 +169,9 @@
             if ( byOutputDirs == null )
             {
                 // ArrayList<EclipseSourceDir>
-                byOutputDir.put( dir.getOutput(), byOutputDirs = new ArrayList() );
+                byOutputDir.put(
+                    dir.getOutput() == null ? defaultOutput : dir.getOutput(),
+                    byOutputDirs = new ArrayList() );
             }
             byOutputDirs.add( dir );
         }
@@ -194,6 +196,8 @@
                     // do not specify as source since the output will be nested. Instead, mark
                     // it as a todo, and handle it with a custom build.xml file later.
 
+                    log.debug( "Marking as special to prevent output folder nesting: " + dir.getPath() + " (output=" + dir.getOutput() +")");
+
                     specialSources.add( dir );
 
                     continue;