Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
devcontainer-features
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eazydevelop-devcontainer-temp
devcontainer-features
Commits
b9515499
Commit
b9515499
authored
Aug 20, 2025
by
xiezhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Chinese mirror support for SDKMAN to improve download speed in China
parent
66385f3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
devcontainer-feature.json
src/java/devcontainer-feature.json
+16
-0
install.sh
src/java/install.sh
+32
-0
No files found.
src/java/devcontainer-feature.json
View file @
b9515499
...
@@ -97,6 +97,22 @@
...
@@ -97,6 +97,22 @@
],
],
"default"
:
"latest"
,
"default"
:
"latest"
,
"description"
:
"Select or enter a Groovy version"
"description"
:
"Select or enter a Groovy version"
},
"useChineseMirror"
:
{
"type"
:
"boolean"
,
"default"
:
true
,
"description"
:
"Use Chinese mirrors (Aliyun) for faster download in China"
},
"mirrorSource"
:
{
"type"
:
"string"
,
"proposals"
:
[
"aliyun"
,
"tencent"
,
"huawei"
,
"official"
],
"default"
:
"aliyun"
,
"description"
:
"Select mirror source for SDKMAN downloads"
}
}
},
},
"customizations"
:
{
"customizations"
:
{
...
...
src/java/install.sh
View file @
b9515499
...
@@ -19,6 +19,8 @@ ANT_VERSION="${ANTVERSION:-"latest"}"
...
@@ -19,6 +19,8 @@ ANT_VERSION="${ANTVERSION:-"latest"}"
INSTALL_GROOVY
=
"
${
INSTALLGROOVY
:-
"false"
}
"
INSTALL_GROOVY
=
"
${
INSTALLGROOVY
:-
"false"
}
"
GROOVY_VERSION
=
"
${
GROOVYVERSION
:-
"latest"
}
"
GROOVY_VERSION
=
"
${
GROOVYVERSION
:-
"latest"
}
"
JDK_DISTRO
=
"
${
JDKDISTRO
:-
"ms"
}
"
JDK_DISTRO
=
"
${
JDKDISTRO
:-
"ms"
}
"
USE_CHINESE_MIRROR
=
"
${
USECHINESEMIRROR
:-
"true"
}
"
MIRROR_SOURCE
=
"
${
MIRRORSOURCE
:-
"aliyun"
}
"
export
SDKMAN_DIR
=
"
${
SDKMAN_DIR
:-
"/usr/local/sdkman"
}
"
export
SDKMAN_DIR
=
"
${
SDKMAN_DIR
:-
"/usr/local/sdkman"
}
"
USERNAME
=
"
${
USERNAME
:-
"
${
_REMOTE_USER
:-
"automatic"
}
"
}
"
USERNAME
=
"
${
USERNAME
:-
"
${
_REMOTE_USER
:-
"automatic"
}
"
}
"
...
@@ -310,6 +312,36 @@ if [ ! -d "${SDKMAN_DIR}" ]; then
...
@@ -310,6 +312,36 @@ if [ ! -d "${SDKMAN_DIR}" ]; then
curl
-sSL
"https://get.sdkman.io?rcupdate=false"
| bash
curl
-sSL
"https://get.sdkman.io?rcupdate=false"
| bash
chown
-R
"
${
USERNAME
}
:sdkman"
${
SDKMAN_DIR
}
chown
-R
"
${
USERNAME
}
:sdkman"
${
SDKMAN_DIR
}
find
${
SDKMAN_DIR
}
-type
d
-print0
| xargs
-d
'\n'
-0
chmod
g+s
find
${
SDKMAN_DIR
}
-type
d
-print0
| xargs
-d
'\n'
-0
chmod
g+s
# Configure SDKMAN to use Chinese mirrors for faster download
if
[
"
${
USE_CHINESE_MIRROR
}
"
=
"true"
]
&&
[
-f
"
${
SDKMAN_DIR
}
/etc/config"
]
;
then
# Backup original config
cp
"
${
SDKMAN_DIR
}
/etc/config"
"
${
SDKMAN_DIR
}
/etc/config.backup"
# Configure mirror based on user selection
case
"
${
MIRROR_SOURCE
}
"
in
"aliyun"
)
mirror_url
=
"https://mirrors.aliyun.com/sdkman/candidates"
echo
"Configuring SDKMAN to use Aliyun mirrors for faster download in China"
;;
"tencent"
)
mirror_url
=
"https://mirrors.cloud.tencent.com/sdkman/candidates"
echo
"Configuring SDKMAN to use Tencent Cloud mirrors for faster download in China"
;;
"huawei"
)
mirror_url
=
"https://mirrors.huaweicloud.com/sdkman/candidates"
echo
"Configuring SDKMAN to use Huawei Cloud mirrors for faster download in China"
;;
"official"
|
*
)
mirror_url
=
"https://api.sdkman.io/2/candidates"
echo
"Using official SDKMAN mirrors"
;;
esac
# Update the config file
sed
-i
"s|sdkman.candidates.api=https://api.sdkman.io/2/candidates|sdkman.candidates.api=
${
mirror_url
}
|g"
"
${
SDKMAN_DIR
}
/etc/config"
fi
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
updaterc
"export SDKMAN_DIR=
${
SDKMAN_DIR
}
\n
.
\$
{SDKMAN_DIR}/bin/sdkman-init.sh"
updaterc
"export SDKMAN_DIR=
${
SDKMAN_DIR
}
\n
.
\$
{SDKMAN_DIR}/bin/sdkman-init.sh"
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment