Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 2.56 KB

gradle.md

File metadata and controls

65 lines (43 loc) · 2.56 KB

IMPORTANT NOTE: We're starting to migrate contents of this repo to the devcontainers org, as part of the work on the open dev container specification.

We've currently migrated gradle as part of the java Feature.

For more details, you can review the announcement issue.

Gradle Install Script

Installs Gradle, SDKMAN! (if not installed), and needed dependencies.

Script status: Stable

OS support: Debian 9+, Ubuntu 18.04+, and downstream distros.

Maintainer: The VS Code and GitHub Codespaces teams

Syntax

./gradle-debian.sh [Gradle version] [SDKMAN_DIR] [Non-root user] [Add rc files flag]

Or as a feature:

"features": {
    "gradle": "latest"
}
Argument Feature option Default Description
Gradle version version latest Version of Gradle to install. Specify latest to install the latest stable version. Partial version numbers are allowed.
SDKMAN_DIR /usr/local/sdkman Location to find SDKMAN!, or if not found, where to install it.
Non-root user automatic Specifies a user in the container other than root that will use Gradle. A value of automatic will cause the script to check for a user called vscode, then node, codespace, and finally a user with a UID of 1000 before falling back to root.
Add to rc files flag true A true/false flag that indicates whether sourcing the nvm script should be added to /etc/bash.bashrc and /etc/zsh/zshrc.

Usage

Feature use

To install these capabilities in your primary dev container, reference it in devcontainer.json as follows:

"features": {
    "gradle": "latest"
}

If you have already built your development container, run the Rebuild Container command from the command palette (Ctrl/Cmd + Shift + P or F1) to pick up the change.

Script use

  1. Add gradle-debian.sh to .devcontainer/library-scripts

  2. Add the following to your .devcontainer/Dockerfile:

    ENV SDKMAN_DIR="/usr/local/sdkman"
    ENV PATH=${SDKMAN_DIR}/bin:${SDKMAN_DIR}/candidates/gradle/current/bin:${PATH}
    COPY library-scripts/gradle-debian.sh /tmp/library-scripts/
    RUN apt-get update && bash /tmp/library-scripts/gradle-debian.sh "latest" "${SDKMAN_DIR}"

That's it!