Interface Type

All Superinterfaces:
ExtensibleEnum
All Known Implementing Classes:
DefaultType, DefaultType

@Experimental @Immutable public interface Type extends ExtensibleEnum
A dependency's Type is uniquely identified by a String, and semantically represents a known kind of dependency.

It provides information about the file type (or extension) of the associated artifact, its default classifier, and how the artifact will be used in the build when creating class-paths or module-paths.

For example, the type java-source has a jar extension and a sources classifier. The artifact and its dependencies should be added to the build path.

Since:
4.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Artifact type name for a BOM file.
    static final String
    Artifact type name for a JAR file to unconditionally place on the class-path.
    static final String
    Artifact type name for a JAR file to unconditionally place on the annotation processor class-path.
    static final String
    Artifact type name for a fat-JAR file that can be only on the class-path.
    static final String
    Artifact type name for a JAR file that can be placed either on the class-path or on the module-path.
    static final String
    Artifact type name for source code packaged in a JAR file.
    static final String
    Artifact type name for javadoc packaged in a JAR file.
    static final String
    Artifact type name for a Maven plugin.
    static final String
    Artifact type name for a JAR file to unconditionally place on the module-path.
    static final String
    Artifact type name for a JAR file to unconditionally place on the annotation processor module-path.
    static final String
    Artifact type name for a POM file.
    static final String
    Artifact type name for a JAR file that can be placed either on the annotation processor class-path or module-path.
    static final String
    Artifact type name for a JAR file containing test classes.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the default classifier associated to the dependency type.
    Get the file extension of artifacts of this type.
    Returns the dependency type language.
    Types of path (class-path, module-path, …) where the dependency can be placed.
    id()
    Returns the dependency type id.
    boolean
    Specifies if the artifact already embeds its own dependencies.
  • Field Details

    • POM

      static final String POM
      Artifact type name for a POM file.
      See Also:
    • BOM

      static final String BOM
      Artifact type name for a BOM file.
      See Also:
    • JAR

      static final String JAR
      Artifact type name for a JAR file that can be placed either on the class-path or on the module-path. The path (classes or modules) is chosen by the plugin, possibly using heuristic rules. This is the behavior of Maven 3.
      See Also:
    • FATJAR

      static final String FATJAR
      Artifact type name for a fat-JAR file that can be only on the class-path. The fat-JAR is a self-contained JAR and its transitive dependencies will not be resolved, if any. This type is new in Maven 4.
      See Also:
    • CLASSPATH_JAR

      static final String CLASSPATH_JAR
      Artifact type name for a JAR file to unconditionally place on the class-path. If the JAR is modular, its module information are ignored. This type is new in Maven 4.
      See Also:
    • MODULAR_JAR

      static final String MODULAR_JAR
      Artifact type name for a JAR file to unconditionally place on the module-path. If the JAR is not modular, then it is loaded by Java as an unnamed module. This type is new in Maven 4.
      See Also:
    • PROCESSOR

      static final String PROCESSOR
      Artifact type name for a JAR file that can be placed either on the annotation processor class-path or module-path. The path (classes or modules) is chosen by the plugin, possibly using heuristic rules.
      See Also:
    • CLASSPATH_PROCESSOR

      static final String CLASSPATH_PROCESSOR
      Artifact type name for a JAR file to unconditionally place on the annotation processor class-path. If the JAR is modular, its module information are ignored.
      See Also:
    • MODULAR_PROCESSOR

      static final String MODULAR_PROCESSOR
      Artifact type name for a JAR file to unconditionally place on the annotation processor module-path. If the JAR is not modular, then it is loaded by Java as an unnamed module.
      See Also:
    • JAVA_SOURCE

      static final String JAVA_SOURCE
      Artifact type name for source code packaged in a JAR file.
      See Also:
    • JAVADOC

      static final String JAVADOC
      Artifact type name for javadoc packaged in a JAR file.
      See Also:
    • MAVEN_PLUGIN

      static final String MAVEN_PLUGIN
      Artifact type name for a Maven plugin.
      See Also:
    • TEST_JAR

      static final String TEST_JAR
      Artifact type name for a JAR file containing test classes. If the main artifact is placed on the class-path ("jar" or "classpath-jar" types), then the test artifact will also be placed on the class-path. Otherwise, if the main artifact is placed on the module-path ("jar" or "modular-jar" types), then the test artifact will be added using --patch-module option.
      See Also:
  • Method Details

    • id

      Returns the dependency type id. The id uniquely identifies this dependency type.
      Specified by:
      id in interface ExtensibleEnum
      Returns:
      the id of this type, never null.
    • getLanguage

      @Nonnull Language getLanguage()
      Returns the dependency type language.
      Returns:
      the language of this type, never null.
    • getExtension

      @Nonnull String getExtension()
      Get the file extension of artifacts of this type.
      Returns:
      the file extension, never null.
    • getClassifier

      @Nullable String getClassifier()
      Get the default classifier associated to the dependency type. The default classifier can be overridden when specifying the Dependency.getClassifier().
      Returns:
      the default classifier, or null.
    • isIncludesDependencies

      boolean isIncludesDependencies()
      Specifies if the artifact already embeds its own dependencies. This is the case for JEE packages or similar artifacts such as WARs, EARs, etc.
      Returns:
      if the artifact's dependencies are included in the artifact
    • getPathTypes

      @Nonnull Set<PathType> getPathTypes()
      Types of path (class-path, module-path, …) where the dependency can be placed. For most deterministic builds, the array length should be 1. In such case, the dependency will be unconditionally placed on the specified type of path and no heuristic rule will be involved.

      It is nevertheless common to specify two or more types of path. For example, a Java library may be compatible with either the class-path or the module-path, and the user may have provided no instruction about which type to use. In such case, the plugin may apply rules for choosing a path. See for example JavaPathType.CLASSES and JavaPathType.MODULES.