Author: jdcasey
Date: Mon Jun 13 08:05:28 2005
New Revision: 190414

URL: http://svn.apache.org/viewcvs?rev=190414&view=rev
Log:
Fixing flaw from previous commit, where artifacts provided by the maven distro 
are excluded from the plugin artifact list.

Now, we're using all artifacts referenced by the plugin in the artifacts list 
for that PluginDescriptor...the only drawback is since we're not using a 
repository layout for the maven /lib, there is no good way to include the 
artifact-path from /lib...we're using the artifact-file from the local repo for 
those deps. This SHOULDN'T cause a problem, but it's possible...



Added:
    
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java
   (with props)
Modified:
    
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java

Added: 
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java?rev=190414&view=auto
==============================================================================
--- 
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java
 (added)
+++ 
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java
 Mon Jun 13 08:05:28 2005
@@ -0,0 +1,37 @@
+package org.apache.maven.artifact.resolver.filter;
+
+import org.apache.maven.artifact.Artifact;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class InversionArtifactFilter
+    implements ArtifactFilter
+{
+    
+    private final ArtifactFilter toInvert;
+
+    public InversionArtifactFilter( ArtifactFilter toInvert )
+    {
+        this.toInvert = toInvert;
+    }
+
+    public boolean include( Artifact artifact )
+    {
+        return !toInvert.include( artifact );
+    }
+
+}

Propchange: 
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author"

Modified: 
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=190414&r1=190413&r2=190414&view=diff
==============================================================================
--- 
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
 (original)
+++ 
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
 Mon Jun 13 08:05:28 2005
@@ -24,6 +24,7 @@
 import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
+import org.apache.maven.artifact.resolver.filter.InversionArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import org.apache.maven.artifact.transform.ReleaseArtifactTransformation;
 import org.apache.maven.execution.MavenSession;
@@ -303,7 +304,20 @@
             // around and set the artifacts.
             PluginDescriptor addedPlugin = (PluginDescriptor) 
pluginDescriptors.get( pluginKey );
 
-            addedPlugin.setArtifacts( new ArrayList( resolved.values() ) );
+            ArtifactFilter distroProvidedFilter = new InversionArtifactFilter( 
artifactFilter );
+
+            ArtifactResolutionResult distroProvidedResult = 
artifactResolver.resolveTransitively( Collections
+                .singleton( pluginArtifact ), 
project.getRemoteArtifactRepositories(), localRepository, metadataSource,
+                                                                               
                   distroProvidedFilter );
+
+            Map distroProvided = distroProvidedResult.getArtifacts();
+
+            List unfilteredArtifactList = new ArrayList( resolved.size() + 
distroProvided.size() );
+
+            unfilteredArtifactList.addAll( resolved.values() );
+            unfilteredArtifactList.addAll( distroProvided.values() );
+
+            addedPlugin.setArtifacts( unfilteredArtifactList );
         }
         finally
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to