ShrinkWrap Resolver Aggregator 1.1.0-alpha-2

org.jboss.shrinkwrap.resolver.api.maven
Interface MavenDependencyResolver

All Superinterfaces:
DependencyBuilder<MavenDependencyResolver>, DependencyResolver<MavenResolutionFilter,MavenDependency>

public interface MavenDependencyResolver
extends DependencyBuilder<MavenDependencyResolver>, DependencyResolver<MavenResolutionFilter,MavenDependency>

An artifact builder is object which holds and construct dependencies and it is able to resolve them into an array of ShrinkWrap archives. Artifact builder allows chaining of artifacts, that is specifying a new artifact. In this case, currently constructed artifact is stored as a dependency and user is allowed to specify parameters for another artifact.

Author:
Karel Piwko, Andrew Lee Rubinger, Samuel Santos, Jose Rodolfo Freitas

Method Summary
 MavenDependencyResolver configureFrom(String path)
          Configures Maven from a settings.xml file
 MavenDependencyResolver exclusion(String exclusion)
          Adds an exclusion for current dependency.
 MavenDependencyResolver exclusions(Collection<String> exclusions)
          Adds multiple exclusions for current dependency
 MavenDependencyResolver exclusions(String... exclusions)
          Adds multiple exclusions for current dependency
 MavenDependencyResolver goOffline()
          Disables touching remote repositories at all, rely on local repository only
 MavenDependencyResolver includeDependenciesFromPom(String path)
          Resolves based upon dependencies declared in the POM at the specified path
 MavenDependencyResolver loadDependenciesFromPom(String path)
          Deprecated. please use includeDependenciesFromPom(String) instead
 MavenDependencyResolver loadDependenciesFromPom(String path, MavenResolutionFilter filter)
          Deprecated. please use includeDependenciesFromPom(String) instead
 MavenDependencyResolver loadMetadataFromPom(String path)
          Loads remote repositories for a POM file.
 MavenDependencyResolver loadReposFromPom(String path)
          Deprecated. please use loadMetadataFromPom(String) instead
 MavenDependencyResolver optional(boolean optional)
          Sets dependency as optional.
 MavenDependencyResolver scope(String scope)
          Sets a scope of dependency
 MavenDependencyResolver useCentralRepo(boolean useCentral)
          Sets the resolver to either consider (or not) Maven Central in resolution
 
Methods inherited from interface org.jboss.shrinkwrap.resolver.api.DependencyBuilder
artifact, artifacts
 
Methods inherited from interface org.jboss.shrinkwrap.resolver.api.DependencyResolver
resolveAs, resolveAs, resolveAsFiles, resolveAsFiles
 

Method Detail

configureFrom

MavenDependencyResolver configureFrom(String path)
Configures Maven from a settings.xml file

Parameters:
path - A path to a settings.xml configuration file
Returns:
A dependency builder with a configuration from given file

loadMetadataFromPom

MavenDependencyResolver loadMetadataFromPom(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:
pathx - 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:
Exception
ResolutionException

loadReposFromPom

@Deprecated
MavenDependencyResolver loadReposFromPom(String path)
                                         throws ResolutionException
Deprecated. please use loadMetadataFromPom(String) instead

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:
Exception
ResolutionException

scope

MavenDependencyResolver scope(String scope)
Sets a scope of dependency

Parameters:
scope - A scope, for example @{code compile}, @{code test} and others
Returns:
Artifact builder with scope set

optional

MavenDependencyResolver optional(boolean optional)
Sets dependency as optional. If dependency is marked as optional, it is always resolved, however, the dependency graph can later be filtered based on optional flag

Parameters:
optional - Optional flag
Returns:
Artifact builder with optional flag set

exclusion

MavenDependencyResolver exclusion(String exclusion)
Adds an exclusion for current dependency.

Parameters:
exclusion - the exclusion to be added to list of artifacts to be excluded, 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:
Artifact builder with added exclusion

exclusions

MavenDependencyResolver exclusions(String... exclusions)
Adds multiple exclusions for current dependency

Parameters:
exclusions - the exclusions to be added to the list of artifacts to be excluded, 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:
Artifact builder with added exclusions

exclusions

MavenDependencyResolver exclusions(Collection<String> exclusions)
Adds multiple exclusions for current dependency

Parameters:
exclusions - the exclusions to be added to the list of artifacts to be excluded, 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:
Artifact builder with added exclusions

includeDependenciesFromPom

MavenDependencyResolver includeDependenciesFromPom(String path)
                                                   throws ResolutionException
Resolves based upon dependencies declared in the POM at the specified path

Parameters:
path -
Returns:
Throws:
ResolutionException

loadDependenciesFromPom

@Deprecated
MavenDependencyResolver loadDependenciesFromPom(String path)
                                                throws ResolutionException
Deprecated. please use includeDependenciesFromPom(String) instead

Resolves based upon dependencies declared in the POM at the specified path

Parameters:
path -
Returns:
Throws:
ResolutionException

loadDependenciesFromPom

@Deprecated
MavenDependencyResolver loadDependenciesFromPom(String path,
                                                           MavenResolutionFilter filter)
                                                throws ResolutionException
Deprecated. please use includeDependenciesFromPom(String) instead

Resolves based upon dependencies declared in the POM at the specified path

Parameters:
path -
filter -
Returns:
Throws:
ResolutionException

useCentralRepo

MavenDependencyResolver useCentralRepo(boolean useCentral)
Sets the resolver to either consider (or not) Maven Central in resolution

Parameters:
useCentral - a flag whether to use Maven central
Returns:

goOffline

MavenDependencyResolver goOffline()
Disables touching remote repositories at all, rely on local repository only

Returns:
Modified MavenDependencyResolution

ShrinkWrap Resolver Aggregator 1.1.0-alpha-2

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