public enum DependencyScope extends Enum<DependencyScope>
As described at maven.apache.org.
Enum Constant and Description |
---|
COMPILE
This is the default scope, used if none is specified.
|
IMPORT
This scope is only supported on a dependency of type
pom in the
dependencyManagement section. |
PROVIDED
This is much like
COMPILE , but indicates you expect the JDK or a
container to provide the dependency at runtime. |
RUNTIME
This scope indicates that the dependency is not required for compilation, but
is for execution.
|
SYSTEM
This scope is similar to
PROVIDED except that you have to provide
the JAR which contains it explicitly. |
TEST
This scope indicates that the dependency is not required for normal use of
the application, and is only available for the test compilation and execution
phases.
|
Modifier and Type | Method and Description |
---|---|
String |
getValue()
Value inside POM
|
static DependencyScope |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DependencyScope[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DependencyScope COMPILE
public static final DependencyScope PROVIDED
COMPILE
, but indicates you expect the JDK or a
container to provide the dependency at runtime. For example, when building a
web application for the Java Enterprise Edition, you would set the dependency
on the Servlet API and related Java EE APIs to scope provided
because
the web container provides those classes. This scope is only available on the
compilation and test class path, and is not transitive.public static final DependencyScope RUNTIME
public static final DependencyScope TEST
public static final DependencyScope SYSTEM
PROVIDED
except that you have to provide
the JAR which contains it explicitly. The artifact is always available and is
not looked up in a repository.public static final DependencyScope IMPORT
pom
in the
dependencyManagement
section. It indicates the dependency to be
replaced with the effective list of dependencies in the specified POM's
dependencyManagement
section. Since they are replaced, dependencies
with a scope of import
do not actually participate in limiting the
transitivity of a dependency.public static DependencyScope[] values()
for (DependencyScope c : DependencyScope.values()) System.out.println(c);
public static DependencyScope valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getValue()
Copyright © 2025. All rights reserved.