vscode-gradle v3.10.1
VS Code Gradle Tasks
Run Gradle tasks in VS Code.
Features
This extension provides a visual interface for your Gradle build. You can view Gradle projects and run Gradle tasks.
This extension supports whatever Gradle supports and is language/project agnostic, but it can work nicely alongside other extensions like the Java language support extension.
š All Features
Requirements
- Java >= 8 must be installed
- Local Gradle wrapper executables must exist at the root of the workspace folders
Settings
This extension contributes the following settings:
gradle.autoDetect
: Automatically detect Gradle tasksgradle.enableTasksExplorer
: Enable an explorer view for Gradle tasksgradle.taskPresentationOptions
: Task presentation options, see tasks output behaviourgradle.focusTaskInExplorer
: Focus the task in the explorer when running a taskgradle.javaDebug
: Debug JavaExec tasks (see below for usage)gradle.debug
: Show extra debug info in the output panel
To provide better compatibility with the Java language support extension, this extension supports the following settings:
java.home
: Absolute path to JDK home folder used to launch the gradle daemonsjava.import.gradle.user.home
: Setting forGRADLE_USER_HOME
java.import.gradle.jvmArguments
: JVM arguments to pass to Gradlejava.import.gradle.wrapper.enabled
: Enable/disable the Gradle wrapperjava.import.gradle.version
: Gradle version, used if the gradle wrapper is missing or disabled
If you're not using the Java language support extension, you can use the standard Java & Gradle environment variables (see below), or standard Gradle settings (eg via gradle.properties
or task configuration), to configure your tasks and/or Gradle settings.
Supported Environment Variables
Most of the standard Java & Gradle environment variables are supported:
JAVE_HOME
(overridden byjava.home
)GRADLE_USER_HOME
(overridden byjava.import.gradle.user.home
)
Setting Project Environment Variables
You can use an environment manager like direnv to set project specific environment variables, or set the variables in the terminal settings within .vscode/settings.json
, for example:
{
"terminal.integrated.env.osx": {
"GRADLE_USER_HOME": "${workspaceFolder}/.gradle"
}
}
Note, the VS Code settings take precedence over the environment variables.
Debugging JavaExec Tasks
This extension provides an experimental feature to debug JavaExec tasks. Before using this feature you need to install the Debugger for Java and Language Support for Java extensions.
To enable this feature you need to specify which tasks can be debugged within your project .vscode/settings.json
file:
"gradle.javaDebug": {
"tasks": [
"run",
"test",
"subproject:customJavaExecTask"
]
}
You should now see a debug
command next to the run
command in the Gradle Tasks view. The debug
command will start the Gradle task with jdwp jvmArgs
and start the vscode Java debugger.
Debugging Limitations
You'll need to remove any jdwp
options that might have been set in your task configuration (eg via jvmArgs
).
Snippets
This extensions provides snippets for the groovy and kotlin build files:
cgt
: Create a new Gradle task
Extension API
This extension exposes a runTask
API with the following definition:
function runTask(
projectFolder: string, // absolute path of root project folder
taskName: string,
args?: ReadonlyArray<string>,
onOutput?: (output: Output) => void
): Promise<void>;
Import the API type definition like so:
import { ExtensionApi as GradleTasksApi } from "vscode-gradle";
You can use this API to run Gradle tasks. It doesn't matter when you call this method as it will wait for tasks to be loaded before running the task.
Refer to vscode-spotless-gradle for example API usage.
Troubleshooting
This error means the Gradle Task server has stopped, or there was an error starting it. Click on "Restart Server" to restart it.
If you continue to get this error, view the task error messages by selecting "Gradle Tasks Server" in the Terminal panel.
The task server is started using a shell script generated by CreateStartScripts. The script uses #!/usr/bin/env sh
and is as portable as the gradle wrapper script. If there are any problems executing the start script then it's likely an issue either with your $PATH
, or java was not installed.
PATH problems
The following error demonstrates a typical issue with your $PATH
:
env: sh: No such file or directory
The terminal process terminated with exit code: 127
Use the following task to debug your shell environment within vscode:
{
"version": "2.0.0",
"tasks": [
{
"label": "Print task shell info",
"type": "shell",
"command": "echo \"Path: $PATH \nShell: $SHELL\"",
"problemMatcher": []
}
]
}
Fixing your $PATH
Check your dotfiles (eg ~/.bashrc
, ~/.bash_profile
, ~/.zshrc
) and fix any broken PATH
exports, or override the PATH
env var by setting terminal.integrated.env
in your vscode settings, for example:
"terminal.integrated.env.osx": {
"PATH": "/put/your:/paths/here",
}
Java path problems
You might see an error like:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
The start script should find the path to Java in the usual locations. If you get this error it suggests an issues with your $PATH
or you simply haven't installed Java. Run the gradle wrapper script (eg ./gradlew tasks
) to debug further.
This extension is incompatible with the following extensions:
The reason for the incompatibility is due to the extensions providing the same tasks types (gradle
) with different task definitions.
Support
For general support queries, use the #gradle-tasks channel in the slack development community workspace, or
Contributing
Refer to CONTRIBUTING.md for instructions on how to run the project.
Credits
- Originally forked from Cazzar/vscode-gradle
- Inspired by the built-in npm extension
- Thanks to all who have submitted bug reports and feedback š
Release Notes
See CHANGELOG.md.
License
See LICENSE.md.
3 years ago
3 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago