public final class JkScope
extends java.lang.Object
Junit
library may only be necessary for
testing, so we can declare that
Junit is only necessary for scope TEST
.
Similar to Maven scope
or Ivy configuration
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARCHIVE_MASTER
Useful when using scope mapping.
|
static JkScope |
COMPILE
|
static JkScope[] |
COMPILE_AND_RUNTIME
Shorthand to declare both COMPILE and RUNTIME scope at once.
|
static JkScopeMapping |
DEFAULT_SCOPE_MAPPING
Scope mapping used
|
static JkScope |
JAVADOC
This scope is used for publication purpose
|
static JkScope |
PROVIDED
A dependency declared with this scope will be available at compile time but won't be part of the packaged
product (similar to Maven scope 'provided').
|
static JkScope |
RUNTIME
A dependency declared with this scope will be present in the classpath for packaging or running the module.
If it is a library, dependencies will be included in the fat jar.
If it is a war, dependencies will be included in war file.
|
static JkScope[] |
SCOPES_FOR_COMPILATION
Scopes necessary for compiling production code.
|
static JkScope[] |
SCOPES_FOR_TEST
Scopes necessary for both compiling tests and run them.
|
static JkScope |
SOURCES
This scope is used for publication purpose
|
static JkScope |
TEST
A dependency declared with this scope will be present in testing classpath only.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.util.List<JkScope> |
getAncestorScopes()
Returns scopes this scope inherits from.
|
java.util.List<JkScope> |
getCommonScopes(java.util.Collection<JkScope> scopes)
Returns this scope or its first ancestors found present in the specified scopes.
|
java.lang.String |
getDescription()
Human description for the purpose of this scope, can be
null . |
java.util.Set<JkScope> |
getExtendedScopes()
Scopes that are extended by this one.
|
static java.util.Set<JkScope> |
getInvolvedScopes(java.lang.Iterable<JkScope> scopes)
returns all specified scopes and all of their ancestors.
|
java.lang.String |
getName()
Returns the name of this scope.
|
int |
hashCode() |
boolean |
isExtending(JkScope jkScope)
Returns
true if this scope extends the specified one. |
boolean |
isInOrIsExtendingAnyOf(java.lang.Iterable<? extends JkScope> scopes)
Returns
true if this scope is one or is extending any of the specified scopes. |
boolean |
isInOrIsExtendingAnyOf(JkScope... scopes) |
boolean |
isTransitive()
Returns
true if the dependencies defined with this scope should be resolved recursively
(meaning returning the dependencies of the dependencies and so on) |
JkScopeMapping |
mapTo(java.lang.String... targetScopes)
Returns a
JkScopeMapping from this JkScope to the specified one. |
static JkScope |
of(java.lang.String name)
Creates a new
JkScope passing its name. |
static JkScope |
of(java.lang.String name,
java.lang.String description,
boolean transitive,
JkScope... extending) |
static JkScope |
ofMavenScope(java.lang.String name) |
java.lang.String |
toString() |
public static final JkScope COMPILE
COMPILE
scope and
transitive dependencies declared with COMPILE
scope as well. >
CAUTION : Using default scope mapping, when resolving RUNTIME
dependencies, transitive 'runtime' dependencies won't be fetched if
it's coming to a 'compile' one.
In such, it differs from Maven 'compile' scope : resolving 'runtime' in Maven will fetch transitive 'runtime' dependencies coming from 'compile' ones.
If you want to have a dependency scope equivalent to Maven 'compile', you need to declare dependencies with
two scopes : COMPILE
and RUNTIME
or their shorthand COMPILE_AND_RUNTIME
.
public static final JkScope RUNTIME
A dependency resolution made with this scope will fetch dependencies declared with COMPILE
or RUNTIME
plus their transitive dependencies declared with COMPILE
or RUNTIME
.
public static final JkScope PROVIDED
public static final JkScope TEST
public static final JkScope[] COMPILE_AND_RUNTIME
public static final JkScope[] SCOPES_FOR_COMPILATION
public static final JkScope[] SCOPES_FOR_TEST
public static final JkScope SOURCES
public static final JkScope JAVADOC
public static final java.lang.String ARCHIVE_MASTER
public static final JkScopeMapping DEFAULT_SCOPE_MAPPING
public static JkScope of(java.lang.String name, java.lang.String description, boolean transitive, JkScope... extending)
public static JkScope ofMavenScope(java.lang.String name)
public java.lang.String getName()
public java.lang.String getDescription()
null
.public java.util.Set<JkScope> getExtendedScopes()
public boolean isTransitive()
true
if the dependencies defined with this scope should be resolved recursively
(meaning returning the dependencies of the dependencies and so on)public java.util.List<JkScope> getAncestorScopes()
public java.util.List<JkScope> getCommonScopes(java.util.Collection<JkScope> scopes)
public boolean isExtending(JkScope jkScope)
true
if this scope extends the specified one.public JkScopeMapping mapTo(java.lang.String... targetScopes)
JkScopeMapping
from this JkScope
to the specified one.public boolean isInOrIsExtendingAnyOf(java.lang.Iterable<? extends JkScope> scopes)
true
if this scope is one or is extending any of the specified scopes.public boolean isInOrIsExtendingAnyOf(JkScope... scopes)
isInOrIsExtendingAnyOf(Iterable)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object