Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.maven.plugin.ant;
  
  /*
   * 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.List;
 
Wrapper object to resolve artifact.

Author(s):
Vincent Siveton
Version:
$Id: ArtifactResolverWrapper.java 510478 2007-02-22 12:29:45Z vsiveton $
 
 public class ArtifactResolverWrapper
 {
    
Used for resolving artifacts
 
     private ArtifactResolver resolver;

    
Factory for creating artifact objects
 
     private ArtifactFactory factory;

    
The local repository where the artifacts are located
 
     private ArtifactRepository localRepository;

    
The remote repositories where artifacts are located
 
     private List remoteRepositories;

    

Parameters:
resolver
factory
localRepository
remoteRepositories
 
     private ArtifactResolverWrapperArtifactResolver resolverArtifactFactory factory,
                                     ArtifactRepository localRepositoryList remoteRepositories )
     {
         this. = resolver;
         this. = factory;
         this. = localRepository;
         this. = remoteRepositories;
     }

    

Parameters:
resolver
factory
localRepository
remoteRepositories
Returns:
an instance of ArtifactResolverWrapper
 
     public static ArtifactResolverWrapper getInstanceArtifactResolver resolverArtifactFactory factory,
                                                       ArtifactRepository localRepositoryList remoteRepositories )
     {
         return new ArtifactResolverWrapperresolverfactorylocalRepositoryremoteRepositories );
     }
 
     protected ArtifactFactory getFactory()
     {
         return ;
     }
 
     protected void setFactoryArtifactFactory factory )
     {
         this. = factory;
     }
 
     {
        return ;
    }
    protected void setLocalRepositoryArtifactRepository localRepository )
    {
        this. = localRepository;
    }
    protected List getRemoteRepositories()
    {
        return ;
    }
    protected void setRemoteRepositoriesList remoteRepositories )
    {
        this. = remoteRepositories;
    }
    protected ArtifactResolver getResolver()
    {
        return ;
    }
    protected void setResolverArtifactResolver resolver )
    {
        this. = resolver;
    }

    
Return the artifact path in the local repository for an artifact defined by its groupId, its artifactId and its version.

Parameters:
groupId
artifactId
version
Returns:
the locale artifact path
Throws:
java.io.IOException if any
    public String getArtifactAbsolutePathString groupIdString artifactIdString version )
        throws IOException
    {
        Artifact artifact = .createArtifactgroupIdartifactIdversion"compile""jar" );
        try
        {
            .resolveartifact );
            return artifact.getFile().getAbsolutePath();
        }
        catch ( ArtifactResolutionException e )
        {
            throw new IOException"Unable to resolve artifact: " + groupId + ":" + artifactId + ":" + version );
        }
        catch ( ArtifactNotFoundException e )
        {
            throw new IOException"Unable to find artifact: " + groupId + ":" + artifactId + ":" + version );
        }
    }
New to GrepCode? Check out our FAQ X