init
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/mvnw text eol=lf
|
||||
*.cmd text eol=crlf
|
||||
3
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
3
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
wrapperVersion=3.3.4
|
||||
distributionType=only-script
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
|
||||
2
language/.gitattributes
vendored
Normal file
2
language/.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/mvnw text eol=lf
|
||||
*.cmd text eol=crlf
|
||||
3
language/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
3
language/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
wrapperVersion=3.3.4
|
||||
distributionType=only-script
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip
|
||||
6655
language/effective.xml
Normal file
6655
language/effective.xml
Normal file
File diff suppressed because it is too large
Load Diff
295
language/mvnw
vendored
Executable file
295
language/mvnw
vendored
Executable file
@@ -0,0 +1,295 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Apache Maven Wrapper startup batch script, version 3.3.4
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
|
||||
# MVNW_REPOURL - repo url base for downloading maven distribution
|
||||
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
||||
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
set -euf
|
||||
[ "${MVNW_VERBOSE-}" != debug ] || set -x
|
||||
|
||||
# OS specific support.
|
||||
native_path() { printf %s\\n "$1"; }
|
||||
case "$(uname)" in
|
||||
CYGWIN* | MINGW*)
|
||||
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
|
||||
native_path() { cygpath --path --windows "$1"; }
|
||||
;;
|
||||
esac
|
||||
|
||||
# set JAVACMD and JAVACCMD
|
||||
set_java_home() {
|
||||
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
|
||||
if [ -n "${JAVA_HOME-}" ]; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACCMD="$JAVA_HOME/jre/sh/javac"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACCMD="$JAVA_HOME/bin/javac"
|
||||
|
||||
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
|
||||
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
|
||||
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
JAVACMD="$(
|
||||
'set' +e
|
||||
'unset' -f command 2>/dev/null
|
||||
'command' -v java
|
||||
)" || :
|
||||
JAVACCMD="$(
|
||||
'set' +e
|
||||
'unset' -f command 2>/dev/null
|
||||
'command' -v javac
|
||||
)" || :
|
||||
|
||||
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
|
||||
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# hash string like Java String::hashCode
|
||||
hash_string() {
|
||||
str="${1:-}" h=0
|
||||
while [ -n "$str" ]; do
|
||||
char="${str%"${str#?}"}"
|
||||
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
|
||||
str="${str#?}"
|
||||
done
|
||||
printf %x\\n $h
|
||||
}
|
||||
|
||||
verbose() { :; }
|
||||
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
|
||||
|
||||
die() {
|
||||
printf %s\\n "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
trim() {
|
||||
# MWRAPPER-139:
|
||||
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
|
||||
# Needed for removing poorly interpreted newline sequences when running in more
|
||||
# exotic environments such as mingw bash on Windows.
|
||||
printf "%s" "${1}" | tr -d '[:space:]'
|
||||
}
|
||||
|
||||
scriptDir="$(dirname "$0")"
|
||||
scriptName="$(basename "$0")"
|
||||
|
||||
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
|
||||
while IFS="=" read -r key value; do
|
||||
case "${key-}" in
|
||||
distributionUrl) distributionUrl=$(trim "${value-}") ;;
|
||||
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
|
||||
esac
|
||||
done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||
|
||||
case "${distributionUrl##*/}" in
|
||||
maven-mvnd-*bin.*)
|
||||
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
|
||||
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
|
||||
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
|
||||
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
|
||||
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
|
||||
:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
|
||||
*)
|
||||
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
|
||||
distributionPlatform=linux-amd64
|
||||
;;
|
||||
esac
|
||||
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
|
||||
;;
|
||||
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
|
||||
*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
|
||||
esac
|
||||
|
||||
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
||||
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
||||
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
|
||||
distributionUrlName="${distributionUrl##*/}"
|
||||
distributionUrlNameMain="${distributionUrlName%.*}"
|
||||
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
|
||||
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
|
||||
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
|
||||
|
||||
exec_maven() {
|
||||
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
|
||||
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
|
||||
}
|
||||
|
||||
if [ -d "$MAVEN_HOME" ]; then
|
||||
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
||||
exec_maven "$@"
|
||||
fi
|
||||
|
||||
case "${distributionUrl-}" in
|
||||
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
|
||||
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
|
||||
esac
|
||||
|
||||
# prepare tmp dir
|
||||
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
|
||||
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
|
||||
trap clean HUP INT TERM EXIT
|
||||
else
|
||||
die "cannot create temp dir"
|
||||
fi
|
||||
|
||||
mkdir -p -- "${MAVEN_HOME%/*}"
|
||||
|
||||
# Download and Install Apache Maven
|
||||
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
||||
verbose "Downloading from: $distributionUrl"
|
||||
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||
|
||||
# select .zip or .tar.gz
|
||||
if ! command -v unzip >/dev/null; then
|
||||
distributionUrl="${distributionUrl%.zip}.tar.gz"
|
||||
distributionUrlName="${distributionUrl##*/}"
|
||||
fi
|
||||
|
||||
# verbose opt
|
||||
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
|
||||
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
|
||||
|
||||
# normalize http auth
|
||||
case "${MVNW_PASSWORD:+has-password}" in
|
||||
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
||||
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
||||
esac
|
||||
|
||||
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
|
||||
verbose "Found wget ... using wget"
|
||||
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
|
||||
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
|
||||
verbose "Found curl ... using curl"
|
||||
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
|
||||
elif set_java_home; then
|
||||
verbose "Falling back to use Java to download"
|
||||
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
|
||||
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||
cat >"$javaSource" <<-END
|
||||
public class Downloader extends java.net.Authenticator
|
||||
{
|
||||
protected java.net.PasswordAuthentication getPasswordAuthentication()
|
||||
{
|
||||
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
|
||||
}
|
||||
public static void main( String[] args ) throws Exception
|
||||
{
|
||||
setDefault( new Downloader() );
|
||||
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
|
||||
}
|
||||
}
|
||||
END
|
||||
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
|
||||
verbose " - Compiling Downloader.java ..."
|
||||
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
|
||||
verbose " - Running Downloader.java ..."
|
||||
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
|
||||
fi
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
||||
if [ -n "${distributionSha256Sum-}" ]; then
|
||||
distributionSha256Result=false
|
||||
if [ "$MVN_CMD" = mvnd.sh ]; then
|
||||
echo "Checksum validation is not supported for maven-mvnd." >&2
|
||||
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
||||
exit 1
|
||||
elif command -v sha256sum >/dev/null; then
|
||||
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then
|
||||
distributionSha256Result=true
|
||||
fi
|
||||
elif command -v shasum >/dev/null; then
|
||||
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
|
||||
distributionSha256Result=true
|
||||
fi
|
||||
else
|
||||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
|
||||
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ $distributionSha256Result = false ]; then
|
||||
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
|
||||
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# unzip and move
|
||||
if command -v unzip >/dev/null; then
|
||||
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
|
||||
else
|
||||
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
|
||||
fi
|
||||
|
||||
# Find the actual extracted directory name (handles snapshots where filename != directory name)
|
||||
actualDistributionDir=""
|
||||
|
||||
# First try the expected directory name (for regular distributions)
|
||||
if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then
|
||||
if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then
|
||||
actualDistributionDir="$distributionUrlNameMain"
|
||||
fi
|
||||
fi
|
||||
|
||||
# If not found, search for any directory with the Maven executable (for snapshots)
|
||||
if [ -z "$actualDistributionDir" ]; then
|
||||
# enable globbing to iterate over items
|
||||
set +f
|
||||
for dir in "$TMP_DOWNLOAD_DIR"/*; do
|
||||
if [ -d "$dir" ]; then
|
||||
if [ -f "$dir/bin/$MVN_CMD" ]; then
|
||||
actualDistributionDir="$(basename "$dir")"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
set -f
|
||||
fi
|
||||
|
||||
if [ -z "$actualDistributionDir" ]; then
|
||||
verbose "Contents of $TMP_DOWNLOAD_DIR:"
|
||||
verbose "$(ls -la "$TMP_DOWNLOAD_DIR")"
|
||||
die "Could not find Maven distribution directory in extracted archive"
|
||||
fi
|
||||
|
||||
verbose "Found extracted Maven distribution directory: $actualDistributionDir"
|
||||
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
|
||||
mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
|
||||
|
||||
clean || :
|
||||
exec_maven "$@"
|
||||
189
language/mvnw.cmd
vendored
Normal file
189
language/mvnw.cmd
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
<# : batch portion
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Apache Maven Wrapper startup batch script, version 3.3.4
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM MVNW_REPOURL - repo url base for downloading maven distribution
|
||||
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
||||
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
|
||||
@SET __MVNW_CMD__=
|
||||
@SET __MVNW_ERROR__=
|
||||
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
|
||||
@SET PSModulePath=
|
||||
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
|
||||
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
|
||||
)
|
||||
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
|
||||
@SET __MVNW_PSMODULEP_SAVE=
|
||||
@SET __MVNW_ARG0_NAME__=
|
||||
@SET MVNW_USERNAME=
|
||||
@SET MVNW_PASSWORD=
|
||||
@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
|
||||
@echo Cannot start maven from wrapper >&2 && exit /b 1
|
||||
@GOTO :EOF
|
||||
: end batch / begin powershell #>
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
if ($env:MVNW_VERBOSE -eq "true") {
|
||||
$VerbosePreference = "Continue"
|
||||
}
|
||||
|
||||
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
|
||||
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
|
||||
if (!$distributionUrl) {
|
||||
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||
}
|
||||
|
||||
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
|
||||
"maven-mvnd-*" {
|
||||
$USE_MVND = $true
|
||||
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
|
||||
$MVN_CMD = "mvnd.cmd"
|
||||
break
|
||||
}
|
||||
default {
|
||||
$USE_MVND = $false
|
||||
$MVN_CMD = $script -replace '^mvnw','mvn'
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
||||
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
||||
if ($env:MVNW_REPOURL) {
|
||||
$MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
|
||||
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
|
||||
}
|
||||
$distributionUrlName = $distributionUrl -replace '^.*/',''
|
||||
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
|
||||
|
||||
$MAVEN_M2_PATH = "$HOME/.m2"
|
||||
if ($env:MAVEN_USER_HOME) {
|
||||
$MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
|
||||
New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
|
||||
}
|
||||
|
||||
$MAVEN_WRAPPER_DISTS = $null
|
||||
if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
|
||||
$MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
|
||||
} else {
|
||||
$MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
|
||||
}
|
||||
|
||||
$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
|
||||
$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
|
||||
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
|
||||
|
||||
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
|
||||
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
||||
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
||||
exit $?
|
||||
}
|
||||
|
||||
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
|
||||
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
|
||||
}
|
||||
|
||||
# prepare tmp dir
|
||||
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
|
||||
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
|
||||
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
|
||||
trap {
|
||||
if ($TMP_DOWNLOAD_DIR.Exists) {
|
||||
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
||||
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
||||
}
|
||||
}
|
||||
|
||||
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
|
||||
|
||||
# Download and Install Apache Maven
|
||||
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
||||
Write-Verbose "Downloading from: $distributionUrl"
|
||||
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||
|
||||
$webclient = New-Object System.Net.WebClient
|
||||
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
|
||||
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
|
||||
}
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
||||
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
|
||||
if ($distributionSha256Sum) {
|
||||
if ($USE_MVND) {
|
||||
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
|
||||
}
|
||||
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
|
||||
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
|
||||
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
|
||||
}
|
||||
}
|
||||
|
||||
# unzip and move
|
||||
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
|
||||
|
||||
# Find the actual extracted directory name (handles snapshots where filename != directory name)
|
||||
$actualDistributionDir = ""
|
||||
|
||||
# First try the expected directory name (for regular distributions)
|
||||
$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
|
||||
$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
|
||||
if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
|
||||
$actualDistributionDir = $distributionUrlNameMain
|
||||
}
|
||||
|
||||
# If not found, search for any directory with the Maven executable (for snapshots)
|
||||
if (!$actualDistributionDir) {
|
||||
Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
|
||||
$testPath = Join-Path $_.FullName "bin/$MVN_CMD"
|
||||
if (Test-Path -Path $testPath -PathType Leaf) {
|
||||
$actualDistributionDir = $_.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$actualDistributionDir) {
|
||||
Write-Error "Could not find Maven distribution directory in extracted archive"
|
||||
}
|
||||
|
||||
Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
|
||||
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
|
||||
try {
|
||||
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
|
||||
} catch {
|
||||
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
|
||||
Write-Error "fail to move MAVEN_HOME"
|
||||
}
|
||||
} finally {
|
||||
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
||||
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
||||
}
|
||||
|
||||
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
||||
96
language/pom.xml
Normal file
96
language/pom.xml
Normal file
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>nl.sdk</groupId>
|
||||
<artifactId>sdk-all</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>nl.sdk</groupId>
|
||||
<artifactId>language</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>language</name>
|
||||
<description>language SDK</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<java.version>8</java.version>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<fastjson.version>1.2.83</fastjson.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring Boot 依赖使用 provided scope,由使用方提供 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- FastJSON 使用 compile scope,打包到 SDK 中 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 测试依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>org/nl/**</include>
|
||||
<include>application.properties</include>
|
||||
<include>language.i18n</include>
|
||||
<include>**/*.i18n</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<!-- 资源文件配置 -->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
11
language/src/main/java/org/nl/LanguageApplication.java
Normal file
11
language/src/main/java/org/nl/LanguageApplication.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package org.nl;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class LanguageApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(LanguageApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.common;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
* 统一异常处理
|
||||
*/
|
||||
public class BadLanguageException extends RuntimeException{
|
||||
|
||||
private Integer status = BAD_REQUEST.value();
|
||||
|
||||
public BadLanguageException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public BadLanguageException(HttpStatus status, String msg){
|
||||
super(msg);
|
||||
this.status = status.value();
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
113
language/src/main/java/org/nl/common/DataCanvers.java
Normal file
113
language/src/main/java/org/nl/common/DataCanvers.java
Normal file
@@ -0,0 +1,113 @@
|
||||
package org.nl.common;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表格分页数据对象
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
public class DataCanvers<T> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 总记录数
|
||||
*/
|
||||
private long totalElements;
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
private Object content;
|
||||
|
||||
/**
|
||||
* 消息状态码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param list 列表数据
|
||||
* @param total 总记录数
|
||||
*/
|
||||
public DataCanvers(List<T> list, long total) {
|
||||
this.content = list;
|
||||
this.totalElements = total;
|
||||
}
|
||||
|
||||
|
||||
public static DataCanvers buildList(List list) {
|
||||
DataCanvers rspData = new DataCanvers<>();
|
||||
rspData.setCode(String.valueOf(HttpStatus.OK.value()));
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setContent(list);
|
||||
rspData.setTotalElements(list.size());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
public static <T> DataCanvers<T> build() {
|
||||
DataCanvers<T> rspData = new DataCanvers<>();
|
||||
rspData.setCode(String.valueOf(HttpStatus.OK.value()));
|
||||
rspData.setMsg("查询成功");
|
||||
return rspData;
|
||||
}
|
||||
|
||||
public static <T> DataCanvers<T> buildJson(Object result) {
|
||||
DataCanvers<T> rspData = new DataCanvers<>();
|
||||
rspData.setCode(String.valueOf(HttpStatus.OK.value()));
|
||||
rspData.setContent(result);
|
||||
rspData.setMsg("操作成功");
|
||||
return rspData;
|
||||
}
|
||||
|
||||
public long getTotalElements() {
|
||||
return totalElements;
|
||||
}
|
||||
|
||||
public void setTotalElements(long totalElements) {
|
||||
this.totalElements = totalElements;
|
||||
}
|
||||
|
||||
public Object getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(Object content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public DataCanvers() {
|
||||
this.totalElements = totalElements;
|
||||
}
|
||||
|
||||
public DataCanvers(long totalElements, Object content, String code, String msg) {
|
||||
this.totalElements = totalElements;
|
||||
this.content = content;
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
139
language/src/main/java/org/nl/common/HttpStatus.java
Normal file
139
language/src/main/java/org/nl/common/HttpStatus.java
Normal file
@@ -0,0 +1,139 @@
|
||||
package org.nl.common;
|
||||
|
||||
public enum HttpStatus {
|
||||
CONTINUE(100, org.springframework.http.HttpStatus.Series.INFORMATIONAL, "Continue"),
|
||||
SWITCHING_PROTOCOLS(101, org.springframework.http.HttpStatus.Series.INFORMATIONAL, "Switching Protocols"),
|
||||
PROCESSING(102, org.springframework.http.HttpStatus.Series.INFORMATIONAL, "Processing"),
|
||||
CHECKPOINT(103, org.springframework.http.HttpStatus.Series.INFORMATIONAL, "Checkpoint"),
|
||||
OK(200, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "OK"),
|
||||
CREATED(201, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "Created"),
|
||||
ACCEPTED(202, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "Accepted"),
|
||||
NON_AUTHORITATIVE_INFORMATION(203, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "Non-Authoritative Information"),
|
||||
NO_CONTENT(204, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "No Content"),
|
||||
RESET_CONTENT(205, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "Reset Content"),
|
||||
PARTIAL_CONTENT(206, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "Partial Content"),
|
||||
MULTI_STATUS(207, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "Multi-Status"),
|
||||
ALREADY_REPORTED(208, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "Already Reported"),
|
||||
IM_USED(226, org.springframework.http.HttpStatus.Series.SUCCESSFUL, "IM Used"),
|
||||
MULTIPLE_CHOICES(300, org.springframework.http.HttpStatus.Series.REDIRECTION, "Multiple Choices"),
|
||||
MOVED_PERMANENTLY(301, org.springframework.http.HttpStatus.Series.REDIRECTION, "Moved Permanently"),
|
||||
FOUND(302, org.springframework.http.HttpStatus.Series.REDIRECTION, "Found"),
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
MOVED_TEMPORARILY(302, org.springframework.http.HttpStatus.Series.REDIRECTION, "Moved Temporarily"),
|
||||
SEE_OTHER(303, org.springframework.http.HttpStatus.Series.REDIRECTION, "See Other"),
|
||||
NOT_MODIFIED(304, org.springframework.http.HttpStatus.Series.REDIRECTION, "Not Modified"),
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
USE_PROXY(305, org.springframework.http.HttpStatus.Series.REDIRECTION, "Use Proxy"),
|
||||
TEMPORARY_REDIRECT(307, org.springframework.http.HttpStatus.Series.REDIRECTION, "Temporary Redirect"),
|
||||
PERMANENT_REDIRECT(308, org.springframework.http.HttpStatus.Series.REDIRECTION, "Permanent Redirect"),
|
||||
BAD_REQUEST(400, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Bad Request"),
|
||||
UNAUTHORIZED(401, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Unauthorized"),
|
||||
PAYMENT_REQUIRED(402, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Payment Required"),
|
||||
FORBIDDEN(403, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Forbidden"),
|
||||
NOT_FOUND(404, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Not Found"),
|
||||
METHOD_NOT_ALLOWED(405, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Method Not Allowed"),
|
||||
NOT_ACCEPTABLE(406, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Not Acceptable"),
|
||||
PROXY_AUTHENTICATION_REQUIRED(407, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Proxy Authentication Required"),
|
||||
REQUEST_TIMEOUT(408, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Request Timeout"),
|
||||
CONFLICT(409, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Conflict"),
|
||||
GONE(410, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Gone"),
|
||||
LENGTH_REQUIRED(411, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Length Required"),
|
||||
PRECONDITION_FAILED(412, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Precondition Failed"),
|
||||
PAYLOAD_TOO_LARGE(413, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Payload Too Large"),
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
REQUEST_ENTITY_TOO_LARGE(413, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Request Entity Too Large"),
|
||||
URI_TOO_LONG(414, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "URI Too Long"),
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
REQUEST_URI_TOO_LONG(414, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Request-URI Too Long"),
|
||||
UNSUPPORTED_MEDIA_TYPE(415, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Unsupported Media Type"),
|
||||
REQUESTED_RANGE_NOT_SATISFIABLE(416, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Requested range not satisfiable"),
|
||||
EXPECTATION_FAILED(417, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Expectation Failed"),
|
||||
I_AM_A_TEAPOT(418, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "I'm a teapot"),
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
INSUFFICIENT_SPACE_ON_RESOURCE(419, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Insufficient Space On Resource"),
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
METHOD_FAILURE(420, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Method Failure"),
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
DESTINATION_LOCKED(421, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Destination Locked"),
|
||||
UNPROCESSABLE_ENTITY(422, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Unprocessable Entity"),
|
||||
LOCKED(423, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Locked"),
|
||||
FAILED_DEPENDENCY(424, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Failed Dependency"),
|
||||
TOO_EARLY(425, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Too Early"),
|
||||
UPGRADE_REQUIRED(426, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Upgrade Required"),
|
||||
PRECONDITION_REQUIRED(428, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Precondition Required"),
|
||||
TOO_MANY_REQUESTS(429, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Too Many Requests"),
|
||||
REQUEST_HEADER_FIELDS_TOO_LARGE(431, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Request Header Fields Too Large"),
|
||||
UNAVAILABLE_FOR_LEGAL_REASONS(451, org.springframework.http.HttpStatus.Series.CLIENT_ERROR, "Unavailable For Legal Reasons"),
|
||||
INTERNAL_SERVER_ERROR(500, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Internal Server Error"),
|
||||
NOT_IMPLEMENTED(501, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Not Implemented"),
|
||||
BAD_GATEWAY(502, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Bad Gateway"),
|
||||
SERVICE_UNAVAILABLE(503, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Service Unavailable"),
|
||||
GATEWAY_TIMEOUT(504, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Gateway Timeout"),
|
||||
HTTP_VERSION_NOT_SUPPORTED(505, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "HTTP Version not supported"),
|
||||
VARIANT_ALSO_NEGOTIATES(506, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Variant Also Negotiates"),
|
||||
INSUFFICIENT_STORAGE(507, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Insufficient Storage"),
|
||||
LOOP_DETECTED(508, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Loop Detected"),
|
||||
BANDWIDTH_LIMIT_EXCEEDED(509, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Bandwidth Limit Exceeded"),
|
||||
NOT_EXTENDED(510, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Not Extended"),
|
||||
NETWORK_AUTHENTICATION_REQUIRED(511, org.springframework.http.HttpStatus.Series.SERVER_ERROR, "Network Authentication Required");
|
||||
|
||||
private static final HttpStatus[] VALUES = values();
|
||||
private final int value;
|
||||
private final org.springframework.http.HttpStatus.Series series;
|
||||
private final String reasonPhrase;
|
||||
|
||||
private HttpStatus(int value, org.springframework.http.HttpStatus.Series series, String reasonPhrase) {
|
||||
this.value = value;
|
||||
this.series = series;
|
||||
this.reasonPhrase = reasonPhrase;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public org.springframework.http.HttpStatus.Series series() {
|
||||
return this.series;
|
||||
}
|
||||
|
||||
public String getReasonPhrase() {
|
||||
return this.reasonPhrase;
|
||||
}
|
||||
|
||||
public boolean is1xxInformational() {
|
||||
return this.series() == org.springframework.http.HttpStatus.Series.INFORMATIONAL;
|
||||
}
|
||||
|
||||
public boolean is2xxSuccessful() {
|
||||
return this.series() == org.springframework.http.HttpStatus.Series.SUCCESSFUL;
|
||||
}
|
||||
|
||||
public boolean is3xxRedirection() {
|
||||
return this.series() == org.springframework.http.HttpStatus.Series.REDIRECTION;
|
||||
}
|
||||
|
||||
public boolean is4xxClientError() {
|
||||
return this.series() == org.springframework.http.HttpStatus.Series.CLIENT_ERROR;
|
||||
}
|
||||
|
||||
public boolean is5xxServerError() {
|
||||
return this.series() == org.springframework.http.HttpStatus.Series.SERVER_ERROR;
|
||||
}
|
||||
|
||||
public boolean isError() {
|
||||
return this.is4xxClientError() || this.is5xxServerError();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.value + " " + this.name();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
36
language/src/main/java/org/nl/language/LangBehavior.java
Normal file
36
language/src/main/java/org/nl/language/LangBehavior.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package org.nl.language;
|
||||
|
||||
|
||||
import org.nl.language.engine.I18nManagerService;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class LangBehavior {
|
||||
public static I18nManagerService i18nManagerService;
|
||||
|
||||
/**
|
||||
* 不带从参数
|
||||
* @param key:common.paramException
|
||||
* @return
|
||||
*/
|
||||
public static String language(String key) {
|
||||
if(StringUtils.isEmpty(key)){
|
||||
return "";
|
||||
}
|
||||
return i18nManagerService.language(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带参数的解析
|
||||
* @param key:common.paramException
|
||||
* @param arg: 替换语言输出中的占位符:数据异常,${0}信息不存在
|
||||
* @return
|
||||
*/
|
||||
public static String language(String key, String...arg) {
|
||||
if(StringUtils.isEmpty(key)){
|
||||
return "";
|
||||
}
|
||||
String language = i18nManagerService.language(key);
|
||||
String format = String.format(language, arg);
|
||||
return format;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package org.nl.language.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.json.UTF8JsonGenerator;
|
||||
import org.nl.language.engine.I18nManagerService;
|
||||
import org.nl.common.BadLanguageException;
|
||||
import org.nl.common.DataCanvers;
|
||||
import org.nl.language.LangBehavior;
|
||||
import org.nl.language.engine.dto.LanguageDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/language")
|
||||
public class langController {
|
||||
|
||||
@Autowired
|
||||
private I18nManagerService i18nManagerService;
|
||||
|
||||
/**
|
||||
* 查询code对应结构
|
||||
* @param languageDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/structure")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> query(@RequestBody LanguageDto languageDto) {
|
||||
JSONObject langJs = i18nManagerService.langCache.get(languageDto.getLanguage());
|
||||
if (langJs ==null){
|
||||
throw new BadLanguageException(LangBehavior.language("system.dataExceptionArg",languageDto.getLanguage()));
|
||||
}
|
||||
Set<Map.Entry<String, Object>> entries = langJs.entrySet();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : entries) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String){
|
||||
if (key.equals(languageDto.getCode())){
|
||||
map.put(key,value);
|
||||
}
|
||||
}
|
||||
if (value instanceof JSONObject){
|
||||
keyRecursion(languageDto.getCode(),(JSONObject) value,key,map);
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(DataCanvers.buildJson(map), HttpStatus.OK);
|
||||
}
|
||||
|
||||
private void keyRecursion(String target,JSONObject langJs,String pKey,Map<String, Object> keyRecursion){
|
||||
Set<Map.Entry<String, Object>> entries = langJs.entrySet();
|
||||
for (Map.Entry<String, Object> entry : entries) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String){
|
||||
if (key.equals(target)){
|
||||
keyRecursion.put(pKey+"."+entry.getKey(),value);
|
||||
}
|
||||
}else if (value instanceof JSONObject){
|
||||
keyRecursion(target,(JSONObject) value,pKey+"."+entry.getKey(),keyRecursion);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询语言列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> query() {
|
||||
Set<String> langs = i18nManagerService.langCache.keySet();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
for (String lang : langs) {
|
||||
JSONObject langJs = i18nManagerService.langCache.get(lang);
|
||||
String language = langJs.getString("language");
|
||||
map.put(lang,language);
|
||||
}
|
||||
return new ResponseEntity<>(DataCanvers.buildJson(map), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/js/{filename}")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getFile(@PathVariable String filename) {
|
||||
JSONObject langJs = i18nManagerService.langCache.get(filename);
|
||||
return new ResponseEntity<>(DataCanvers.buildJson(langJs), HttpStatus.OK);
|
||||
|
||||
// return loadJsFile(filename);
|
||||
}
|
||||
|
||||
private ResponseEntity<Object> loadJsFile(String filename) {
|
||||
try {
|
||||
String jsPath = i18nManagerService.filePaths.get(filename);
|
||||
if (StringUtils.isEmpty(jsPath)){
|
||||
return ResponseEntity.badRequest().body("文件不存在");
|
||||
}
|
||||
Resource resource = i18nManagerService.getResource(jsPath);
|
||||
if (resource.exists() && resource.isReadable()) {
|
||||
return ResponseEntity.ok()
|
||||
//text/javascript
|
||||
.header(HttpHeaders.CONTENT_TYPE, "application/javascript; charset=utf-8")
|
||||
.body(resource);
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body("文件不存在");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package org.nl.language.engine;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.language.LangBehavior;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
@Service
|
||||
public class I18nManagerService implements InitializingBean, DisposableBean {
|
||||
private final I18nProperties properties;
|
||||
public final Map<String, JSONObject> langCache = new HashMap<>();
|
||||
public final Map<String, String> filePaths = new HashMap<>();
|
||||
private ScheduledExecutorService scheduler;
|
||||
|
||||
|
||||
public I18nManagerService(I18nProperties properties) {
|
||||
System.out.println("I18nManagerService开始加载"+properties.toString());
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
// 加载所有语言文件
|
||||
for (String lang : properties.getSupportedLanguages()) {
|
||||
loadLangFile(lang);
|
||||
}
|
||||
LangBehavior.i18nManagerService = this;
|
||||
}
|
||||
// 以下为原有方法(保持不变)
|
||||
private void loadLangFile(String lang) throws IOException {
|
||||
String fileName = lang + ".js";
|
||||
String fullPath = properties.getLocation() + fileName;
|
||||
Resource resource = getResource(fullPath);
|
||||
if (!resource.exists() && properties.isFallbackToClasspath()) {
|
||||
resource = new ClassPathResource("language/i18n/" + fileName);
|
||||
fullPath = "classpath:language/i18n/" + fileName;
|
||||
System.out.println("文件名"+resource.getFilename());
|
||||
}
|
||||
if (!resource.exists()) {
|
||||
throw new IOException("Language file not found: " + fullPath);
|
||||
} else {
|
||||
InputStream inputStream = resource.getInputStream();
|
||||
byte[] bytes = FileCopyUtils.copyToByteArray(inputStream);
|
||||
String content = new String(bytes, StandardCharsets.UTF_8);
|
||||
String jsonStr = content.replace("var config = ", "").trim();
|
||||
JSONObject config = JSON.parseObject(jsonStr);
|
||||
this.langCache.put(lang, config);
|
||||
this.filePaths.put(lang, fullPath);
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
public Resource getResource(String path) {
|
||||
System.out.println("文件加载路径"+path);
|
||||
if (path.startsWith("file:")) {
|
||||
return new FileSystemResource(path.substring("file:".length()));
|
||||
} else if (path.startsWith("classpath:")) {
|
||||
return new ClassPathResource(path.substring("classpath:".length()));
|
||||
} else {
|
||||
return new FileSystemResource(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String language(String key) {
|
||||
String lang = LangContextHolder.getLangOrDefault();
|
||||
JSONObject config = langCache.get(lang);
|
||||
if (config == null) {
|
||||
return "";
|
||||
}
|
||||
String[] keyParts = key.split("\\.");
|
||||
JSONObject current = config;
|
||||
for (int i = 0; i < keyParts.length; i++) {
|
||||
if (i == keyParts.length - 1) {
|
||||
return StringUtils.isEmpty(current.getString(keyParts[i])) ? key : current.getString(keyParts[i]);
|
||||
}
|
||||
current = current.getJSONObject(keyParts[i]);
|
||||
if (current == null) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
langCache.clear();
|
||||
filePaths.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.nl.language.engine;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "i18n")
|
||||
public class I18nProperties {
|
||||
// 语言文件存放路径,可以是外部路径或classpath
|
||||
private String location = "C:\\i18n\\";
|
||||
// 热更新检查间隔(秒)
|
||||
private long refreshInterval = 60;
|
||||
// 支持的语言列表
|
||||
private List<String> supportedLanguages;
|
||||
// 当外部文件不存在时,是否回退到classpath中的默认文件
|
||||
private boolean fallbackToClasspath = true;
|
||||
|
||||
// getter和setter方法
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public long getRefreshInterval() {
|
||||
return refreshInterval;
|
||||
}
|
||||
|
||||
public void setRefreshInterval(long refreshInterval) {
|
||||
this.refreshInterval = refreshInterval;
|
||||
}
|
||||
|
||||
public List<String> getSupportedLanguages() {
|
||||
return supportedLanguages;
|
||||
}
|
||||
|
||||
public void setSupportedLanguages(List<String> supportedLanguages) {
|
||||
this.supportedLanguages = supportedLanguages;
|
||||
}
|
||||
|
||||
public boolean isFallbackToClasspath() {
|
||||
return fallbackToClasspath;
|
||||
}
|
||||
|
||||
public void setFallbackToClasspath(boolean fallbackToClasspath) {
|
||||
this.fallbackToClasspath = fallbackToClasspath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "I18nProperties{" +
|
||||
"location='" + location + '\'' +
|
||||
", refreshInterval=" + refreshInterval +
|
||||
", supportedLanguages=" + supportedLanguages +
|
||||
", fallbackToClasspath=" + fallbackToClasspath +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.nl.language.engine;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class LangContextHolder {
|
||||
// 线程本地变量,存储当前线程的语言标识
|
||||
private static final ThreadLocal<String> LANG_HOLDER = new ThreadLocal<>();
|
||||
|
||||
// 设置当前线程的语言
|
||||
public static void setLang(String lang) {
|
||||
LANG_HOLDER.set(lang);
|
||||
}
|
||||
|
||||
// 默认语言(从配置中获取)
|
||||
public static String defaultLang = "zh";
|
||||
// 获取当前线程的语言
|
||||
public static String getLang() {
|
||||
return LANG_HOLDER.get();
|
||||
}
|
||||
|
||||
// 清除当前线程的语言设置(防止内存泄漏)
|
||||
public static void clear() {
|
||||
LANG_HOLDER.remove();
|
||||
}
|
||||
|
||||
// 获取当前语言,如果未设置则返回默认语言
|
||||
public static String getLangOrDefault() {
|
||||
String lang = getLang();
|
||||
return StringUtils.hasText(lang) ? lang : defaultLang;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.nl.language.engine;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Component
|
||||
public class LangInterceptor implements HandlerInterceptor {
|
||||
|
||||
// 支持的语言列表(实际项目中可从配置获取)
|
||||
private final I18nProperties properties;
|
||||
|
||||
public LangInterceptor(I18nProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
// 1. 从请求参数获取语言(如 ?lang=zh)
|
||||
String lang = request.getParameter("lang");
|
||||
|
||||
// 2. 如果参数不存在,可从Header获取(如 Accept-Language)
|
||||
if (lang == null || lang.isEmpty()) {
|
||||
lang = request.getHeader("Accept-Language");
|
||||
// 简单处理,只取前两位(如 zh-CN -> zh)
|
||||
if (lang != null && lang.length() >= 2) {
|
||||
lang = lang.substring(0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 验证语言是否在支持的列表中
|
||||
if (lang != null && properties.getSupportedLanguages().contains(lang)) {
|
||||
LangContextHolder.setLang(lang);
|
||||
} else {
|
||||
// 不支持的语言使用默认语言
|
||||
LangContextHolder.setLang("zh");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler, Exception ex) {
|
||||
// 清除线程变量,防止内存泄漏
|
||||
LangContextHolder.clear();
|
||||
}
|
||||
}
|
||||
21
language/src/main/java/org/nl/language/engine/WebConfig.java
Normal file
21
language/src/main/java/org/nl/language/engine/WebConfig.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package org.nl.language.engine;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
private final LangInterceptor langInterceptor;
|
||||
|
||||
public WebConfig(LangInterceptor langInterceptor) {
|
||||
this.langInterceptor = langInterceptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 对所有请求生效
|
||||
registry.addInterceptor(langInterceptor).addPathPatterns("/**");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.language.engine.dto;
|
||||
|
||||
|
||||
public class LanguageDto {
|
||||
|
||||
private String code;
|
||||
private String language;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
}
|
||||
6
language/src/main/resources/application.properties
Normal file
6
language/src/main/resources/application.properties
Normal file
@@ -0,0 +1,6 @@
|
||||
spring.application.name=language
|
||||
server.port=8081
|
||||
i18n.location=file:F:/i18n
|
||||
i18n.supported-languages=zh,en,vi,jp
|
||||
i18n.fallback-to-classpath=true
|
||||
fallback-to-classpath: true
|
||||
133
language/src/main/resources/language/i18n/en.js
Normal file
133
language/src/main/resources/language/i18n/en.js
Normal file
@@ -0,0 +1,133 @@
|
||||
var config = {
|
||||
'lang': 'zh',
|
||||
'platform': {
|
||||
'title': 'Fujia WMS',
|
||||
'tip1': 'Username cannot be empty',
|
||||
'tip2': 'Password cannot be empty',
|
||||
'tip3': 'Verification code cannot be empty'
|
||||
},
|
||||
'common': {
|
||||
'home': 'Home',
|
||||
'Layout_setting': 'Layout Settings',
|
||||
'Personal_center': 'Personal Center',
|
||||
'Log_out': 'Log Out',
|
||||
'Personal_information': 'Personal Information',
|
||||
'username': 'Username',
|
||||
'name': 'Name',
|
||||
'phone': 'Mobile Number',
|
||||
'phone2': 'Phone Number',
|
||||
'sex': 'Gender',
|
||||
'sex_male': 'Male',
|
||||
'sex_female': 'Female',
|
||||
'email': 'Email',
|
||||
'Security_settings': 'Security Settings',
|
||||
'Save_settings': 'Save Settings',
|
||||
'Reset_settings': 'Reset Settings',
|
||||
'Change_password': 'Change Password',
|
||||
'New_password': 'New Password',
|
||||
'Old_password': 'Old Password',
|
||||
'Verify_password': 'Confirm Password',
|
||||
'User_information': 'User Profile',
|
||||
'Operation_log': 'Operation Log',
|
||||
'action': 'Action',
|
||||
'IP_source': 'IP Source',
|
||||
'Browser': 'Browser',
|
||||
'Request_time': 'Request Time',
|
||||
'Creation_date': 'Creation Date',
|
||||
'account': 'Account',
|
||||
'password': 'Password',
|
||||
'verification_code': 'Verification Code',
|
||||
'login_rm': 'Remember Me',
|
||||
'login': 'Login',
|
||||
'login_ing': 'Logging in...',
|
||||
'Create': 'Add',
|
||||
'Update': 'Edit',
|
||||
'Delete': 'Delete',
|
||||
'More': 'More',
|
||||
'Export': 'Export',
|
||||
'Editors': 'Edit',
|
||||
'SelectAll': 'Select All',
|
||||
'Query': 'Query',
|
||||
'Reset': 'Reset',
|
||||
'Confirm': 'Confirm',
|
||||
'Cancel': 'Cancel',
|
||||
'Yes': 'Yes',
|
||||
'No': 'No',
|
||||
'Success': 'Success',
|
||||
'Fail': 'Fail',
|
||||
'Please_select': 'Please Select',
|
||||
'Operation_success': 'Operation Successful',
|
||||
'Upload_success': 'Upload Successful',
|
||||
'Operate': 'Operation',
|
||||
'Refresh': 'Refresh',
|
||||
'Closes': 'Close',
|
||||
'Closes_l': 'Close Left',
|
||||
'Closes_r': 'Close Right',
|
||||
'Closes_o': 'Close Others',
|
||||
'Closes_a': 'Close All',
|
||||
'Theme_style_setting': 'Theme Style Settings',
|
||||
'Theme_color': 'Theme Color',
|
||||
'System_layout_configuration': 'System Layout Configuration',
|
||||
'Open': 'Open',
|
||||
'Fixation': 'Fixed',
|
||||
'Display': 'Display',
|
||||
'Dynamic_titles': 'Dynamic Titles',
|
||||
'crudTip': 'Are you sure you want to delete this data?',
|
||||
'startDate': 'Start Date',
|
||||
'endDate': 'End Date',
|
||||
'moreMenu': 'More Menu',
|
||||
'browses': 'Browse',
|
||||
'fz': 'Full Screen Zoom',
|
||||
'submit': 'Submitted Successfully',
|
||||
'add': 'Added Successfully',
|
||||
'edit': 'Edited Successfully',
|
||||
'del': 'Deleted Successfully',
|
||||
'close': 'Confirm Close',
|
||||
'save': 'Saved Successfully',
|
||||
'datas': 'Data',
|
||||
'Tips': 'Tips',
|
||||
'Tip1': 'Confirm deletion of selected {count} data entries?',
|
||||
'Tip3': 'Username is not used for login',
|
||||
'Tip4': 'Mobile number cannot be duplicated',
|
||||
'Tip5': 'Please enter phone number',
|
||||
'Tip6': 'Please enter a valid 11-digit mobile number',
|
||||
'Tip7': 'Drag excel file here or',
|
||||
'Tip8': 'The two passwords entered do not match',
|
||||
'Tip9': 'Please enter password again',
|
||||
'Tip10': 'Please enter old password',
|
||||
'Tip11': 'Please enter new password',
|
||||
'Tip12': 'Length should be between {min} and {max} characters',
|
||||
'Tip13': 'Are you sure to log out and exit the system?',
|
||||
'Tip14': 'WebSocket connection error occurred',
|
||||
'Tip15': 'Please enter icon name',
|
||||
'Tip16': 'Cannot be empty',
|
||||
'Tip17': 'Please enter what you want to search for',
|
||||
'loading': 'Data loading...',
|
||||
'Tip18': 'Select date and time',
|
||||
'Tip19': 'Are you sure you want to delete the selected data?',
|
||||
'Tip20': 'Current login status has expired, please log in again!'
|
||||
},
|
||||
'WorkOrder': {
|
||||
'form': {
|
||||
'WorkOrderCode': 'Work Order Code'
|
||||
},
|
||||
'placeholder': {
|
||||
'WorkOrderCode': 'Please enter work order code'
|
||||
}
|
||||
},
|
||||
'monitor': {
|
||||
'sys': 'System',
|
||||
'day': 'Project has been running continuously for',
|
||||
'status': 'Status',
|
||||
'cpu': 'CPU Usage',
|
||||
'core': 'Core',
|
||||
'memory': 'Memory Usage',
|
||||
'tality': 'Total',
|
||||
'used': 'Used',
|
||||
'leisure': 'Free',
|
||||
'exchange': 'Swap Usage',
|
||||
'disk': 'Disk Usage',
|
||||
'cpu_monitoring': 'CPU Usage Monitoring',
|
||||
'memory_monitoring': 'Memory Usage Monitoring'
|
||||
}
|
||||
}
|
||||
133
language/src/main/resources/language/i18n/jp.js
Normal file
133
language/src/main/resources/language/i18n/jp.js
Normal file
@@ -0,0 +1,133 @@
|
||||
var config = {
|
||||
'lang': 'zh',
|
||||
'platform': {
|
||||
'title': '富佳WMS',
|
||||
'tip1': 'ユーザー名は必須です',
|
||||
'tip2': 'パスワードは必須です',
|
||||
'tip3': '認証コードは必須です'
|
||||
},
|
||||
'common': {
|
||||
'home': 'ホーム',
|
||||
'Layout_setting': 'レイアウト設定',
|
||||
'Personal_center': '個人センター',
|
||||
'Log_out': 'ログアウト',
|
||||
'Personal_information': '個人情報',
|
||||
'username': 'ユーザー名',
|
||||
'name': '氏名',
|
||||
'phone': '携帯番号',
|
||||
'phone2': '電話番号',
|
||||
'sex': '性別',
|
||||
'sex_male': '男性',
|
||||
'sex_female': '女性',
|
||||
'email': 'メールアドレス',
|
||||
'Security_settings': 'セキュリティ設定',
|
||||
'Save_settings': '設定を保存',
|
||||
'Reset_settings': '設定をリセット',
|
||||
'Change_password': 'パスワード変更',
|
||||
'New_password': '新しいパスワード',
|
||||
'Old_password': '旧パスワード',
|
||||
'Verify_password': 'パスワード確認',
|
||||
'User_information': 'ユーザー情報',
|
||||
'Operation_log': '操作ログ',
|
||||
'action': '操作',
|
||||
'IP_source': 'IPソース',
|
||||
'Browser': 'ブラウザ',
|
||||
'Request_time': 'リクエスト時間',
|
||||
'Creation_date': '作成日',
|
||||
'account': 'アカウント',
|
||||
'password': 'パスワード',
|
||||
'verification_code': '認証コード',
|
||||
'login_rm': 'ログイン状態を保持',
|
||||
'login': 'ログイン',
|
||||
'login_ing': 'ログイン中...',
|
||||
'Create': '新規追加',
|
||||
'Update': '編集',
|
||||
'Delete': '削除',
|
||||
'More': '詳細',
|
||||
'Export': 'エクスポート',
|
||||
'Editors': '編集',
|
||||
'SelectAll': 'すべて選択',
|
||||
'Query': '検索',
|
||||
'Reset': 'リセット',
|
||||
'Confirm': '確認',
|
||||
'Cancel': 'キャンセル',
|
||||
'Yes': 'はい',
|
||||
'No': 'いいえ',
|
||||
'Success': '成功',
|
||||
'Fail': '失敗',
|
||||
'Please_select': '選択してください',
|
||||
'Operation_success': '操作成功',
|
||||
'Upload_success': 'アップロード成功',
|
||||
'Operate': '操作',
|
||||
'Refresh': '更新',
|
||||
'Closes': '閉じる',
|
||||
'Closes_l': '左を閉じる',
|
||||
'Closes_r': '右を閉じる',
|
||||
'Closes_o': '他を閉じる',
|
||||
'Closes_a': 'すべて閉じる',
|
||||
'Theme_style_setting': 'テーマスタイル設定',
|
||||
'Theme_color': 'テーマカラー',
|
||||
'System_layout_configuration': 'システムレイアウト設定',
|
||||
'Open': '开启',
|
||||
'Fixation': '固定',
|
||||
'Display': '表示',
|
||||
'Dynamic_titles': '动态标题',
|
||||
'crudTip': 'このデータを削除してもよろしいですか?',
|
||||
'startDate': '開始日',
|
||||
'endDate': '終了日',
|
||||
'moreMenu': '詳細メニュー',
|
||||
'browses': '閲覧',
|
||||
'fz': '全画面ズーム',
|
||||
'submit': '送信成功',
|
||||
'add': '追加成功',
|
||||
'edit': '編集成功',
|
||||
'del': '削除成功',
|
||||
'close': '閉じる確認',
|
||||
'save': '保存成功',
|
||||
'datas': 'データ',
|
||||
'Tips': 'ヒント',
|
||||
'Tip1': '選択した{count}件のデータを削除してもよろしいですか?',
|
||||
'Tip3': 'ユーザー名はログインに使用されません',
|
||||
'Tip4': '携帯番号は重複できません',
|
||||
'Tip5': '電話番号を入力してください',
|
||||
'Tip6': '正しい11桁の携帯番号を入力してください',
|
||||
'Tip7': 'Excelファイルをここにドラッグ または',
|
||||
'Tip8': '入力した2つのパスワードが一致しません',
|
||||
'Tip9': 'パスワードを再度入力してください',
|
||||
'Tip10': '旧パスワードを入力してください',
|
||||
'Tip11': '新しいパスワードを入力してください',
|
||||
'Tip12': '長さは{min}から{max}文字の間でなければなりません',
|
||||
'Tip13': 'ログアウトしてシステムを終了してもよろしいですか?',
|
||||
'Tip14': 'WebSocket接続でエラーが発生しました',
|
||||
'Tip15': 'アイコン名を入力してください',
|
||||
'Tip16': '必須項目です',
|
||||
'Tip17': '検索内容を入力してください',
|
||||
'loading': 'データ読み込み中...',
|
||||
'Tip18': '日時を選択',
|
||||
'Tip19': '選択したデータを削除してもよろしいですか?',
|
||||
'Tip20': '現在のログイン状態は期限切れです。再ログインしてください!'
|
||||
},
|
||||
'WorkOrder': {
|
||||
'form': {
|
||||
'WorkOrderCode': '作業指示コード'
|
||||
},
|
||||
'placeholder': {
|
||||
'WorkOrderCode': '作業指示コードを入力してください'
|
||||
}
|
||||
},
|
||||
'monitor': {
|
||||
'sys': 'システム',
|
||||
'day': 'プロジェクトが連続運転中',
|
||||
'status': '状態',
|
||||
'cpu': 'CPU使用率',
|
||||
'core': 'コア',
|
||||
'memory': 'メモリ使用率',
|
||||
'tality': '合計',
|
||||
'used': '使用済み',
|
||||
'leisure': '空き',
|
||||
'exchange': 'スワップ使用率',
|
||||
'disk': 'ディスク使用率',
|
||||
'cpu_monitoring': 'CPU使用率モニタリング',
|
||||
'memory_monitoring': 'メモリ使用率モニタリング'
|
||||
}
|
||||
}
|
||||
133
language/src/main/resources/language/i18n/vi.js
Normal file
133
language/src/main/resources/language/i18n/vi.js
Normal file
@@ -0,0 +1,133 @@
|
||||
var config = {
|
||||
'lang': 'zh',
|
||||
'platform': {
|
||||
'title': '富佳WMS',
|
||||
'tip1': '用户名不能为空',
|
||||
'tip2': '密码不能为空',
|
||||
'tip3': '验证码不能为空'
|
||||
},
|
||||
'common': {
|
||||
'home': '首页', // 首页
|
||||
'Layout_setting': '布局设置',
|
||||
'Personal_center': '个人中心',
|
||||
'Log_out': '退出登录',
|
||||
'Personal_information': '个人信息',
|
||||
'username': '用户姓名',
|
||||
'name': '姓名',
|
||||
'phone': '手机号码',
|
||||
'phone2': '手机号',
|
||||
'sex': '性别',
|
||||
'sex_male': '男',
|
||||
'sex_female': '女',
|
||||
'email': '用户邮箱',
|
||||
'Security_settings': '安全设置',
|
||||
'Save_settings': '保存配置',
|
||||
'Reset_settings': '重置配置',
|
||||
'Change_password': '修改密码',
|
||||
'New_password': '新密码',
|
||||
'Old_password': '旧密码',
|
||||
'Verify_password': '确认密码',
|
||||
'User_information': '用户资料',
|
||||
'Operation_log': '操作日志',
|
||||
'action': '行为',
|
||||
'IP_source': 'IP来源',
|
||||
'Browser': '浏览器',
|
||||
'Request_time': '请求耗时',
|
||||
'Creation_date': '创建日期',
|
||||
'account': '账号',
|
||||
'password': '密码',
|
||||
'verification_code': '验证码',
|
||||
'login_rm': '记住我',
|
||||
'login': '登 录',
|
||||
'login_ing': '登 录 中...',
|
||||
'Create': '新增',
|
||||
'Update': '修改',
|
||||
'Delete': '删除',
|
||||
'More': '更多',
|
||||
'Export': '导出',
|
||||
'Editors': '编辑',
|
||||
'SelectAll': '全选',
|
||||
'Query': '查询',
|
||||
'Reset': '重置',
|
||||
'Confirm': '确认',
|
||||
'Cancel': '取消',
|
||||
'Yes': '是',
|
||||
'No': '否',
|
||||
'Success': '成功',
|
||||
'Fail': '失败',
|
||||
'Please_select': '请选择',
|
||||
'Operation_success': '操作成功',
|
||||
'Upload_success': '上传成功',
|
||||
'Operate': '操作',
|
||||
'Refresh': '刷新',
|
||||
'Closes': '关闭',
|
||||
'Closes_l': '关闭左侧',
|
||||
'Closes_r': '关闭右侧',
|
||||
'Closes_o': '关闭其他',
|
||||
'Closes_a': '关闭全部',
|
||||
'Theme_style_setting': '主题风格设置',
|
||||
'Theme_color': '主题颜色',
|
||||
'System_layout_configuration': '系统布局配置',
|
||||
'Open': '开启',
|
||||
'Fixation': '固定',
|
||||
'Display': '显示',
|
||||
'Dynamic_titles': '动态标题',
|
||||
'crudTip': '确定删除本条数据吗?',
|
||||
'startDate': '开始日期',
|
||||
'endDate': '结束日期',
|
||||
'moreMenu': '更多菜单',
|
||||
'browses': '浏览',
|
||||
'fz': '全屏缩放',
|
||||
'submit': '提交成功',
|
||||
'add': '新增成功',
|
||||
'edit': '编辑成功',
|
||||
'del': '删除成功',
|
||||
'close': '确认关闭',
|
||||
'save': '保存成功',
|
||||
'datas': '数据',
|
||||
'Tips': '提示',
|
||||
'Tip1': '确认删除选中的{count}条数据?',
|
||||
'Tip3': '用户姓名不作为登录使用',
|
||||
'Tip4': '手机号码不能重复',
|
||||
'Tip5': '请输入电话号码',
|
||||
'Tip6': '请输入正确的11位手机号码',
|
||||
'Tip7': '拖拽excel文件到此处 或者',
|
||||
'Tip8': '两次输入的密码不一致',
|
||||
'Tip9': '请再次输入密码',
|
||||
'Tip10': '请输入旧密码',
|
||||
'Tip11': '请输入新密码',
|
||||
'Tip12': '长度在 {min} 到 {max} 个字符',
|
||||
'Tip13': '确定注销并退出系统吗?',
|
||||
'Tip14': 'WebSocket连接发生错误',
|
||||
'Tip15': '请输入图标名称',
|
||||
'Tip16': '不能为空',
|
||||
'Tip17': '请输入你要搜索的内容',
|
||||
'loading': '数据加载中...',
|
||||
'Tip18': '选择日期时间',
|
||||
'Tip19': '你确定删除选中的数据吗?',
|
||||
'Tip20': '当前登录状态已过期,请重新登录!'
|
||||
},
|
||||
'WorkOrder': {
|
||||
'form': {
|
||||
'WorkOrderCode': '工单编码'
|
||||
},
|
||||
'placeholder': {
|
||||
'WorkOrderCode': '请输入工单编码'
|
||||
}
|
||||
},
|
||||
'monitor': {
|
||||
'sys': '系统',
|
||||
'day': '项目已不间断运行',
|
||||
'status': '状态',
|
||||
'cpu': 'CPU使用率',
|
||||
'core': '核心',
|
||||
'memory': '内存使用率',
|
||||
'tality': '总量',
|
||||
'used': '已使用',
|
||||
'leisure': '空闲',
|
||||
'exchange': '交换区使用率',
|
||||
'disk': '磁盘使用率',
|
||||
'cpu_monitoring': 'CPU使用率监控',
|
||||
'memory_monitoring': '内存使用率监控'
|
||||
}
|
||||
}
|
||||
161
language/src/main/resources/language/i18n/zh.js
Normal file
161
language/src/main/resources/language/i18n/zh.js
Normal file
@@ -0,0 +1,161 @@
|
||||
var config = {
|
||||
'lang': 'zh',
|
||||
'platform': {
|
||||
'title': '富佳WMS',
|
||||
'tip1': '用户名不能为空',
|
||||
'tip2': '密码不能为空',
|
||||
'tip3': '验证码不能为空'
|
||||
},
|
||||
'common': {
|
||||
'home': '首页', // 首页
|
||||
'Layout_setting': '布局设置',
|
||||
'Personal_center': '个人中心',
|
||||
'Log_out': '退出登录',
|
||||
'Personal_information': '个人信息',
|
||||
'username': '用户姓名',
|
||||
'name': '姓名',
|
||||
'phone': '手机号码',
|
||||
'phone2': '手机号',
|
||||
'sex': '性别',
|
||||
'sex_male': '男',
|
||||
'sex_female': '女',
|
||||
'email': '用户邮箱',
|
||||
'Security_settings': '安全设置',
|
||||
'Save_settings': '保存配置',
|
||||
'Reset_settings': '重置配置',
|
||||
'Change_password': '修改密码',
|
||||
'New_password': '新密码',
|
||||
'Old_password': '旧密码',
|
||||
'Verify_password': '确认密码',
|
||||
'User_information': '用户资料',
|
||||
'Operation_log': '操作日志',
|
||||
'action': '行为',
|
||||
'IP_source': 'IP来源',
|
||||
'Browser': '浏览器',
|
||||
'Request_time': '请求耗时',
|
||||
'Creation_date': '创建日期',
|
||||
'account': '账号',
|
||||
'password': '密码',
|
||||
'verification_code': '验证码',
|
||||
'login_rm': '记住我',
|
||||
'login': '登 录',
|
||||
'login_ing': '登 录 中...',
|
||||
'Create': '新增',
|
||||
'Update': '修改',
|
||||
'Delete': '删除',
|
||||
'More': '更多',
|
||||
'Export': '导出',
|
||||
'Editors': '编辑',
|
||||
'SelectAll': '全选',
|
||||
'Query': '查询',
|
||||
'Reset': '重置',
|
||||
'Confirm': '确认',
|
||||
'Cancel': '取消',
|
||||
'Yes': '是',
|
||||
'No': '否',
|
||||
'Success': '成功',
|
||||
'Fail': '失败',
|
||||
'Please_select': '请选择',
|
||||
'Operation_success': '操作成功',
|
||||
'Upload_success': '上传成功',
|
||||
'Operate': '操作',
|
||||
'Refresh': '刷新',
|
||||
'Closes': '关闭',
|
||||
'Closes_l': '关闭左侧',
|
||||
'Closes_r': '关闭右侧',
|
||||
'Closes_o': '关闭其他',
|
||||
'Closes_a': '关闭全部',
|
||||
'Theme_style_setting': '主题风格设置',
|
||||
'Theme_color': '主题颜色',
|
||||
'System_layout_configuration': '系统布局配置',
|
||||
'Open': '开启',
|
||||
'Fixation': '固定',
|
||||
'Display': '显示',
|
||||
'Dynamic_titles': '动态标题',
|
||||
'crudTip': '确定删除本条数据吗?',
|
||||
'startDate': '开始日期',
|
||||
'endDate': '结束日期',
|
||||
'moreMenu': '更多菜单',
|
||||
'browses': '浏览',
|
||||
'fz': '全屏缩放',
|
||||
'submit': '提交成功',
|
||||
'add': '新增成功',
|
||||
'edit': '编辑成功',
|
||||
'del': '删除成功',
|
||||
'close': '确认关闭',
|
||||
'save': '保存成功',
|
||||
'datas': '数据',
|
||||
'Tips': '提示',
|
||||
'Tip1': '确认删除选中的{count}条数据?',
|
||||
'Tip3': '用户姓名不作为登录使用',
|
||||
'Tip4': '手机号码不能重复',
|
||||
'Tip5': '请输入电话号码',
|
||||
'Tip6': '请输入正确的11位手机号码',
|
||||
'Tip7': '拖拽excel文件到此处 或者',
|
||||
'Tip8': '两次输入的密码不一致',
|
||||
'Tip9': '请再次输入密码',
|
||||
'Tip10': '请输入旧密码',
|
||||
'Tip11': '请输入新密码',
|
||||
'Tip12': '长度在 {min} 到 {max} 个字符',
|
||||
'Tip13': '确定注销并退出系统吗?',
|
||||
'Tip14': 'WebSocket连接发生错误',
|
||||
'Tip15': '请输入图标名称',
|
||||
'Tip16': '不能为空',
|
||||
'Tip17': '请输入你要搜索的内容',
|
||||
'loading': '数据加载中...',
|
||||
'Tip18': '选择日期时间',
|
||||
'Tip19': '你确定删除选中的数据吗?',
|
||||
'Tip20': '当前登录状态已过期,请重新登录!'
|
||||
},
|
||||
'WorkOrder': {
|
||||
'form': {
|
||||
'WorkOrderCode': '工单编码'
|
||||
},
|
||||
'placeholder': {
|
||||
'WorkOrderCode': '请输入工单编码'
|
||||
}
|
||||
},
|
||||
'monitor': {
|
||||
'sys': '系统',
|
||||
'day': '项目已不间断运行',
|
||||
'status': '状态',
|
||||
'cpu': 'CPU使用率',
|
||||
'core': '核心',
|
||||
'memory': '内存使用率',
|
||||
'tality': '总量',
|
||||
'used': '已使用',
|
||||
'leisure': '空闲',
|
||||
'exchange': '交换区使用率',
|
||||
'disk': '磁盘使用率',
|
||||
'cpu_monitoring': 'CPU使用率监控',
|
||||
'memory_monitoring': '内存使用率监控'
|
||||
},
|
||||
"screen": {
|
||||
"title":"仓储看板",
|
||||
"pointUse":"货位使用",
|
||||
"total_qty":"总数",
|
||||
"use_qty":"使用数",
|
||||
"emp_qty":"空货位",
|
||||
"use_percentage":"货位百分比",
|
||||
"ivtAnalyse":"实时库存分析",
|
||||
"inAndOutTrend":"出入库趋势",
|
||||
"in":"入库",
|
||||
"out":"出库",
|
||||
"toDayInAndOut":"今日出入库",
|
||||
"realTask":"实时任务",
|
||||
"task_code":"任务编码",
|
||||
"point_code1":"起点",
|
||||
"point_code2":"终点",
|
||||
"vehicle_code":"载具编码",
|
||||
"task_status":"任务状态",
|
||||
"unIos":"未完成单据",
|
||||
"bill_code":"单据编码",
|
||||
"io_type":"出入库类型",
|
||||
"bill_type":"单据类型",
|
||||
"biz_date":"业务日期",
|
||||
"stor_code":"仓库",
|
||||
"detail_count":"明细数",
|
||||
"source_id":"源单号",
|
||||
"bill_status":"单据状态",
|
||||
}
|
||||
}
|
||||
BIN
language/src/main/归档.zip
Normal file
BIN
language/src/main/归档.zip
Normal file
Binary file not shown.
295
mvnw
vendored
Executable file
295
mvnw
vendored
Executable file
@@ -0,0 +1,295 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Apache Maven Wrapper startup batch script, version 3.3.4
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
|
||||
# MVNW_REPOURL - repo url base for downloading maven distribution
|
||||
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
||||
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
set -euf
|
||||
[ "${MVNW_VERBOSE-}" != debug ] || set -x
|
||||
|
||||
# OS specific support.
|
||||
native_path() { printf %s\\n "$1"; }
|
||||
case "$(uname)" in
|
||||
CYGWIN* | MINGW*)
|
||||
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
|
||||
native_path() { cygpath --path --windows "$1"; }
|
||||
;;
|
||||
esac
|
||||
|
||||
# set JAVACMD and JAVACCMD
|
||||
set_java_home() {
|
||||
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
|
||||
if [ -n "${JAVA_HOME-}" ]; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACCMD="$JAVA_HOME/jre/sh/javac"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACCMD="$JAVA_HOME/bin/javac"
|
||||
|
||||
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
|
||||
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
|
||||
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
JAVACMD="$(
|
||||
'set' +e
|
||||
'unset' -f command 2>/dev/null
|
||||
'command' -v java
|
||||
)" || :
|
||||
JAVACCMD="$(
|
||||
'set' +e
|
||||
'unset' -f command 2>/dev/null
|
||||
'command' -v javac
|
||||
)" || :
|
||||
|
||||
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
|
||||
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# hash string like Java String::hashCode
|
||||
hash_string() {
|
||||
str="${1:-}" h=0
|
||||
while [ -n "$str" ]; do
|
||||
char="${str%"${str#?}"}"
|
||||
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
|
||||
str="${str#?}"
|
||||
done
|
||||
printf %x\\n $h
|
||||
}
|
||||
|
||||
verbose() { :; }
|
||||
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
|
||||
|
||||
die() {
|
||||
printf %s\\n "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
trim() {
|
||||
# MWRAPPER-139:
|
||||
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
|
||||
# Needed for removing poorly interpreted newline sequences when running in more
|
||||
# exotic environments such as mingw bash on Windows.
|
||||
printf "%s" "${1}" | tr -d '[:space:]'
|
||||
}
|
||||
|
||||
scriptDir="$(dirname "$0")"
|
||||
scriptName="$(basename "$0")"
|
||||
|
||||
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
|
||||
while IFS="=" read -r key value; do
|
||||
case "${key-}" in
|
||||
distributionUrl) distributionUrl=$(trim "${value-}") ;;
|
||||
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
|
||||
esac
|
||||
done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||
|
||||
case "${distributionUrl##*/}" in
|
||||
maven-mvnd-*bin.*)
|
||||
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
|
||||
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
|
||||
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
|
||||
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
|
||||
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
|
||||
:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
|
||||
*)
|
||||
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
|
||||
distributionPlatform=linux-amd64
|
||||
;;
|
||||
esac
|
||||
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
|
||||
;;
|
||||
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
|
||||
*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
|
||||
esac
|
||||
|
||||
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
||||
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
||||
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
|
||||
distributionUrlName="${distributionUrl##*/}"
|
||||
distributionUrlNameMain="${distributionUrlName%.*}"
|
||||
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
|
||||
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
|
||||
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
|
||||
|
||||
exec_maven() {
|
||||
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
|
||||
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
|
||||
}
|
||||
|
||||
if [ -d "$MAVEN_HOME" ]; then
|
||||
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
||||
exec_maven "$@"
|
||||
fi
|
||||
|
||||
case "${distributionUrl-}" in
|
||||
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
|
||||
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
|
||||
esac
|
||||
|
||||
# prepare tmp dir
|
||||
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
|
||||
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
|
||||
trap clean HUP INT TERM EXIT
|
||||
else
|
||||
die "cannot create temp dir"
|
||||
fi
|
||||
|
||||
mkdir -p -- "${MAVEN_HOME%/*}"
|
||||
|
||||
# Download and Install Apache Maven
|
||||
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
||||
verbose "Downloading from: $distributionUrl"
|
||||
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||
|
||||
# select .zip or .tar.gz
|
||||
if ! command -v unzip >/dev/null; then
|
||||
distributionUrl="${distributionUrl%.zip}.tar.gz"
|
||||
distributionUrlName="${distributionUrl##*/}"
|
||||
fi
|
||||
|
||||
# verbose opt
|
||||
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
|
||||
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
|
||||
|
||||
# normalize http auth
|
||||
case "${MVNW_PASSWORD:+has-password}" in
|
||||
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
||||
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
||||
esac
|
||||
|
||||
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
|
||||
verbose "Found wget ... using wget"
|
||||
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
|
||||
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
|
||||
verbose "Found curl ... using curl"
|
||||
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
|
||||
elif set_java_home; then
|
||||
verbose "Falling back to use Java to download"
|
||||
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
|
||||
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||
cat >"$javaSource" <<-END
|
||||
public class Downloader extends java.net.Authenticator
|
||||
{
|
||||
protected java.net.PasswordAuthentication getPasswordAuthentication()
|
||||
{
|
||||
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
|
||||
}
|
||||
public static void main( String[] args ) throws Exception
|
||||
{
|
||||
setDefault( new Downloader() );
|
||||
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
|
||||
}
|
||||
}
|
||||
END
|
||||
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
|
||||
verbose " - Compiling Downloader.java ..."
|
||||
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
|
||||
verbose " - Running Downloader.java ..."
|
||||
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
|
||||
fi
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
||||
if [ -n "${distributionSha256Sum-}" ]; then
|
||||
distributionSha256Result=false
|
||||
if [ "$MVN_CMD" = mvnd.sh ]; then
|
||||
echo "Checksum validation is not supported for maven-mvnd." >&2
|
||||
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
||||
exit 1
|
||||
elif command -v sha256sum >/dev/null; then
|
||||
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then
|
||||
distributionSha256Result=true
|
||||
fi
|
||||
elif command -v shasum >/dev/null; then
|
||||
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
|
||||
distributionSha256Result=true
|
||||
fi
|
||||
else
|
||||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
|
||||
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ $distributionSha256Result = false ]; then
|
||||
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
|
||||
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# unzip and move
|
||||
if command -v unzip >/dev/null; then
|
||||
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
|
||||
else
|
||||
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
|
||||
fi
|
||||
|
||||
# Find the actual extracted directory name (handles snapshots where filename != directory name)
|
||||
actualDistributionDir=""
|
||||
|
||||
# First try the expected directory name (for regular distributions)
|
||||
if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then
|
||||
if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then
|
||||
actualDistributionDir="$distributionUrlNameMain"
|
||||
fi
|
||||
fi
|
||||
|
||||
# If not found, search for any directory with the Maven executable (for snapshots)
|
||||
if [ -z "$actualDistributionDir" ]; then
|
||||
# enable globbing to iterate over items
|
||||
set +f
|
||||
for dir in "$TMP_DOWNLOAD_DIR"/*; do
|
||||
if [ -d "$dir" ]; then
|
||||
if [ -f "$dir/bin/$MVN_CMD" ]; then
|
||||
actualDistributionDir="$(basename "$dir")"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
set -f
|
||||
fi
|
||||
|
||||
if [ -z "$actualDistributionDir" ]; then
|
||||
verbose "Contents of $TMP_DOWNLOAD_DIR:"
|
||||
verbose "$(ls -la "$TMP_DOWNLOAD_DIR")"
|
||||
die "Could not find Maven distribution directory in extracted archive"
|
||||
fi
|
||||
|
||||
verbose "Found extracted Maven distribution directory: $actualDistributionDir"
|
||||
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
|
||||
mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
|
||||
|
||||
clean || :
|
||||
exec_maven "$@"
|
||||
189
mvnw.cmd
vendored
Normal file
189
mvnw.cmd
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
<# : batch portion
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Apache Maven Wrapper startup batch script, version 3.3.4
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM MVNW_REPOURL - repo url base for downloading maven distribution
|
||||
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
||||
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
|
||||
@SET __MVNW_CMD__=
|
||||
@SET __MVNW_ERROR__=
|
||||
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
|
||||
@SET PSModulePath=
|
||||
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
|
||||
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
|
||||
)
|
||||
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
|
||||
@SET __MVNW_PSMODULEP_SAVE=
|
||||
@SET __MVNW_ARG0_NAME__=
|
||||
@SET MVNW_USERNAME=
|
||||
@SET MVNW_PASSWORD=
|
||||
@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
|
||||
@echo Cannot start maven from wrapper >&2 && exit /b 1
|
||||
@GOTO :EOF
|
||||
: end batch / begin powershell #>
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
if ($env:MVNW_VERBOSE -eq "true") {
|
||||
$VerbosePreference = "Continue"
|
||||
}
|
||||
|
||||
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
|
||||
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
|
||||
if (!$distributionUrl) {
|
||||
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||
}
|
||||
|
||||
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
|
||||
"maven-mvnd-*" {
|
||||
$USE_MVND = $true
|
||||
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
|
||||
$MVN_CMD = "mvnd.cmd"
|
||||
break
|
||||
}
|
||||
default {
|
||||
$USE_MVND = $false
|
||||
$MVN_CMD = $script -replace '^mvnw','mvn'
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
||||
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
||||
if ($env:MVNW_REPOURL) {
|
||||
$MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
|
||||
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
|
||||
}
|
||||
$distributionUrlName = $distributionUrl -replace '^.*/',''
|
||||
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
|
||||
|
||||
$MAVEN_M2_PATH = "$HOME/.m2"
|
||||
if ($env:MAVEN_USER_HOME) {
|
||||
$MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
|
||||
New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
|
||||
}
|
||||
|
||||
$MAVEN_WRAPPER_DISTS = $null
|
||||
if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
|
||||
$MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
|
||||
} else {
|
||||
$MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
|
||||
}
|
||||
|
||||
$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
|
||||
$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
|
||||
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
|
||||
|
||||
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
|
||||
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
||||
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
||||
exit $?
|
||||
}
|
||||
|
||||
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
|
||||
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
|
||||
}
|
||||
|
||||
# prepare tmp dir
|
||||
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
|
||||
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
|
||||
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
|
||||
trap {
|
||||
if ($TMP_DOWNLOAD_DIR.Exists) {
|
||||
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
||||
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
||||
}
|
||||
}
|
||||
|
||||
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
|
||||
|
||||
# Download and Install Apache Maven
|
||||
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
||||
Write-Verbose "Downloading from: $distributionUrl"
|
||||
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||
|
||||
$webclient = New-Object System.Net.WebClient
|
||||
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
|
||||
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
|
||||
}
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
||||
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
|
||||
if ($distributionSha256Sum) {
|
||||
if ($USE_MVND) {
|
||||
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
|
||||
}
|
||||
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
|
||||
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
|
||||
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
|
||||
}
|
||||
}
|
||||
|
||||
# unzip and move
|
||||
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
|
||||
|
||||
# Find the actual extracted directory name (handles snapshots where filename != directory name)
|
||||
$actualDistributionDir = ""
|
||||
|
||||
# First try the expected directory name (for regular distributions)
|
||||
$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
|
||||
$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
|
||||
if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
|
||||
$actualDistributionDir = $distributionUrlNameMain
|
||||
}
|
||||
|
||||
# If not found, search for any directory with the Maven executable (for snapshots)
|
||||
if (!$actualDistributionDir) {
|
||||
Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
|
||||
$testPath = Join-Path $_.FullName "bin/$MVN_CMD"
|
||||
if (Test-Path -Path $testPath -PathType Leaf) {
|
||||
$actualDistributionDir = $_.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$actualDistributionDir) {
|
||||
Write-Error "Could not find Maven distribution directory in extracted archive"
|
||||
}
|
||||
|
||||
Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
|
||||
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
|
||||
try {
|
||||
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
|
||||
} catch {
|
||||
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
|
||||
Write-Error "fail to move MAVEN_HOME"
|
||||
}
|
||||
} finally {
|
||||
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
||||
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
||||
}
|
||||
|
||||
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
||||
43
pom.xml
Normal file
43
pom.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>nl.sdk</groupId>
|
||||
<artifactId>sdk-all</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>sdk</name>
|
||||
<packaging>pom</packaging>
|
||||
<description>sdk</description>
|
||||
<properties>
|
||||
<java.version>8</java.version>
|
||||
</properties>
|
||||
<modules>
|
||||
<module>language</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-spring-boot-starter</artifactId>
|
||||
<version>1.31.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.83</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
Reference in New Issue
Block a user