ShrinkWrap Resolver Aggregator 1.1.0-alpha-2

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

java.lang.Object
  extended by org.jboss.shrinkwrap.resolver.impl.maven.MavenImpl
All Implemented Interfaces:
Maven.MavenShortcutAPI

public class MavenImpl
extends Object
implements Maven.MavenShortcutAPI

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

Author:
Samuel Santos

Constructor Summary
MavenImpl()
          Constructs new instance of MavenDependencies
MavenImpl(MavenRepositorySystem system, org.sonatype.aether.RepositorySystemSession session, org.jboss.shrinkwrap.resolver.impl.maven.MavenDependencyResolverSettings settings, Stack<MavenDependency> dependencies, Set<MavenDependency> dependencyManagement)
           
 
Method Summary
 MavenDependencyResolverShortcutAPI artifact(String coordinates)
          Resolves dependency for dependency builder.
 MavenDependencyResolverShortcutAPI artifacts(String... coordinates)
          Resolves dependencies for dependency builder.
 Collection<org.jboss.shrinkwrap.api.GenericArchive> dependencies(String... coordinates)
          Resolves dependencies for dependency builder.
 org.jboss.shrinkwrap.api.GenericArchive dependency(String coordinates)
          Resolves dependency for dependency builder.
 Stack<MavenDependency> getDependencies()
          Gets all the dependencies marked by Resolver to be resolved
 Set<MavenDependency> getVersionManagement()
          Gets all the dependencies retrieved from metadata parsing.
<ARCHIVEVIEW extends org.jboss.shrinkwrap.api.Assignable>
ARCHIVEVIEW
resolveArtifactAs(Class<ARCHIVEVIEW> archiveView)
          Resolves dependency for dependency builder.
<ARCHIVEVIEW extends org.jboss.shrinkwrap.api.Assignable>
Collection<ARCHIVEVIEW>
resolveArtifactsAs(Class<ARCHIVEVIEW> archiveView)
          Resolves dependencies for dependency builder.
 Maven.MavenShortcutAPI 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

MavenImpl

public MavenImpl()
Constructs new instance of MavenDependencies


MavenImpl

public MavenImpl(MavenRepositorySystem system,
                 org.sonatype.aether.RepositorySystemSession session,
                 org.jboss.shrinkwrap.resolver.impl.maven.MavenDependencyResolverSettings settings,
                 Stack<MavenDependency> dependencies,
                 Set<MavenDependency> dependencyManagement)
Method Detail

dependency

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

Specified by:
dependency in interface Maven.MavenShortcutAPI
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 Collection<org.jboss.shrinkwrap.api.GenericArchive> dependencies(String... coordinates)
                                                                 throws ResolutionException
Resolves dependencies for dependency builder.

Specified by:
dependencies in interface Maven.MavenShortcutAPI
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

withPom

public Maven.MavenShortcutAPI withPom(String path)
                               throws ResolutionException
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.
Throws:
ResolutionException - If artifact coordinates are wrong or if version cannot be determined.

artifact

public MavenDependencyResolverShortcutAPI artifact(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 dependency builder with remote repositories set according to the content of POM file.
Throws:
ResolutionException - If artifact coordinates are wrong or if version cannot be determined.

artifacts

public MavenDependencyResolverShortcutAPI artifacts(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.

resolveArtifactAs

public <ARCHIVEVIEW extends org.jboss.shrinkwrap.api.Assignable> ARCHIVEVIEW resolveArtifactAs(Class<ARCHIVEVIEW> archiveView)
                                                                          throws ResolutionException
Resolves dependency for dependency builder.

Parameters:
archiveView - End-user view of the archive requested (ie. GenericArchive or JavaArchive)
Returns:
An archive of the resolved artifact.
Throws:
ResolutionException - If artifact could not be resolved
{@link - IllegalArgumentException} If target archive view is not supplied
{@link - ResolutionException} If more than one artifact is resolved

resolveArtifactsAs

public <ARCHIVEVIEW extends org.jboss.shrinkwrap.api.Assignable> Collection<ARCHIVEVIEW> resolveArtifactsAs(Class<ARCHIVEVIEW> archiveView)
                                                                                       throws ResolutionException
Resolves dependencies for dependency builder.

Parameters:
archiveView - End-user view of the archive requested (ie. GenericArchive or JavaArchive)
Returns:
An array of archives which contains resolved artifacts.
Throws:
ResolutionException - If artifacts could not be resolved
{@link - IllegalArgumentException} If target archive view is not supplied

getDependencies

public Stack<MavenDependency> getDependencies()
Gets all the dependencies marked by Resolver to be resolved

Returns:
the stack which represents content of MavenDependencyResolver

getVersionManagement

public Set<MavenDependency> getVersionManagement()
Gets all the dependencies retrieved from metadata parsing.

Returns:
the set which represents content of MavenDependencyResolver version metadata

ShrinkWrap Resolver Aggregator 1.1.0-alpha-2

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.