ShrinkWrap Resolver Maven API 2.0.0-alpha-1

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
 String coordinates()
          Gets coordinates of the dependency
 MavenDependency coordinates(String coordinates)
          Sets coordinates.
 String[] exclusions()
          Gets all exclusions defined on the dependency
 MavenDependency exclusions(String... exclusion)
          Adds one or more exclusions for current 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 optional()
          Gets optional flag.
 MavenDependency optional(boolean optional)
          Sets dependency as optional.
 String scope()
          Gets scope of the dependency
 MavenDependency scope(String scope)
          Sets scope of the Maven dependency
 

Method Detail

coordinates

MavenDependency coordinates(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

coordinates

String coordinates()
Gets coordinates of the dependency

Returns:
The coordinates

scope

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

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

scope

String scope()
Gets scope of the dependency

Returns:
The scope

exclusions

MavenDependency exclusions(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

exclusions

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

Returns:
Array of exclusions defined for the dependency

optional

MavenDependency optional(boolean optional)
Sets dependency as optional.

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

optional

boolean optional()
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 Maven API 2.0.0-alpha-1

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