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...




git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@190414 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-06-13 15:05:28 +00:00
parent a55fd04696
commit eb0a46b6bb
2 changed files with 52 additions and 1 deletions

View File

@ -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 );
}
}

View File

@ -24,6 +24,7 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
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 @@ public class DefaultPluginManager
// 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
{