Skip navigation links
dev.jeka.core.api.depmanagement

Class JkScope

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String ARCHIVE_MASTER
      Useful when using scope mapping.
      static JkScope COMPILE
      A dependency resolution made with this scope will only fetch dependencies declared with COMPILE scope and transitive dependencies declared with COMPILE scope as well.
      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.
    • Field Detail

      • COMPILE

        public static final JkScope COMPILE
        A dependency resolution made with this scope will only fetch dependencies declared with 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.

      • RUNTIME

        public static final 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. If it is a main application, dependencies will be part of the runtime classpath.

        A dependency resolution made with this scope will fetch dependencies declared with COMPILE or RUNTIME plus their transitive dependencies declared with COMPILE or RUNTIME.

      • PROVIDED

        public static final 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').
      • TEST

        public static final JkScope TEST
        A dependency declared with this scope will be present in testing classpath only. A dependency resolution made with this scope will fetch dependencies declared with COMPILE, RUNTIME or TEST plus their transitive dependencies declared with COMPILE, RUNTIME or TEST.
      • COMPILE_AND_RUNTIME

        public static final JkScope[] COMPILE_AND_RUNTIME
        Shorthand to declare both COMPILE and RUNTIME scope at once. This is the default scope for dependencies. It is equivalent to Maven 'compile'.
      • SCOPES_FOR_COMPILATION

        public static final JkScope[] SCOPES_FOR_COMPILATION
        Scopes necessary for compiling production code.
      • SCOPES_FOR_TEST

        public static final JkScope[] SCOPES_FOR_TEST
        Scopes necessary for both compiling tests and run them.
      • SOURCES

        public static final JkScope SOURCES
        This scope is used for publication purpose
      • JAVADOC

        public static final JkScope JAVADOC
        This scope is used for publication purpose
      • ARCHIVE_MASTER

        public static final java.lang.String ARCHIVE_MASTER
        Useful when using scope mapping. As documented in Ivy, it stands for the main archive.
        See Also:
        Constant Field Values
      • DEFAULT_SCOPE_MAPPING

        public static final JkScopeMapping DEFAULT_SCOPE_MAPPING
        Scope mapping used
    • Method Detail

      • of

        public static JkScope of(java.lang.String name)
        Creates a new JkScope passing its name.
      • of

        public static JkScope of(java.lang.String name,
                                 java.lang.String description,
                                 boolean transitive,
                                 JkScope... extending)
      • ofMavenScope

        public static JkScope ofMavenScope(java.lang.String name)
      • getName

        public java.lang.String getName()
        Returns the name of this scope. Name is used as identifier for scopes.
      • getDescription

        public java.lang.String getDescription()
        Human description for the purpose of this scope, can be null.
      • getExtendedScopes

        public java.util.Set<JkScope> getExtendedScopes()
        Scopes that are extended by this one.
      • isTransitive

        public 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)
      • getAncestorScopes

        public java.util.List<JkScope> getAncestorScopes()
        Returns scopes this scope inherits from. It returns recursively parent scopes, parent of parent scopes and so on.
      • getCommonScopes

        public java.util.List<JkScope> getCommonScopes(java.util.Collection<JkScope> scopes)
        Returns this scope or its first ancestors found present in the specified scopes.
      • isExtending

        public boolean isExtending(JkScope jkScope)
        Returns true if this scope extends the specified one.
      • isInOrIsExtendingAnyOf

        public boolean isInOrIsExtendingAnyOf(java.lang.Iterable<? extends JkScope> scopes)
        Returns true if this scope is one or is extending any of the specified scopes.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getInvolvedScopes

        public static java.util.Set<JkScope> getInvolvedScopes(java.lang.Iterable<JkScope> scopes)
        returns all specified scopes and all of their ancestors.