ShrinkWrap Resolver Maven API 2.0.0-alpha-1

org.jboss.shrinkwrap.resolver.api.maven
Class Maven

java.lang.Object
  extended by org.jboss.shrinkwrap.resolver.api.maven.Maven

public class Maven
extends Object

Shortcut API for Maven artifact builder which holds and construct dependencies and is able to resolve them into ShrinkWrap archives.

Author:
Karel Piwko, Samuel Santos

Constructor Summary
Maven()
           
 
Method Summary
static Collection<org.jboss.shrinkwrap.api.GenericArchive> dependencies(String... coordinates)
          Resolves dependencies for dependency builder.
static org.jboss.shrinkwrap.api.GenericArchive dependency(String coordinates)
          Resolves dependency for dependency builder.
static File resolveAsFile(String coordinates)
          Resolves dependency for dependency builder.
static File[] resolveAsFiles(String... coordinates)
          Resolves dependencies for dependency builder.
static EffectivePomMavenDependencyShortcut withPom(String path)
          Loads remote repositories for a POM file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Maven

public Maven()
Method Detail

dependency

public static org.jboss.shrinkwrap.api.GenericArchive dependency(String coordinates)
                                                          throws ResolutionException
Resolves dependency for dependency builder.

Parameters:
coordinates - Coordinates specified to a created artifact, specified in an implementation-specific format.
Returns:
An archive of the resolved artifact.
Throws:
ResolutionException - If artifact coordinates are wrong or if version cannot be determined.
{@link - IllegalArgumentException} If target archive view is not supplied

dependencies

public static Collection<org.jboss.shrinkwrap.api.GenericArchive> dependencies(String... coordinates)
                                                                        throws ResolutionException
Resolves dependencies for dependency builder.

Parameters:
coordinates - A list of coordinates specified to the created artifacts, specified in an implementation-specific format.
Returns:
An array of archives which contains resolved artifacts.
Throws:
ResolutionException - If artifact coordinates are wrong or if version cannot be determined.
{@link - IllegalArgumentException} If target archive view is not supplied

resolveAsFile

public static File resolveAsFile(String coordinates)
                          throws ResolutionException
Resolves dependency for dependency builder.

Parameters:
coordinates - Coordinates specified to a created artifact, specified in an implementation-specific format.
Returns:
A File which contain resolved artifact.
Throws:
ResolutionException - If artifact could not be resolved

resolveAsFiles

public static File[] resolveAsFiles(String... coordinates)
                             throws ResolutionException
Resolves dependencies for dependency builder.

Parameters:
coordinates - A list of coordinates specified to the created artifacts, specified in an implementation-specific format.
Returns:
An array of Files which contains resolved artifacts
Throws:
ResolutionException - If artifact could not be resolved

withPom

public static EffectivePomMavenDependencyShortcut withPom(String path)
Loads remote repositories for a POM file. If repositories are defined in the parent of the POM file and there are accessible via local file system, they are set as well. These remote repositories are used to resolve the artifacts during dependency resolution. Additionally, it loads dependencies defined in the POM file model in an internal cache, which can be later used to resolve an artifact without explicitly specifying its version.

Parameters:
path - A path to the POM file, must not be null or empty
Returns:
A dependency builder with remote repositories set according to the content of POM file.

ShrinkWrap Resolver Maven API 2.0.0-alpha-1

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