Interface Tool
- All Superinterfaces:
org.gradle.api.Named,Serializable
- All Known Subinterfaces:
Tool.Resolved
public sealed interface Tool
extends org.gradle.api.Named, Serializable
permits Tool.Resolved (not exhaustive)
Tools are definitions of Java libraries (may or may not be executable) that are managed by Gradle using a
ValueSource. This means that while the downloading and local caching of this file are done
in house, the Gradle-specific caching and file tracking are done by Gradle. This enables the usage of downloading
external files quickly without breaking caches.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA definition of how a tool should be resolved and used by the plugin.static interfaceA resolved tool that has a classpath that can be readily used.Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Method Summary
Modifier and TypeMethodDescriptionintThe Java version this tool was built with.@Nullable StringThe main class to use when executing this tool.getName()The name for this tool.The version of this tool.default booleanIf this tool has a strictly defined main class.static ToolCreates a new tool with the given information.static ToolCreates a new tool with the given information.
-
Method Details
-
of
Creates a new tool with the given information.- Parameters:
name- The name for this tool (will be used in the file name)version- The version for this tool (will be used in the file name)downloadUrl- The download URL for this tooljavaVersion- The Java version this tool was built with, or should run onmainClass- The main class to use when executing this tool- Returns:
- The tool
-
of
Creates a new tool with the given information.- Parameters:
name- The name for this tool (will be used in the file name)version- The version for this tool (will be used in the file name)downloadUrl- The download URL for this tooljavaVersion- The Java version this tool was built with, or should run on- Returns:
- The tool
-
getName
String getName()The name for this tool. Primarily used byToolExecBaseto create a default tool directory.- Specified by:
getNamein interfaceorg.gradle.api.Named- Returns:
- The name of this tool
-
getVersion
-
getJavaVersion
int getJavaVersion()The Java version this tool was built with. Primarily used byToolExecBaseto determine theJavaLauncher.- Returns:
- The Java version
-
getMainClass
The main class to use when executing this tool. Can benull, but does not necessarily mean that the tool is not executable.- Returns:
- The main class, or
nullif unspecified
-
hasMainClass
default boolean hasMainClass()If this tool has a strictly defined main class. Can befalse, but does not necessarily mean that this tools is not executable.- Returns:
- If this tool has a main class
-