Interface Toolchain
- All Known Subinterfaces:
JavaToolchain
A toolchain is a set of tools that can be used to build a project. This interface allows users to define and configure various toolchains that can be utilized by Maven during the build process. Toolchains can include compilers, interpreters, and other tools that are necessary for building a project in a specific environment.
Toolchains are defined in the Maven toolchains.xml file and can be referenced in the project's POM file. This allows for greater flexibility and control over the build environment, enabling developers to specify the exact versions of tools they wish to use.
Toolchains can be obtained through the ToolchainManager
service. This service provides methods to retrieve and manage toolchains defined
in the Maven configuration.
The following are key functionalities provided by the Toolchain interface:
- Access to the type of the toolchain (e.g., JDK, compiler).
- Retrieval of the specific version of the toolchain.
- Configuration of toolchain properties to match the project's requirements.
Example usage:
Toolchain toolchain = ...; // Obtain a Toolchain instance String type = toolchain.getType(); // Get the type of the toolchain String version = toolchain.getVersion(); // Get the version of the toolchain
- Since:
- 4.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGets the platform tool executable.getType()
Gets the type of toolchain.boolean
matchesRequirements
(Map<String, String> requirements) Let the toolchain decide if it matches requirements defined in the toolchain plugin configuration.
-
Method Details
-
getType
String getType()Gets the type of toolchain.- Returns:
- the toolchain type
-
findTool
Gets the platform tool executable.- Parameters:
toolName
- the tool platform independent tool name- Returns:
- file representing the tool executable, or null if the tool cannot be found
-
matchesRequirements
Let the toolchain decide if it matches requirements defined in the toolchain plugin configuration.- Parameters:
requirements
- key value pair, may not benull
- Returns:
true
if the requirements match, otherwisefalse
-