Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.maven.plugin.internal;
  
  /*
   * 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.
  */
 
 import java.util.Map;
 
Assists in detecting wagon providers brought into the plugin class path via legacy Maven core artifacts (e.g. maven-core:2.0.6) and excluding them. A plugin should be able to explicitly declare dependencies on specific wagons for its use. However, the (old) wagons pulled in transitively via legacy Maven core artifacts are usually not intended as dependencies and more importantly screw up artifact resolution because they would get preferred over the core wagon versions. This is a hack to provide backward-compat with Maven 2 (MNG-4528, MNG-4561).

Author(s):
Benjamin Bentmann
Since:
3.0
 
     implements ResolutionListener
 {
 
     private ArtifactFilter coreFilter;
 
     private LinkedList<ArtifactcoreArtifacts = new LinkedList<Artifact>();
 
     private Artifact wagonProvider;
 
     private Map<ArtifactObjectbannedArtifacts = new IdentityHashMap<ArtifactObject>();
 
     public PluginDependencyResolutionListenerArtifactFilter coreFilter )
     {
         this. = coreFilter;
     }
 
     public void removeBannedDependenciesCollection<Artifactartifacts )
     {
         if ( !.isEmpty() && artifacts != null )
         {
             for ( Iterator<Artifactit = artifacts.iterator(); it.hasNext(); )
             {
                 Artifact artifact = it.next();
                 if ( .containsKeyartifact ) )
                 {
                     it.remove();
                 }
             }
         }
     }
 
     public void startProcessChildrenArtifact artifact )
     {
         if (  == null )
         {
             if ( isLegacyCoreArtifactartifact ) )
             {
                 .addFirstartifact );
             }
             else if ( !.isEmpty() && isWagonProviderartifact ) )
             {
                  = artifact;
                 .putartifactnull );
             }
         }
     }
 
     private boolean isLegacyCoreArtifactArtifact artifact )
     {
         String version = artifact.getVersion();
         return version != null && version.startsWith"2." ) && !.includeartifact );
     }
 
     public void endProcessChildrenArtifact artifact )
     {
         if (  == artifact )
        {
             = null;
        }
        else if ( .peek() == artifact )
        {
            .removeFirst();
        }
    }
    public void includeArtifactArtifact artifact )
    {
        if (  != null )
        {
            .putartifactnull );
        }
    }
    private boolean isWagonProviderArtifact artifact )
    {
        if ( "org.apache.maven.wagon".equalsartifact.getGroupId() ) )
        {
            return artifact.getArtifactId().startsWith"wagon-" );
        }
        return false;
    }
    public void manageArtifactArtifact artifactArtifact replacement )
    {
    }
    public void omitForCycleArtifact artifact )
    {
    }
    public void omitForNearerArtifact omittedArtifact kept )
    {
    }
    public void restrictRangeArtifact artifactArtifact replacementVersionRange newRange )
    {
    }
    public void selectVersionFromRangeArtifact artifact )
    {
    }
    public void testArtifactArtifact node )
    {
    }
    public void updateScopeArtifact artifactString scope )
    {
    }
    public void updateScopeCurrentPomArtifact artifactString ignoredScope )
    {
    }
New to GrepCode? Check out our FAQ X