File tree Expand file tree Collapse file tree 8 files changed +137
-0
lines changed
Expand file tree Collapse file tree 8 files changed +137
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ This repository contains the following features:
1010- [ Mise - mise-en-place version manager] ( ./src/mise/README.md ) : Installs mise-en-place version manager.
1111- [ Bun (via mise)] ( ./src/mise-bun/README.md ) : Installs Bun via mise-en-place version manager.
1212- [ Go (via mise)] ( ./src/mise-golang/README.md ) : Installs Go via mise-en-place version manager.
13+ - [ Java (via mise)] ( ./src/mise-java/README.md ) : Installs Java via mise-en-place version manager.
1314- [ Node.js (via mise)] ( ./src/mise-node/README.md ) : Installs Node.js via mise-en-place version manager.
1415- [ Python (via mise)] ( ./src/mise-python/README.md ) : Installs Python via mise-en-place version manager.
1516- [ Ruby (via mise)] ( ./src/mise-ruby/README.md ) : Installs Ruby via mise-en-place version manager.
Original file line number Diff line number Diff line change 1+
2+ # Java (via mise) (mise-java)
3+
4+ Installs Java via mise-en-place version manager.
5+
6+ ## Example Usage
7+
8+ ``` json
9+ "features" : {
10+ "ghcr.io/roul/devcontainer-features/mise-java:1" : {}
11+ }
12+ ```
13+
14+ ## Options
15+
16+ | Options Id | Description | Type | Default Value |
17+ | -----| -----| -----| -----|
18+ | version | Version to be installed as default. | string | latest |
19+ | extra_versions | Additional versions to be installed. (space separated) | string | - |
20+
21+
22+
23+ ---
24+
25+ _ Note: This file was auto-generated from the [ devcontainer-feature.json] ( https://github.com/RouL/devcontainer-features/blob/main/src/mise-java/devcontainer-feature.json ) . Add additional notes to a ` NOTES.md ` ._
Original file line number Diff line number Diff line change 1+ {
2+ "id" : " mise-java" ,
3+ "version" : " 1.0.0" ,
4+ "name" : " Java (via mise)" ,
5+ "description" : " Installs Java via mise-en-place version manager." ,
6+ "dependsOn" : {
7+ "ghcr.io/roul/devcontainer-features/mise:latest" : {}
8+ },
9+ "options" : {
10+ "version" : {
11+ "description" : " Version to be installed as default." ,
12+ "type" : " string" ,
13+ "default" : " latest"
14+ },
15+ "extra_versions" : {
16+ "description" : " Additional versions to be installed. (space separated)" ,
17+ "type" : " string" ,
18+ "default" : " "
19+ }
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/bash
2+ set -e
3+
4+ USERNAME=" ${USERNAME:- " ${_REMOTE_USER:- " automatic" } " } "
5+ VERSION=" ${VERSION:- latest} "
6+
7+ REQUIRED_PACKAGES=" build-essential git ca-certificates"
8+
9+ apt_get_update ()
10+ {
11+ if [ " $( find /var/lib/apt/lists/* | wc -l) " = " 0" ]; then
12+ echo " Running apt-get update..."
13+ apt-get update -y
14+ fi
15+ }
16+
17+ check_packages () {
18+ if ! dpkg -s " $@ " > /dev/null 2>&1 ; then
19+ apt_get_update
20+ apt-get -y install --no-install-recommends " $@ "
21+ fi
22+ }
23+
24+ export DEBIAN_FRONTEND=noninteractive
25+
26+ check_packages $REQUIRED_PACKAGES
27+
28+ install () {
29+ su ${USERNAME} -c " mise use --global java@${VERSION} "
30+ }
31+
32+ echo " (*) Installing Java (${VERSION} ) via mise as default..."
33+
34+ install
35+
36+ for extraVersion in $EXTRA_VERSIONS
37+ do
38+ echo " (*) Installung Java (${extraVersion} ) via mise"
39+ su ${USERNAME} -c " mise install java@${extraVersion} "
40+ done
41+
42+ # Clean up
43+ rm -rf /var/lib/apt/lists/*
44+
45+ echo " Done!"
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ source dev-container-features-test-lib
5+
6+ check " check default java == 9.*" bash -c " java -version 2>&1 | grep -E '^openjdk version \" 9\.'"
7+
8+ reportResults
Original file line number Diff line number Diff line change 1+ {
2+ "openjdk9" : {
3+ "image" : " mcr.microsoft.com/devcontainers/base:ubuntu" ,
4+ "features" : {
5+ "mise-java" : {
6+ "version" : " 9"
7+ }
8+ }
9+ },
10+ "zulu8_temurin20_corretto19" : {
11+ "image" : " mcr.microsoft.com/devcontainers/base:ubuntu" ,
12+ "features" : {
13+ "mise-java" : {
14+ "version" : " zulu-8" ,
15+ "extra_versions" : " temurin-20 corretto-19"
16+ }
17+ }
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ source dev-container-features-test-lib
5+
6+ check " check default java" bash -c " java -version 2>&1 | grep -E '^openjdk version \" [1-9][0-9]*\" '"
7+
8+ reportResults
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ source dev-container-features-test-lib
5+
6+ check " check default java == 1.8.*" bash -c " java -version 2>&1 | grep -E '^openjdk version \" 1\.8\.'"
7+ check " check java 20.*" bash -c " mise exec java@temurin-20 -- java -version 2>&1 | grep -E '^openjdk version \" 20\.'"
8+ check " check java 19.*" bash -c " mise exec java@corretto-19 -- java -version 2>&1 | grep -E '^openjdk version \" 19\.'"
9+
10+ reportResults
You can’t perform that action at this time.
0 commit comments