maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r390785 - /maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java
Date Sun, 02 Apr 2006 06:24:15 GMT
Author: brett
Date: Sat Apr  1 22:24:14 2006
New Revision: 390785

URL: http://svn.apache.org/viewcvs?rev=390785&view=rev
Log:
[MIDEA-45] fix problems with exclude logic
Submitted by: Patrick Lightbody

Modified:
    maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java

Modified: maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java?rev=390785&r1=390784&r2=390785&view=diff
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java
(original)
+++ maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java
Sat Apr  1 22:24:14 2006
@@ -36,6 +36,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -309,14 +310,37 @@
                 String[] dirs = exclude.split( "[,\\s]+" );
                 for ( int i = 0; i < dirs.length; i++ )
                 {
-                    File excludedDir = new File( dirs[i] );
-                    filteredExcludes.add( getExcludedDirectories( excludedDir, filteredExcludes,
sourceFolders ) );
+                    File excludedDir = new File( project.getBasedir(), dirs[i] );
+                    filteredExcludes.addAll( getExcludedDirectories( excludedDir, filteredExcludes,
sourceFolders ) );
                 }
             }
 
+            // even though we just ran all the directories in the filteredExcludes List through
the intelligent
+            // getExcludedDirectories method, we never actually were guaranteed the order
that they were added was
+            // in the order required to make the most optimized exclude list. In addition,
the smart logic from
+            // that method is entirely skipped if the directory doesn't currently exist.
A simple string matching
+            // will do pretty much the same thing and make the list more concise.
+            ArrayList actuallyExcluded = new ArrayList();
+            Collections.sort( filteredExcludes );
             for ( Iterator i = filteredExcludes.iterator(); i.hasNext(); )
             {
-                addExcludeFolder( content, i.next().toString() );
+                String dirToExclude = i.next().toString();
+                boolean addExclude = true;
+                for ( Iterator iterator = actuallyExcluded.iterator(); iterator.hasNext();
)
+                {
+                    String dir = (String) iterator.next();
+                    if ( dirToExclude.startsWith( dir ) )
+                    {
+                        addExclude = false;
+                        break;
+                    }
+                }
+
+                if ( addExclude )
+                {
+                    actuallyExcluded.add( dirToExclude );
+                    addExcludeFolder( content, dirToExclude );
+                }
             }
 
             removeOldDependencies( component );



Mime
View raw message