ShrinkWrap Resolver Maven Implementation 1.0.0-beta-7

org.jboss.shrinkwrap.resolver.impl.maven
Class MavenConverter

java.lang.Object
  extended by org.jboss.shrinkwrap.resolver.impl.maven.MavenConverter

public class MavenConverter
extends Object

An utility class which provides conversion between Maven and Aether objects. It allows creation of Aether object from different objects than Maven objects as well.

Author:
Benjamin Bentmann, Karel Piwko

Method Summary
static org.sonatype.aether.artifact.Artifact asArtifact(String coordinates)
           
static List<org.sonatype.aether.graph.Dependency> asDependencies(List<MavenDependency> dependencies)
           
static org.sonatype.aether.graph.Dependency asDependency(MavenDependency dependency)
           
static org.sonatype.aether.graph.Exclusion asExclusion(String coordinates)
          Converts string coordinates to Aether exclusion object
static List<org.sonatype.aether.graph.Exclusion> asExclusions(Collection<String> coordinates)
          Converts a collection of string coordinates to Aether exclusions objects
static org.sonatype.aether.repository.Proxy asProxy(org.apache.maven.settings.Proxy proxy)
          Converts Maven Proxy to Aether Proxy
static org.sonatype.aether.repository.RemoteRepository asRemoteRepository(org.apache.maven.model.Repository repository)
          Converts Maven Repository to Aether RemoteRepository
static org.sonatype.aether.repository.RemoteRepository asRemoteRepository(org.apache.maven.settings.Repository repository)
          Converts Maven Repository to Aether RemoteRepository
static String fromArtifact(org.sonatype.aether.artifact.Artifact artifact)
           
static MavenDependency fromDependency(org.sonatype.aether.graph.Dependency dependency)
           
static MavenDependency fromDependency(org.apache.maven.model.Dependency dependency, org.sonatype.aether.artifact.ArtifactTypeRegistry registry)
          Converts Maven Dependency to Aether Dependency
static String fromExclusion(org.apache.maven.model.Exclusion exclusion)
           
static String fromExclusion(org.sonatype.aether.graph.Exclusion exclusion)
           
static Collection<String> fromExclusions(Collection<org.sonatype.aether.graph.Exclusion> exclusions)
           
static String resolveArtifactVersion(Map<org.jboss.shrinkwrap.resolver.impl.maven.ArtifactAsKey,MavenDependency> dependencyManagement, String coordinates)
          Tries to resolve artifact version from internal dependencies from a fetched POM file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

resolveArtifactVersion

public static String resolveArtifactVersion(Map<org.jboss.shrinkwrap.resolver.impl.maven.ArtifactAsKey,MavenDependency> dependencyManagement,
                                            String coordinates)
Tries to resolve artifact version from internal dependencies from a fetched POM file. If no version is found, it simply returns original coordinates

Parameters:
dependencyManagement - The map including dependency information retrieved from the POM file
coordinates - The coordinates excluding the version part
Returns:
Either coordinates with appended version or original coordinates

asDependency

public static org.sonatype.aether.graph.Dependency asDependency(MavenDependency dependency)

asDependencies

public static List<org.sonatype.aether.graph.Dependency> asDependencies(List<MavenDependency> dependencies)

asArtifact

public static org.sonatype.aether.artifact.Artifact asArtifact(String coordinates)
                                                        throws ResolutionException
Throws:
ResolutionException

asExclusion

public static org.sonatype.aether.graph.Exclusion asExclusion(String coordinates)
Converts string coordinates to Aether exclusion object

Parameters:
coordinates - Coordinates specified in the format specified in the format <groupId>:<artifactId>[:<extension>[:<classifier>]], an empty string or * will match all exclusions, you can pass an * instead of any part of the coordinates to match all possible values
Returns:
Exclusion object based on the coordinates
Throws:
ResolutionException - If coordinates cannot be converted

asExclusions

public static List<org.sonatype.aether.graph.Exclusion> asExclusions(Collection<String> coordinates)
Converts a collection of string coordinates to Aether exclusions objects

Parameters:
coordinates - A collection of coordinates specified in the format specified in the format <groupId>:<artifactId>[:<extension>[:<classifier>]]
Returns:
List of Exclusion objects based on the coordinates
Throws:
ResolutionException - If coordinates cannot be converted

fromExclusion

public static String fromExclusion(org.apache.maven.model.Exclusion exclusion)

fromExclusion

public static String fromExclusion(org.sonatype.aether.graph.Exclusion exclusion)

fromExclusions

public static Collection<String> fromExclusions(Collection<org.sonatype.aether.graph.Exclusion> exclusions)

fromArtifact

public static String fromArtifact(org.sonatype.aether.artifact.Artifact artifact)

fromDependency

public static MavenDependency fromDependency(org.sonatype.aether.graph.Dependency dependency)

fromDependency

public static MavenDependency fromDependency(org.apache.maven.model.Dependency dependency,
                                             org.sonatype.aether.artifact.ArtifactTypeRegistry registry)
Converts Maven Dependency to Aether Dependency

Parameters:
dependency - the Maven dependency to be converted
registry - the Artifact type catalog to determine common artifact properties
Returns:
Equivalent Aether dependency

asRemoteRepository

public static org.sonatype.aether.repository.RemoteRepository asRemoteRepository(org.apache.maven.model.Repository repository)
Converts Maven Repository to Aether RemoteRepository

Parameters:
repository - the Maven repository to be converted
Returns:
Equivalent remote repository

asRemoteRepository

public static org.sonatype.aether.repository.RemoteRepository asRemoteRepository(org.apache.maven.settings.Repository repository)
Converts Maven Repository to Aether RemoteRepository

Parameters:
repository - the Maven repository to be converted
Returns:
Equivalent remote repository

asProxy

public static org.sonatype.aether.repository.Proxy asProxy(org.apache.maven.settings.Proxy proxy)
Converts Maven Proxy to Aether Proxy

Parameters:
proxy - the Maven proxy to be converted
Returns:
Aether proxy equivalent

ShrinkWrap Resolver Maven Implementation 1.0.0-beta-7

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.