Package org.apache.maven.api
Enum Class JavaPathType
- All Implemented Interfaces:
Serializable
,Comparable<JavaPathType>
,Constable
,PathType
The option of a Java command-line tool where to place the paths to some dependencies.
A
PathType
can identify the class path, the module path, the patches for a specific module,
or another kind of path.
One path type is handled in a special way: unlike other options,
the paths specified in a --patch-module
Java option is effective only for a specified module.
This type is created by calls to patchModule(String)
and a new instance must be created for
every module to patch.
Path types are often exclusive. For example, a dependency should not be both on the Java class path and on the Java module path.
Relationship with Java compiler standard location
This enumeration is closely related to theJavaFileManager.Location
enumerations.
A difference is that the latter enumerates input and output files, while JavaPathType
enumerates only input dependencies. Another difference is that JavaPathType
contains
some enumeration values used only at runtime and therefore not available in javax.tool
,
such as agent paths.- Since:
- 4.0.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal class
Type of path which is applied to only one specific Java module.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe path identified by the Java-agentpath
option.The path identified by the Java--class-path
option.The path identified by the Javadoc-doclet
option.The path identified by the Java--module-path
option.The path identified by the Java--patch-module
option.The path identified by the Java--processor-path
option.The path identified by the Java--processor-module-path
option.The path identified by the Javadoc-tagletpath
option.The path identified by the Java--upgrade-module-path
option. -
Field Summary
Fields inherited from interface org.apache.maven.api.PathType
UNRESOLVED
-
Method Summary
Modifier and TypeMethodDescriptionid()
Returns the unique name of this path type.location()
Returns the identification of this path in thejavax.tool
API.option()
Returns the name of the tool option for this path.String[]
Returns the option followed by a string representation of the given path elements.static JavaPathType.Modular
patchModule
(String moduleName) Creates a path identified by the Java--patch-module
option.toString()
Returns a string representation of this path type for debugging purposes.static JavaPathType
Returns the enum constant of this class with the specified name.static Optional<JavaPathType>
valueOf
(JavaFileManager.Location location) Returns the path type associated to the givenjavax.tool
location.static JavaPathType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CLASSES
The path identified by the Java--class-path
option. Used for compilation, execution and Javadoc among others. The Java tools location isStandardLocation.CLASS_PATH
.Context-sensitive interpretation
A dependency with this path type will not necessarily be placed on the class path. There are two circumstances where the dependency may nevertheless be placed somewhere else:- If
MODULES
path type is also set, then the dependency can be placed either on the class path or on the module path, but only one of those. The choice is up to the plugin, possibly using heuristic rules (Maven 3 behavior). - If a
patchModule(String)
is also set and the main JAR file is placed on the module path, then the test dependency will be placed on the Java--patch-module
option instead of the class path.
- If
-
MODULES
The path identified by the Java--module-path
option. Used for compilation, execution and Javadoc among others. The Java tools location isStandardLocation.MODULE_PATH
.Context-sensitive interpretation
A dependency with this flag will not necessarily be placed on the module path. There are two circumstances where the dependency may nevertheless be placed somewhere else:- If
CLASSES
path type is also set, then the dependency should be placed on the module path, but is also compatible with placement on the class path. Compatibility can be achieved, for example, by repeating in theMETA-INF/services/
directory the services that are declared in themodule-info.class
file. In that case, the path type can be chosen by the plugin. - If a
patchModule(String)
is also set and the main JAR file is placed on the module path, then the test dependency will be placed on the Java--patch-module
option instead of the--module-path
option.
- If
-
UPGRADE_MODULES
The path identified by the Java--upgrade-module-path
option. The Java tools location isStandardLocation.UPGRADE_MODULE_PATH
. -
PATCH_MODULE
The path identified by the Java--patch-module
option. The Java tools location isStandardLocation.PATCH_MODULE_PATH
. Note that this option is incomplete, because it must be followed by a module name. Use this type only when the module to patch is unknown.- See Also:
-
PROCESSOR_CLASSES
The path identified by the Java--processor-path
option. The Java tools location isStandardLocation.ANNOTATION_PROCESSOR_PATH
. -
PROCESSOR_MODULES
The path identified by the Java--processor-module-path
option. The Java tools location isStandardLocation.ANNOTATION_PROCESSOR_MODULE_PATH
. -
AGENT
The path identified by the Java-agentpath
option. -
DOCLET
The path identified by the Javadoc-doclet
option. The Java tools location isDocumentationTool.Location.DOCLET_PATH
. -
TAGLETS
The path identified by the Javadoc-tagletpath
option. The Java tools location isDocumentationTool.Location.TAGLET_PATH
.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-
patchModule
Creates a path identified by the Java--patch-module
option. Contrarily to the other types of paths, this path is applied to only one specific module. Used for compilation and execution among others.Context-sensitive interpretation
This path type makes sense only when a main module is added on the module path by another dependency. In no main module is found, the patch dependency may be added on the class path or module path depending on whetherCLASSES
orMODULES
is present.- Parameters:
moduleName
- name of the module on which to apply the path- Returns:
- an identification of the patch-module path for the given module.
- See Also:
-
id
Returns the unique name of this path type. -
location
Returns the identification of this path in thejavax.tool
API. The value may be an instance ofStandardLocation
orDocumentationTool.Location
, depending which tool will use this location.- Returns:
- the
javax.tool
enumeration value corresponding to thisJavaPathType
-
valueOf
Returns the path type associated to the givenjavax.tool
location. This method is the converse oflocation()
.- Parameters:
location
- identification of a path in thejavax.tool
API- Returns:
- Java path type associated to the given location
-
option
Returns the name of the tool option for this path. For example, if this path type isMODULES
, then this method returns"--module-path"
. The option does not include the module name on which it applies. -
option
Returns the option followed by a string representation of the given path elements. For example, if this type isMODULES
, then the option is"--module-path"
followed by the specified path elements.- Specified by:
option
in interfacePathType
- Parameters:
paths
- the path to format as a tool option- Returns:
- the option associated to this path type followed by the given path elements, or an empty array if there is no path element
- Throws:
IllegalStateException
- if no option is associated to this path type
-
toString
Returns a string representation of this path type for debugging purposes..- Specified by:
toString
in interfacePathType
- Overrides:
toString
in classEnum<JavaPathType>
- Returns:
- a string representation of this path type for debugging purposes
-