ShrinkWrap Resolver Aggregator 1.1.0-alpha-2

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

All Superinterfaces:
ResolutionElement<MavenDependency>

public interface MavenDependency
extends ResolutionElement<MavenDependency>

Describes Maven Resolution Element. Contract encapsulates Maven dependency as known from POM files.

Author:
Method Summary
 MavenDependency addExclusions(String... exclusion)
          Adds one or more exclusions for current dependency
 String getCoordinates()
          Gets coordinates of the dependency
 String[] getExclusions()
          Gets all exclusions defined on the dependency
 String getScope()
          Gets scope of the dependency
 boolean hasSameArtifactAs(MavenDependency other)
          Checks if other dependency defined the same artifact, that is Maven will resolve the same artifact from the other dependency.
 boolean hasSameArtifactAs(String other)
          Checks if other coordinates defines the same artifact, that is Maven will resolve the same artifact from the other coordinates.
 boolean isOptional()
          Gets optional flag.
 MavenDependency setCoordinates(String coordinates)
          Sets coordinates.
 MavenDependency setOptional(boolean optional)
          Sets dependency as optional.
 MavenDependency setScope(String scope)
          Sets scope of the Maven dependency
 

Method Detail

setCoordinates

MavenDependency setCoordinates(String coordinates)
Sets coordinates.

Parameters:
coordinates - The artifact coordinates in the format <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version> , must not be null or empty.
Returns:
Modified instance for chaining

getCoordinates

String getCoordinates()
Gets coordinates of the dependency

Returns:
The coordinates

setScope

MavenDependency setScope(String scope)
Sets scope of the Maven dependency

Parameters:
scope - The scope to be set
Returns:
Modified instance for chaining

getScope

String getScope()
Gets scope of the dependency

Returns:
The scope

addExclusions

MavenDependency addExclusions(String... exclusion)
Adds one or more exclusions for current dependency

Parameters:
exclusion - Array of exclusions to be added, in form <groupId>:<artifactId>[:<extension>[:<classifier>]] or * to exclude all transitive dependencies
Returns:
Modified instance for chaining

getExclusions

String[] getExclusions()
Gets all exclusions defined on the dependency

Returns:
Array of exclusions defined for the dependency

setOptional

MavenDependency setOptional(boolean optional)
Sets dependency as optional.

Parameters:
optional - The optional flag to set
Returns:
Modified instance for chaining

isOptional

boolean isOptional()
Gets optional flag. By default dependency is considered non-optional.

Returns:
true if dependency is optional,false otherwise

hasSameArtifactAs

boolean hasSameArtifactAs(MavenDependency other)
Checks if other dependency defined the same artifact, that is Maven will resolve the same artifact from the other dependency.

Coordinates cannot be compared directly, see reason below.

To implement this method, developer must be aware that effectively

Parameters:
other - The other dependency
Returns:
true if other has the same artifact definition, false otherwise

hasSameArtifactAs

boolean hasSameArtifactAs(String other)
Checks if other coordinates defines the same artifact, that is Maven will resolve the same artifact from the other coordinates.

Coordinates cannot be compared directly, see reason below.

To implement this method, developer must be aware that effectively

Parameters:
other - The other dependency
Returns:
true if other has the same artifact definition, false otherwise

ShrinkWrap Resolver Aggregator 1.1.0-alpha-2

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