Enum Class DirectoryHierarchy
- All Implemented Interfaces:
Serializable, Comparable<DirectoryHierarchy>, Constable
The way that source files are organized in a file system directory hierarchy.
Directory
hierarchies are package hierarchy, module hierarchy and module source hierarchy, but
for the purpose of the Maven Compiler Plugin we do not distinguish between the two latter.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA multi-module project using module source hierarchy.Project using package hierarchy.Deprecated.Used only for compatibility with Maven 3. -
Method Summary
Modifier and TypeMethodDescriptionoutputDirectoryForReleases(Path outputDirectory) Returns the directory where to write the compiled class files for all Java releases.outputDirectoryForReleases(Path outputDirectory, SourceVersion release) Returns the directory where to write the compiled class files for a specific Java release.toString()Returns a string representation for use in error message.static DirectoryHierarchyReturns the enum constant of this class with the specified name.static DirectoryHierarchy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
PACKAGE
Project using package hierarchy. This is the hierarchy used by all Java projects before Java 9. Note that it does not necessarily implies a class-path project. A modular project can still use the package hierarchy if the project contains only one module. -
PACKAGE_WITH_MODULE
Deprecated.Used only for compatibility with Maven 3.Project using package hierarchy, but in which amodule-infofile has been detected. This is used for compilation of tests. For the main code, we pretend that the hierarchy isMODULE_SOURCEand move the directory output after compilation. Therefore, this enumeration value can be understood as "pseudo module source hierarchy".- See Also:
-
MODULE_SOURCE
A multi-module project using module source hierarchy. It could also be a module hierarchy, as the Maven Compiler Plugin does not need to distinguish module hierarchy and module source hierarchy.
-
-
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
-
outputDirectoryForReleases
Returns the directory where to write the compiled class files for all Java releases. The standard path forPACKAGEhierarchy isMETA-INF/versions. The caller shall add the version number to the returned path.- Parameters:
outputDirectory- usually the value ofSourceDirectory.outputDirectory- Returns:
- the directory for all versions
-
outputDirectoryForReleases
Returns the directory where to write the compiled class files for a specific Java release. The standard path isMETA-INF/versions/${release}where${release}is the numerical value of thereleaseargument. However forMODULE_SOURCEcase, the returned path is ratherMETA-INF/versions-modular/${release}. The latter is non-standard because there is no standard multi-module JAR formats as of 2025. The use of"versions-modular"is for allowing other plugins such as Maven JAR plugin to avoid confusion with the standard case.- Parameters:
outputDirectory- usually the value ofSourceDirectory.outputDirectoryrelease- the release, ornullfor the default release- Returns:
- the directory for the classes of the specified version
-
toString
Returns a string representation for use in error message.- Overrides:
toStringin classEnum<DirectoryHierarchy>- Returns:
- human-readable string representation
-