Enum DependencyScope

  • All Implemented Interfaces:
    Serializable, Comparable<DependencyScope>

    public enum DependencyScope
    extends Enum<DependencyScope>
    Defines the various dependency scopes that can be assigned to Maven dependencies. Each scope determines the accessibility and visibility of a dependency during the build lifecycle and runtime of an application.

    The supported scopes are: - COMPILE: The default scope, used for dependencies required during both compilation and runtime. - TEST: Used for dependencies only required for testing purposes, not included in the final artifact. - RUNTIME: Specifies dependencies required during execution but not for compilation. - PROVIDED: Specifies dependencies required at compile time but expected to be provided at runtime by the runtime environment.

    The toString() method returns the name of the scope in lowercase.
    • Enum Constant Detail

      • COMPILE

        public static final DependencyScope COMPILE
        The default scope, used for dependencies required during both compilation and runtime.
      • TEST

        public static final DependencyScope TEST
        Used for dependencies only required for testing purposes, not included in the final artifact.
      • RUNTIME

        public static final DependencyScope RUNTIME
        Specifies dependencies required during execution but not for compilation.
      • PROVIDED

        public static final DependencyScope PROVIDED
        Specifies dependencies required at compile time but expected to be provided at runtime.
    • Method Detail

      • values

        public static DependencyScope[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DependencyScope c : DependencyScope.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DependencyScope valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null