public class MavenDependencyImpl extends Object implements MavenDependency
Constructor and Description |
---|
MavenDependencyImpl(String coordinates) |
Modifier and Type | Method and Description |
---|---|
MavenDependency |
addExclusions(String... exclusions)
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 |
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
|
public MavenDependencyImpl(String coordinates)
public MavenDependency setCoordinates(String coordinates)
MavenDependency
setCoordinates
in interface MavenDependency
coordinates
- The artifact coordinates in the format
<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
, must not be null
or empty.public String getScope()
MavenDependency
getScope
in interface MavenDependency
public MavenDependency setScope(String scope)
MavenDependency
setScope
in interface MavenDependency
scope
- The scope to be setpublic boolean isOptional()
MavenDependency
isOptional
in interface MavenDependency
true
if dependency is optional,false
otherwisepublic MavenDependency setOptional(boolean optional)
MavenDependency
setOptional
in interface MavenDependency
optional
- The optional flag to setpublic String[] getExclusions()
MavenDependency
getExclusions
in interface MavenDependency
public String getCoordinates()
MavenDependency
getCoordinates
in interface MavenDependency
public MavenDependency addExclusions(String... exclusions)
MavenDependency
addExclusions
in interface MavenDependency
exclusions
- Array of exclusions to be added, in form <groupId>:<artifactId>[:<extension>[:<classifier>]]
or *
to exclude all transitive dependenciespublic boolean hasSameArtifactAs(MavenDependency other)
MavenDependency
Coordinates cannot be compared directly, see reason below.
To implement this method, developer must be aware that effectively
hasSameArtifactAs
in interface MavenDependency
other
- The other dependencytrue
if other has the same artifact definition, false
otherwiseCopyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.