Gradle Build Helper is a Visual Studio Code extension that simplifies running Gradle tasks, especially for multi-project Gradle builds. This extension allows you to select and execute tasks interactively through the Command Palette.
- Select a Gradle task to execute from a predefined list.
- Supports multi-project Gradle builds.
- Excludes specific directories from selection.
- Configure available Gradle tasks, profiles, and the build command.
- Fully customizable via the extension settings.
- Open Visual Studio Code.
- Go to the Extensions view by pressing
Ctrl+Shift+X
(orCmd+Shift+X
on macOS). - Search for "Gradle Build Helper" and install the extension.
- Open the Command Palette (
Ctrl+Shift+p
orCmd+Shift+P
on macOS). - Type and select
Gradle Build Helper
(command:gradle.build.helper
). - Alternatively, use the default shortcut: Ctrl+Shift+` (or Cmd+Shift+` on macOS) to quickly trigger the command.
- Select a directory (if multi-project is enabled).
- Choose a Gradle task to execute.
- If the selected task includes
$profile
, select one from the available profiles. The selected task will be executed with the profile appended, e.g.,-Pprofile=dev
.
This extension provides the following configurable options:
Property: gradle.build.helper.isMultiProject
- Type:
boolean
- Default:
true
- Description: Enable or disable multi-project support.
Property: gradle.build.helper.profiles
- Type:
array
- Default:
["css", "dev"]
- Description: List of available Gradle profiles. If a task includes
$profile
, you will be prompted to select a profile, and the task will be executed with the selected profile, e.g.,-Pprofile=dev
.
Property: gradle.build.helper.tasks
-
Type:
array
-
Default:
[ "gradlew build", "gradlew clean build", "gradlew build -t", "gradlew clean", "gradlew clean build $profile", "gradlew appRun" ]
-
Description: List of available Gradle tasks. Tasks containing
$profile
will require selecting a profile before execution, and the command will be modified to include the profile, e.g.,-Pprofile=dev
. -
Note: If you are using MacOS or Linux, replace gradlew with ./gradlew in the task list. For example:
[ "./gradlew build", "./gradlew clean build", ... ]
Property: gradle.build.helper.excludeDirectory
- Type:
array
- Default:
[]
- Description: List of directories to exclude from selection (only applicable if multi-project support is enabled).
Add the following configuration to your VS Code settings.json
file to customize the extension:
{
"gradle.build.helper.profiles": ["css", "dev", "prod"],
"gradle.build.helper.tasks": [
"gradlew build",
"gradlew clean build",
"gradlew clean",
"gradlew clean build $profile",
"gradlew test",
"gradlew deploy"
],
"gradle.build.helper.isMultiProject": true,
"gradle.build.helper.excludeDirectory": [".git", "node_modules"]
}
Feel free to submit issues or contribute to the repository. Any feedback or suggestions are welcome!
This project is licensed under the MIT License.