23 changed files with 2 additions and 1754 deletions
@ -1,33 +0,0 @@ |
|||||
HELP.md |
|
||||
target/ |
|
||||
!.mvn/wrapper/maven-wrapper.jar |
|
||||
!**/src/main/**/target/ |
|
||||
!**/src/test/**/target/ |
|
||||
|
|
||||
### STS ### |
|
||||
.apt_generated |
|
||||
.classpath |
|
||||
.factorypath |
|
||||
.project |
|
||||
.settings |
|
||||
.springBeans |
|
||||
.sts4-cache |
|
||||
|
|
||||
### IntelliJ IDEA ### |
|
||||
.idea |
|
||||
*.iws |
|
||||
*.iml |
|
||||
*.ipr |
|
||||
|
|
||||
### NetBeans ### |
|
||||
/nbproject/private/ |
|
||||
/nbbuild/ |
|
||||
/dist/ |
|
||||
/nbdist/ |
|
||||
/.nb-gradle/ |
|
||||
build/ |
|
||||
!**/src/main/**/build/ |
|
||||
!**/src/test/**/build/ |
|
||||
|
|
||||
### VS Code ### |
|
||||
.vscode/ |
|
Binary file not shown.
@ -1,2 +0,0 @@ |
|||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip |
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar |
|
@ -1,316 +0,0 @@ |
|||||
#!/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 |
|
||||
# |
|
||||
# https://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. |
|
||||
# ---------------------------------------------------------------------------- |
|
||||
|
|
||||
# ---------------------------------------------------------------------------- |
|
||||
# Maven Start Up Batch script |
|
||||
# |
|
||||
# Required ENV vars: |
|
||||
# ------------------ |
|
||||
# JAVA_HOME - location of a JDK home dir |
|
||||
# |
|
||||
# Optional ENV vars |
|
||||
# ----------------- |
|
||||
# M2_HOME - location of maven2's installed home dir |
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven |
|
||||
# e.g. to debug Maven itself, use |
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
|
||||
# ---------------------------------------------------------------------------- |
|
||||
|
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then |
|
||||
|
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then |
|
||||
. /usr/local/etc/mavenrc |
|
||||
fi |
|
||||
|
|
||||
if [ -f /etc/mavenrc ] ; then |
|
||||
. /etc/mavenrc |
|
||||
fi |
|
||||
|
|
||||
if [ -f "$HOME/.mavenrc" ] ; then |
|
||||
. "$HOME/.mavenrc" |
|
||||
fi |
|
||||
|
|
||||
fi |
|
||||
|
|
||||
# OS specific support. $var _must_ be set to either true or false. |
|
||||
cygwin=false; |
|
||||
darwin=false; |
|
||||
mingw=false |
|
||||
case "`uname`" in |
|
||||
CYGWIN*) cygwin=true ;; |
|
||||
MINGW*) mingw=true;; |
|
||||
Darwin*) darwin=true |
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home |
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html |
|
||||
if [ -z "$JAVA_HOME" ]; then |
|
||||
if [ -x "/usr/libexec/java_home" ]; then |
|
||||
export JAVA_HOME="`/usr/libexec/java_home`" |
|
||||
else |
|
||||
export JAVA_HOME="/Library/Java/Home" |
|
||||
fi |
|
||||
fi |
|
||||
;; |
|
||||
esac |
|
||||
|
|
||||
if [ -z "$JAVA_HOME" ] ; then |
|
||||
if [ -r /etc/gentoo-release ] ; then |
|
||||
JAVA_HOME=`java-config --jre-home` |
|
||||
fi |
|
||||
fi |
|
||||
|
|
||||
if [ -z "$M2_HOME" ] ; then |
|
||||
## resolve links - $0 may be a link to maven's home |
|
||||
PRG="$0" |
|
||||
|
|
||||
# need this for relative symlinks |
|
||||
while [ -h "$PRG" ] ; do |
|
||||
ls=`ls -ld "$PRG"` |
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'` |
|
||||
if expr "$link" : '/.*' > /dev/null; then |
|
||||
PRG="$link" |
|
||||
else |
|
||||
PRG="`dirname "$PRG"`/$link" |
|
||||
fi |
|
||||
done |
|
||||
|
|
||||
saveddir=`pwd` |
|
||||
|
|
||||
M2_HOME=`dirname "$PRG"`/.. |
|
||||
|
|
||||
# make it fully qualified |
|
||||
M2_HOME=`cd "$M2_HOME" && pwd` |
|
||||
|
|
||||
cd "$saveddir" |
|
||||
# echo Using m2 at $M2_HOME |
|
||||
fi |
|
||||
|
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched |
|
||||
if $cygwin ; then |
|
||||
[ -n "$M2_HOME" ] && |
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"` |
|
||||
[ -n "$JAVA_HOME" ] && |
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"` |
|
||||
[ -n "$CLASSPATH" ] && |
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"` |
|
||||
fi |
|
||||
|
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched |
|
||||
if $mingw ; then |
|
||||
[ -n "$M2_HOME" ] && |
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`" |
|
||||
[ -n "$JAVA_HOME" ] && |
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" |
|
||||
fi |
|
||||
|
|
||||
if [ -z "$JAVA_HOME" ]; then |
|
||||
javaExecutable="`which javac`" |
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then |
|
||||
# readlink(1) is not available as standard on Solaris 10. |
|
||||
readLink=`which readlink` |
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then |
|
||||
if $darwin ; then |
|
||||
javaHome="`dirname \"$javaExecutable\"`" |
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" |
|
||||
else |
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`" |
|
||||
fi |
|
||||
javaHome="`dirname \"$javaExecutable\"`" |
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'` |
|
||||
JAVA_HOME="$javaHome" |
|
||||
export JAVA_HOME |
|
||||
fi |
|
||||
fi |
|
||||
fi |
|
||||
|
|
||||
if [ -z "$JAVACMD" ] ; then |
|
||||
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" |
|
||||
else |
|
||||
JAVACMD="$JAVA_HOME/bin/java" |
|
||||
fi |
|
||||
else |
|
||||
JAVACMD="`\\unset -f command; \\command -v java`" |
|
||||
fi |
|
||||
fi |
|
||||
|
|
||||
if [ ! -x "$JAVACMD" ] ; then |
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2 |
|
||||
echo " We cannot execute $JAVACMD" >&2 |
|
||||
exit 1 |
|
||||
fi |
|
||||
|
|
||||
if [ -z "$JAVA_HOME" ] ; then |
|
||||
echo "Warning: JAVA_HOME environment variable is not set." |
|
||||
fi |
|
||||
|
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher |
|
||||
|
|
||||
# traverses directory structure from process work directory to filesystem root |
|
||||
# first directory with .mvn subdirectory is considered project base directory |
|
||||
find_maven_basedir() { |
|
||||
|
|
||||
if [ -z "$1" ] |
|
||||
then |
|
||||
echo "Path not specified to find_maven_basedir" |
|
||||
return 1 |
|
||||
fi |
|
||||
|
|
||||
basedir="$1" |
|
||||
wdir="$1" |
|
||||
while [ "$wdir" != '/' ] ; do |
|
||||
if [ -d "$wdir"/.mvn ] ; then |
|
||||
basedir=$wdir |
|
||||
break |
|
||||
fi |
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc) |
|
||||
if [ -d "${wdir}" ]; then |
|
||||
wdir=`cd "$wdir/.."; pwd` |
|
||||
fi |
|
||||
# end of workaround |
|
||||
done |
|
||||
echo "${basedir}" |
|
||||
} |
|
||||
|
|
||||
# concatenates all lines of a file |
|
||||
concat_lines() { |
|
||||
if [ -f "$1" ]; then |
|
||||
echo "$(tr -s '\n' ' ' < "$1")" |
|
||||
fi |
|
||||
} |
|
||||
|
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"` |
|
||||
if [ -z "$BASE_DIR" ]; then |
|
||||
exit 1; |
|
||||
fi |
|
||||
|
|
||||
########################################################################################## |
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data. |
|
||||
########################################################################################## |
|
||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Found .mvn/wrapper/maven-wrapper.jar" |
|
||||
fi |
|
||||
else |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." |
|
||||
fi |
|
||||
if [ -n "$MVNW_REPOURL" ]; then |
|
||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
|
||||
else |
|
||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
|
||||
fi |
|
||||
while IFS="=" read key value; do |
|
||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;; |
|
||||
esac |
|
||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Downloading from: $jarUrl" |
|
||||
fi |
|
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" |
|
||||
if $cygwin; then |
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` |
|
||||
fi |
|
||||
|
|
||||
if command -v wget > /dev/null; then |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Found wget ... using wget" |
|
||||
fi |
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
|
||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
|
||||
else |
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
|
||||
fi |
|
||||
elif command -v curl > /dev/null; then |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Found curl ... using curl" |
|
||||
fi |
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f |
|
||||
else |
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f |
|
||||
fi |
|
||||
|
|
||||
else |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Falling back to using Java to download" |
|
||||
fi |
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" |
|
||||
# For Cygwin, switch paths to Windows format before running javac |
|
||||
if $cygwin; then |
|
||||
javaClass=`cygpath --path --windows "$javaClass"` |
|
||||
fi |
|
||||
if [ -e "$javaClass" ]; then |
|
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo " - Compiling MavenWrapperDownloader.java ..." |
|
||||
fi |
|
||||
# Compiling the Java class |
|
||||
("$JAVA_HOME/bin/javac" "$javaClass") |
|
||||
fi |
|
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
|
||||
# Running the downloader |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo " - Running MavenWrapperDownloader.java ..." |
|
||||
fi |
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") |
|
||||
fi |
|
||||
fi |
|
||||
fi |
|
||||
fi |
|
||||
########################################################################################## |
|
||||
# End of extension |
|
||||
########################################################################################## |
|
||||
|
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo $MAVEN_PROJECTBASEDIR |
|
||||
fi |
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" |
|
||||
|
|
||||
# For Cygwin, switch paths to Windows format before running java |
|
||||
if $cygwin; then |
|
||||
[ -n "$M2_HOME" ] && |
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"` |
|
||||
[ -n "$JAVA_HOME" ] && |
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` |
|
||||
[ -n "$CLASSPATH" ] && |
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"` |
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] && |
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` |
|
||||
fi |
|
||||
|
|
||||
# Provide a "standardized" way to retrieve the CLI args that will |
|
||||
# work with both Windows and non-Windows executions. |
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" |
|
||||
export MAVEN_CMD_LINE_ARGS |
|
||||
|
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
|
||||
|
|
||||
exec "$JAVACMD" \ |
|
||||
$MAVEN_OPTS \ |
|
||||
$MAVEN_DEBUG_OPTS \ |
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ |
|
||||
"-Dmaven.home=${M2_HOME}" \ |
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ |
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" |
|
@ -1,188 +0,0 @@ |
|||||
@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 https://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 Maven Start Up Batch script |
|
||||
@REM |
|
||||
@REM Required ENV vars: |
|
||||
@REM JAVA_HOME - location of a JDK home dir |
|
||||
@REM |
|
||||
@REM Optional ENV vars |
|
||||
@REM M2_HOME - location of maven2's installed home dir |
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands |
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending |
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven |
|
||||
@REM e.g. to debug Maven itself, use |
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
|
||||
@REM ---------------------------------------------------------------------------- |
|
||||
|
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' |
|
||||
@echo off |
|
||||
@REM set title of command window |
|
||||
title %0 |
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' |
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% |
|
||||
|
|
||||
@REM set %HOME% to equivalent of $HOME |
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") |
|
||||
|
|
||||
@REM Execute a user defined script before this one |
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre |
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending |
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* |
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* |
|
||||
:skipRcPre |
|
||||
|
|
||||
@setlocal |
|
||||
|
|
||||
set ERROR_CODE=0 |
|
||||
|
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal |
|
||||
@setlocal |
|
||||
|
|
||||
@REM ==== START VALIDATION ==== |
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome |
|
||||
|
|
||||
echo. |
|
||||
echo Error: JAVA_HOME not found in your environment. >&2 |
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
|
||||
echo location of your Java installation. >&2 |
|
||||
echo. |
|
||||
goto error |
|
||||
|
|
||||
:OkJHome |
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init |
|
||||
|
|
||||
echo. |
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2 |
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2 |
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
|
||||
echo location of your Java installation. >&2 |
|
||||
echo. |
|
||||
goto error |
|
||||
|
|
||||
@REM ==== END VALIDATION ==== |
|
||||
|
|
||||
:init |
|
||||
|
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". |
|
||||
@REM Fallback to current working directory if not found. |
|
||||
|
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% |
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir |
|
||||
|
|
||||
set EXEC_DIR=%CD% |
|
||||
set WDIR=%EXEC_DIR% |
|
||||
:findBaseDir |
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound |
|
||||
cd .. |
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound |
|
||||
set WDIR=%CD% |
|
||||
goto findBaseDir |
|
||||
|
|
||||
:baseDirFound |
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR% |
|
||||
cd "%EXEC_DIR%" |
|
||||
goto endDetectBaseDir |
|
||||
|
|
||||
:baseDirNotFound |
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR% |
|
||||
cd "%EXEC_DIR%" |
|
||||
|
|
||||
:endDetectBaseDir |
|
||||
|
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig |
|
||||
|
|
||||
@setlocal EnableExtensions EnableDelayedExpansion |
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a |
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% |
|
||||
|
|
||||
:endReadAdditionalConfig |
|
||||
|
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" |
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" |
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
|
||||
|
|
||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
|
||||
|
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( |
|
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B |
|
||||
) |
|
||||
|
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data. |
|
||||
if exist %WRAPPER_JAR% ( |
|
||||
if "%MVNW_VERBOSE%" == "true" ( |
|
||||
echo Found %WRAPPER_JAR% |
|
||||
) |
|
||||
) else ( |
|
||||
if not "%MVNW_REPOURL%" == "" ( |
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
|
||||
) |
|
||||
if "%MVNW_VERBOSE%" == "true" ( |
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ... |
|
||||
echo Downloading from: %DOWNLOAD_URL% |
|
||||
) |
|
||||
|
|
||||
powershell -Command "&{"^ |
|
||||
"$webclient = new-object System.Net.WebClient;"^ |
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ |
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ |
|
||||
"}"^ |
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ |
|
||||
"}" |
|
||||
if "%MVNW_VERBOSE%" == "true" ( |
|
||||
echo Finished downloading %WRAPPER_JAR% |
|
||||
) |
|
||||
) |
|
||||
@REM End of extension |
|
||||
|
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will |
|
||||
@REM work with both Windows and non-Windows executions. |
|
||||
set MAVEN_CMD_LINE_ARGS=%* |
|
||||
|
|
||||
%MAVEN_JAVA_EXE% ^ |
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^ |
|
||||
%MAVEN_OPTS% ^ |
|
||||
%MAVEN_DEBUG_OPTS% ^ |
|
||||
-classpath %WRAPPER_JAR% ^ |
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ |
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* |
|
||||
if ERRORLEVEL 1 goto error |
|
||||
goto end |
|
||||
|
|
||||
:error |
|
||||
set ERROR_CODE=1 |
|
||||
|
|
||||
:end |
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE% |
|
||||
|
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost |
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending |
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" |
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" |
|
||||
:skipRcPost |
|
||||
|
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' |
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause |
|
||||
|
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% |
|
||||
|
|
||||
cmd /C exit /B %ERROR_CODE% |
|
@ -1,158 +0,0 @@ |
|||||
<?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.nl</groupId> |
|
||||
<artifactId>nladmin-system</artifactId> |
|
||||
<version>0.0.1-SNAPSHOT</version> |
|
||||
</parent> |
|
||||
|
|
||||
<groupId>org.nl</groupId> |
|
||||
<artifactId>nlsso-client</artifactId> |
|
||||
<version>0.0.1-SNAPSHOT</version> |
|
||||
<name>nlsso-client</name> |
|
||||
|
|
||||
|
|
||||
<properties> |
|
||||
<java.version>1.8</java.version> |
|
||||
<sa_token.version>1.33.0</sa_token.version> |
|
||||
<spring.version>2.7.5</spring.version> |
|
||||
<lombok.version>1.18.24</lombok.version> |
|
||||
<druid.version>1.2.8</druid.version> |
|
||||
<mysql.version>8.0.30</mysql.version> |
|
||||
</properties> |
|
||||
|
|
||||
<dependencies> |
|
||||
<dependency> |
|
||||
<groupId>cn.dev33</groupId> |
|
||||
<artifactId>sa-token-jwt</artifactId> |
|
||||
<version>${sa_token.version}</version> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>org.springframework.boot</groupId> |
|
||||
<artifactId>spring-boot-starter</artifactId> |
|
||||
</dependency> |
|
||||
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson --> |
|
||||
<dependency> |
|
||||
<groupId>com.alibaba</groupId> |
|
||||
<artifactId>fastjson</artifactId> |
|
||||
<version>1.2.83</version> |
|
||||
</dependency> |
|
||||
|
|
||||
<dependency> |
|
||||
<groupId>cn.dev33</groupId> |
|
||||
<artifactId>sa-token-dao-redis-jackson</artifactId> |
|
||||
<version>${sa_token.version}</version> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>org.springframework.boot</groupId> |
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>com.dtflys.forest</groupId> |
|
||||
<artifactId>forest-spring-boot-starter</artifactId> |
|
||||
<version>1.5.26</version> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>cn.dev33</groupId> |
|
||||
<artifactId>sa-token-alone-redis</artifactId> |
|
||||
<version>${sa_token.version}</version> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>cn.hutool</groupId> |
|
||||
<artifactId>hutool-all</artifactId> |
|
||||
<version>5.3.4</version> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>org.apache.commons</groupId> |
|
||||
<artifactId>commons-pool2</artifactId> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>cn.dev33</groupId> |
|
||||
<artifactId>sa-token-spring-boot-starter</artifactId> |
|
||||
<version>${sa_token.version}</version> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>cn.dev33</groupId> |
|
||||
<artifactId>sa-token-sso</artifactId> |
|
||||
<version>${sa_token.version}</version> |
|
||||
</dependency> |
|
||||
<dependency> |
|
||||
<groupId>org.projectlombok</groupId> |
|
||||
<artifactId>lombok</artifactId> |
|
||||
<optional>true</optional> |
|
||||
</dependency> |
|
||||
</dependencies> |
|
||||
|
|
||||
|
|
||||
|
|
||||
<build> |
|
||||
<plugins> |
|
||||
<plugin> |
|
||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||
<artifactId>maven-deploy-plugin</artifactId> |
|
||||
<version>2.8.2</version> |
|
||||
<configuration> |
|
||||
<!-- 更新元数据 --> |
|
||||
<updateReleaseInfo>true</updateReleaseInfo> |
|
||||
</configuration> |
|
||||
<executions> |
|
||||
<execution> |
|
||||
<id>default-deploy</id> |
|
||||
<phase>deploy</phase> |
|
||||
<goals> |
|
||||
<goal>deploy</goal> |
|
||||
</goals> |
|
||||
<!-- skip默认deploy插件的执行 --> |
|
||||
<configuration> |
|
||||
<skip>true</skip> |
|
||||
</configuration> |
|
||||
</execution> |
|
||||
<execution> |
|
||||
<id>deploy-file</id> |
|
||||
<phase>deploy</phase> |
|
||||
<goals> |
|
||||
<goal>deploy-file</goal> |
|
||||
</goals> |
|
||||
<configuration> |
|
||||
<!-- 开发阶段上传到snapshot仓库,上线阶段上传到release仓库 --> |
|
||||
<repositoryId>maven-snapshots</repositoryId> |
|
||||
<url>http://121.40.234.130:8081/repository/maven-releases/</url> |
|
||||
<file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file> |
|
||||
<groupId>${project.groupId}</groupId> |
|
||||
<artifactId>${project.artifactId}</artifactId> |
|
||||
<version>${project.version}</version> |
|
||||
<pomFile>pom.xml</pomFile> |
|
||||
<generatePom>true</generatePom> |
|
||||
</configuration> |
|
||||
</execution> |
|
||||
</executions> |
|
||||
</plugin> |
|
||||
</plugins> |
|
||||
</build> |
|
||||
<!-- <!– 远程仓库地址 –>--> |
|
||||
<pluginRepositories> |
|
||||
<pluginRepository> |
|
||||
<id>maven-snapshots</id> |
|
||||
<name>maven-snapshots</name> |
|
||||
<url>http://121.40.234.130:8081/repository/maven-releases/</url> |
|
||||
<releases> |
|
||||
<enabled>true</enabled> |
|
||||
</releases> |
|
||||
<snapshots> |
|
||||
<enabled>true</enabled> |
|
||||
</snapshots> |
|
||||
</pluginRepository> |
|
||||
</pluginRepositories> |
|
||||
<distributionManagement> |
|
||||
<repository> |
|
||||
<id>maven-snapshots</id> |
|
||||
<name>maven-snapshots</name> |
|
||||
<url>http://121.40.234.130:8081/repository/maven-releases/</url> |
|
||||
</repository> |
|
||||
</distributionManagement> |
|
||||
|
|
||||
|
|
||||
|
|
||||
</project> |
|
@ -1,19 +0,0 @@ |
|||||
package org.nl.sso; |
|
||||
|
|
||||
import org.springframework.boot.SpringApplication; |
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|
||||
import org.springframework.context.annotation.ComponentScan; |
|
||||
|
|
||||
/* |
|
||||
* @author ZZQ |
|
||||
* @Date 2022/11/24 4:06 下午 |
|
||||
*/ |
|
||||
//@ComponentScan("org.nl.sso.*")
|
|
||||
@SpringBootApplication |
|
||||
public class AutoConfigurationEntry { |
|
||||
static { |
|
||||
System.out.println("sso-client-service runing");} |
|
||||
public static void main(String[] args) { |
|
||||
SpringApplication.run(AutoConfigurationEntry.class, args); |
|
||||
} |
|
||||
} |
|
@ -1,61 +0,0 @@ |
|||||
package org.nl.sso.base; |
|
||||
|
|
||||
import java.io.IOException; |
|
||||
|
|
||||
import javax.servlet.Filter; |
|
||||
import javax.servlet.FilterChain; |
|
||||
import javax.servlet.FilterConfig; |
|
||||
import javax.servlet.ServletException; |
|
||||
import javax.servlet.ServletRequest; |
|
||||
import javax.servlet.ServletResponse; |
|
||||
import javax.servlet.http.HttpServletRequest; |
|
||||
import javax.servlet.http.HttpServletResponse; |
|
||||
|
|
||||
import org.springframework.core.annotation.Order; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
/** |
|
||||
* 跨域过滤器 |
|
||||
* @author kong |
|
||||
*/ |
|
||||
@Component |
|
||||
@Order(-200) |
|
||||
public class CorsFilter implements Filter { |
|
||||
|
|
||||
static final String OPTIONS = "OPTIONS"; |
|
||||
|
|
||||
@Override |
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) |
|
||||
throws IOException, ServletException { |
|
||||
HttpServletRequest request = (HttpServletRequest) req; |
|
||||
HttpServletResponse response = (HttpServletResponse) res; |
|
||||
|
|
||||
// 允许指定域访问跨域资源
|
|
||||
response.setHeader("Access-Control-Allow-Origin", "*"); |
|
||||
// 允许所有请求方式
|
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
|
||||
// 有效时间
|
|
||||
response.setHeader("Access-Control-Max-Age", "3600"); |
|
||||
// 允许的header参数
|
|
||||
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,satoken"); |
|
||||
|
|
||||
// 如果是预检请求,直接返回
|
|
||||
if (OPTIONS.equals(request.getMethod())) { |
|
||||
System.out.println("=======================浏览器发来了OPTIONS预检请求=========="); |
|
||||
response.getWriter().print(""); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
// System.out.println("*********************************过滤器被使用**************************");
|
|
||||
chain.doFilter(req, res); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void init(FilterConfig filterConfig) { |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void destroy() { |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,59 +0,0 @@ |
|||||
package org.nl.sso.base; |
|
||||
|
|
||||
import cn.dev33.satoken.sso.SaSsoProcessor; |
|
||||
import cn.dev33.satoken.sso.SaSsoUtil; |
|
||||
import cn.dev33.satoken.stp.StpUtil; |
|
||||
import com.alibaba.fastjson.JSONObject; |
|
||||
import cn.hutool.jwt.JWT; |
|
||||
import org.nl.sso.base.dto.UserEntry; |
|
||||
import org.nl.sso.base.util.UserUtil; |
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
import org.springframework.util.StringUtils; |
|
||||
import org.springframework.web.servlet.HandlerInterceptor; |
|
||||
import org.springframework.web.servlet.ModelAndView; |
|
||||
|
|
||||
import javax.servlet.http.HttpServletRequest; |
|
||||
import javax.servlet.http.HttpServletResponse; |
|
||||
import java.util.Arrays; |
|
||||
import java.util.List; |
|
||||
|
|
||||
/* |
|
||||
* @author ZZQ |
|
||||
* @Date 2022/11/26 10:12 上午 |
|
||||
*/ |
|
||||
@Component |
|
||||
@ConfigurationProperties(prefix = "sa-token.sso") |
|
||||
public class LoginInterceptor implements HandlerInterceptor { |
|
||||
private String pathPatterns; |
|
||||
|
|
||||
private List whileUrl= Arrays.asList("auth/login","/error","/logout","auth/sso/logoutCall","/auth/logout"); |
|
||||
@Override |
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
|
||||
if (whileUrl.contains(request.getRequestURI())){ |
|
||||
return true; |
|
||||
} |
|
||||
//如果需要添加token登出过期,修改过期添加redis判断:String token = SaSsoUtil.saSsoTemplate.stpLogic.isLogin
|
|
||||
String token = StpUtil.stpLogic.getTokenValue(); |
|
||||
if (!StringUtils.isEmpty(token)){ |
|
||||
JWT of = JWT.of(token); |
|
||||
UserEntry user = of.getPayloads().get("loginInfo", UserEntry.class); |
|
||||
UserUtil.setUserEntry(user); |
|
||||
return true; |
|
||||
} |
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { |
|
||||
UserUtil.remove(); |
|
||||
} |
|
||||
|
|
||||
public String getPathPatterns() { |
|
||||
return pathPatterns; |
|
||||
} |
|
||||
|
|
||||
public void setPathPatterns(String pathPatterns) { |
|
||||
this.pathPatterns = pathPatterns; |
|
||||
} |
|
||||
} |
|
@ -1,54 +0,0 @@ |
|||||
package org.nl.sso.base.dto; |
|
||||
|
|
||||
import com.alibaba.fastjson.JSONObject; |
|
||||
import lombok.Data; |
|
||||
|
|
||||
import java.io.Serializable; |
|
||||
import java.util.Date; |
|
||||
import java.util.List; |
|
||||
|
|
||||
/* |
|
||||
* @author ZZQ |
|
||||
* @Date 2022/11/25 5:44 下午 |
|
||||
* String info ="{\"id\":1,\"username\":\"admin\",\"user\":{\"username\":\"admin\",\"personName\":\"管理员\",\"email\":\"201507802@qq.com\",\"phone\":\"18888888888\",\"gender\":\"男\",\"avatarName\":\"avatar-20200806032259161.png\",\"avatarPath\":\"/Users/jie/Documents/work/me/admin/eladmin/~/avatar/avatar-20200806032259161.png\",\"extuserId\":\"\",\"password\":\"f52020dca765fd3943ed40a615dc2c5c\",\"create_name\":\"\",\"update_optname\":\"admin\",\"create_time\":1669846199,\"update_time\":1669966881},\"permissions\":[\"admin\",\"user:list\",\"roles:list\",\"menu:list\",\"timing:list\",\"dept:list\",\"dict:list\",\"roles:add\",\"roles:edit\",\"roles:del\",\"monitor:list\",\"genCode:list\",\"999\",\"storage:list\"]}"; |
|
||||
*/ |
|
||||
@Data |
|
||||
public class UserEntry implements Serializable { |
|
||||
|
|
||||
private Integer id; |
|
||||
private String username; |
|
||||
private User user; |
|
||||
private List<String> permissions; |
|
||||
private List<String> roles; |
|
||||
|
|
||||
@Data |
|
||||
public class User{ |
|
||||
private String username; |
|
||||
/** 昵称 */ |
|
||||
private String personName; |
|
||||
/** 性别 */ |
|
||||
private String gender; |
|
||||
/** 手机号码 */ |
|
||||
private String phone; |
|
||||
/** 邮箱 */ |
|
||||
private String email; |
|
||||
/** 头像地址 */ |
|
||||
private String avatarName; |
|
||||
/** 头像真实路径 */ |
|
||||
private String avatarPath; |
|
||||
/** 密码 */ |
|
||||
private String password; |
|
||||
/** 创建者 */ |
|
||||
private String create_by; |
|
||||
/** 更新者 */ |
|
||||
private String update_by; |
|
||||
/** 修改密码的时间 */ |
|
||||
private Date pwd_reset_time; |
|
||||
/** 创建日期 */ |
|
||||
private Date create_time; |
|
||||
/** 更新时间 */ |
|
||||
private Date update_time; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
@ -1,38 +0,0 @@ |
|||||
package org.nl.sso.base.saconfig; |
|
||||
|
|
||||
import cn.dev33.satoken.stp.StpInterface; |
|
||||
import cn.dev33.satoken.stp.StpUtil; |
|
||||
import cn.hutool.json.JSONArray; |
|
||||
import cn.hutool.json.JSONObject; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
import java.util.ArrayList; |
|
||||
import java.util.List; |
|
||||
|
|
||||
/* |
|
||||
* @author ZZQ |
|
||||
* @Date 2022/11/24 3:59 下午 |
|
||||
* 权限系统处理类 |
|
||||
*/ |
|
||||
@Component |
|
||||
public final class PermissionHandler implements StpInterface { |
|
||||
@Override |
|
||||
public List<String> getPermissionList(Object loginId, String loginType) { |
|
||||
JSONObject json = (JSONObject) StpUtil.getExtra("loginInfo"); |
|
||||
JSONArray permissions = json.getJSONArray("permissions"); |
|
||||
if (permissions.size() > 0) { |
|
||||
return permissions.toList(String.class); |
|
||||
} |
|
||||
return new ArrayList<>(); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public List<String> getRoleList(Object loginId, String loginType) { |
|
||||
JSONObject json = (JSONObject) StpUtil.getExtra("loginInfo"); |
|
||||
JSONArray roles = json.getJSONArray("roles"); |
|
||||
if (roles.size() > 0) { |
|
||||
return roles.toList(String.class); |
|
||||
} |
|
||||
return new ArrayList<>(); |
|
||||
} |
|
||||
} |
|
@ -1,31 +0,0 @@ |
|||||
package org.nl.sso.base.util; |
|
||||
|
|
||||
import org.nl.sso.base.dto.UserEntry; |
|
||||
|
|
||||
import java.util.HashMap; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
/* |
|
||||
* @author ZZQ |
|
||||
* @Date 2022/11/25 5:44 下午 |
|
||||
*/ |
|
||||
public class UserUtil { |
|
||||
|
|
||||
public static Map<Long,UserEntry> userCache = new HashMap<>(); |
|
||||
|
|
||||
private static final ThreadLocal<UserEntry> holder = new ThreadLocal<>(); |
|
||||
|
|
||||
public static UserEntry getUserInfo() { |
|
||||
return holder.get(); |
|
||||
} |
|
||||
|
|
||||
public static void setUserEntry(UserEntry userInfo) { |
|
||||
holder.set(userInfo); |
|
||||
} |
|
||||
|
|
||||
public static void remove() { |
|
||||
holder.remove(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
@ -1,43 +0,0 @@ |
|||||
package org.nl.sso.controller; |
|
||||
|
|
||||
|
|
||||
import cn.dev33.satoken.sso.SaSsoUtil; |
|
||||
|
|
||||
import com.alibaba.fastjson.JSONObject; |
|
||||
import org.nl.sso.base.util.UserUtil; |
|
||||
import org.springframework.http.*; |
|
||||
|
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
|
|
||||
|
|
||||
/* |
|
||||
* @author ZZQ |
|
||||
* @Date 2022/11/26 10:05 上午 |
|
||||
*/ |
|
||||
@RestController |
|
||||
@RequestMapping("auth") |
|
||||
public class LoginController { |
|
||||
|
|
||||
//获取用户信息:包括权限角色菜单等
|
|
||||
@RequestMapping("/info") |
|
||||
public ResponseEntity<Object> userInfo() { |
|
||||
Object body = SaSsoUtil.getUserinfo(UserUtil.getUserInfo().getId()); |
|
||||
if (body !=null){ |
|
||||
String info = (String) body; |
|
||||
return ResponseEntity.ok(JSONObject.parseObject(info)); |
|
||||
} |
|
||||
return ResponseEntity.noContent().build(); |
|
||||
} |
|
||||
@RequestMapping("/logout") |
|
||||
public ResponseEntity logout() { |
|
||||
|
|
||||
return new ResponseEntity<>(HttpStatus.OK); |
|
||||
} |
|
||||
|
|
||||
// @RequestMapping("/sso/logoutCall")
|
|
||||
// public void logoutCall() {
|
|
||||
// System.out.println("-----"+"服务端回调注销用,");
|
|
||||
// }
|
|
||||
|
|
||||
} |
|
@ -1 +0,0 @@ |
|||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=org.nl.sso.AutoConfigurationEntry |
|
@ -1,47 +0,0 @@ |
|||||
|
|
||||
# Sa-Token 配置 |
|
||||
sa-token: |
|
||||
# SSO-相关配置 |
|
||||
sso: |
|
||||
# 打开单点注销功能 |
|
||||
is-http: true |
|
||||
is-slo: true |
|
||||
path-patterns: /** |
|
||||
project-name: 武汉新锐项目 |
|
||||
# SSO-Server端-单点登录授权地址 |
|
||||
auth-url: http://localhost:9000/sso/auth |
|
||||
# SSO-Server端-单点注销地址 |
|
||||
slo-url: http://localhost:9000/sso/signout |
|
||||
# SSO-Server端 ticket校验地址 |
|
||||
check-ticket-url: http://localhost:9000/sso/checkTicket |
|
||||
user: http://localhost:9000/sso/checkTicket |
|
||||
# 接口调用秘钥 |
|
||||
secretkey: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor |
|
||||
userinfo-url: http://localhost:9000/sso/userInfo |
|
||||
|
|
||||
# 配置 Sa-Token 单独使用的Redis连接 (此处需要和SSO-Server端连接同一个Redis) |
|
||||
alone-redis: |
|
||||
# Redis数据库索引 |
|
||||
database: 1 |
|
||||
# Redis服务器地址 |
|
||||
host: 47.96.133.178 |
|
||||
# Redis服务器连接端口 |
|
||||
port: 6479 |
|
||||
# Redis服务器连接密码(默认为空) |
|
||||
password: 942464Yy |
|
||||
# 连接超时时间 |
|
||||
timeout: 10s |
|
||||
lettuce: |
|
||||
pool: |
|
||||
# 连接池最大连接数 |
|
||||
max-active: 200 |
|
||||
# 连接池最大阻塞等待时间(使用负值表示没有限制) |
|
||||
max-wait: -1ms |
|
||||
# 连接池中的最大空闲连接 |
|
||||
max-idle: 10 |
|
||||
# 连接池中的最小空闲连接 |
|
||||
min-idle: 0 |
|
||||
token-name: EL-ADMIN-TOEKN |
|
||||
|
|
||||
|
|
||||
|
|
Binary file not shown.
@ -1,2 +0,0 @@ |
|||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip |
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar |
|
@ -1,316 +0,0 @@ |
|||||
#!/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 |
|
||||
# |
|
||||
# https://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. |
|
||||
# ---------------------------------------------------------------------------- |
|
||||
|
|
||||
# ---------------------------------------------------------------------------- |
|
||||
# Maven Start Up Batch script |
|
||||
# |
|
||||
# Required ENV vars: |
|
||||
# ------------------ |
|
||||
# JAVA_HOME - location of a JDK home dir |
|
||||
# |
|
||||
# Optional ENV vars |
|
||||
# ----------------- |
|
||||
# M2_HOME - location of maven2's installed home dir |
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven |
|
||||
# e.g. to debug Maven itself, use |
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
|
||||
# ---------------------------------------------------------------------------- |
|
||||
|
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then |
|
||||
|
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then |
|
||||
. /usr/local/etc/mavenrc |
|
||||
fi |
|
||||
|
|
||||
if [ -f /etc/mavenrc ] ; then |
|
||||
. /etc/mavenrc |
|
||||
fi |
|
||||
|
|
||||
if [ -f "$HOME/.mavenrc" ] ; then |
|
||||
. "$HOME/.mavenrc" |
|
||||
fi |
|
||||
|
|
||||
fi |
|
||||
|
|
||||
# OS specific support. $var _must_ be set to either true or false. |
|
||||
cygwin=false; |
|
||||
darwin=false; |
|
||||
mingw=false |
|
||||
case "`uname`" in |
|
||||
CYGWIN*) cygwin=true ;; |
|
||||
MINGW*) mingw=true;; |
|
||||
Darwin*) darwin=true |
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home |
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html |
|
||||
if [ -z "$JAVA_HOME" ]; then |
|
||||
if [ -x "/usr/libexec/java_home" ]; then |
|
||||
export JAVA_HOME="`/usr/libexec/java_home`" |
|
||||
else |
|
||||
export JAVA_HOME="/Library/Java/Home" |
|
||||
fi |
|
||||
fi |
|
||||
;; |
|
||||
esac |
|
||||
|
|
||||
if [ -z "$JAVA_HOME" ] ; then |
|
||||
if [ -r /etc/gentoo-release ] ; then |
|
||||
JAVA_HOME=`java-config --jre-home` |
|
||||
fi |
|
||||
fi |
|
||||
|
|
||||
if [ -z "$M2_HOME" ] ; then |
|
||||
## resolve links - $0 may be a link to maven's home |
|
||||
PRG="$0" |
|
||||
|
|
||||
# need this for relative symlinks |
|
||||
while [ -h "$PRG" ] ; do |
|
||||
ls=`ls -ld "$PRG"` |
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'` |
|
||||
if expr "$link" : '/.*' > /dev/null; then |
|
||||
PRG="$link" |
|
||||
else |
|
||||
PRG="`dirname "$PRG"`/$link" |
|
||||
fi |
|
||||
done |
|
||||
|
|
||||
saveddir=`pwd` |
|
||||
|
|
||||
M2_HOME=`dirname "$PRG"`/.. |
|
||||
|
|
||||
# make it fully qualified |
|
||||
M2_HOME=`cd "$M2_HOME" && pwd` |
|
||||
|
|
||||
cd "$saveddir" |
|
||||
# echo Using m2 at $M2_HOME |
|
||||
fi |
|
||||
|
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched |
|
||||
if $cygwin ; then |
|
||||
[ -n "$M2_HOME" ] && |
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"` |
|
||||
[ -n "$JAVA_HOME" ] && |
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"` |
|
||||
[ -n "$CLASSPATH" ] && |
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"` |
|
||||
fi |
|
||||
|
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched |
|
||||
if $mingw ; then |
|
||||
[ -n "$M2_HOME" ] && |
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`" |
|
||||
[ -n "$JAVA_HOME" ] && |
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" |
|
||||
fi |
|
||||
|
|
||||
if [ -z "$JAVA_HOME" ]; then |
|
||||
javaExecutable="`which javac`" |
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then |
|
||||
# readlink(1) is not available as standard on Solaris 10. |
|
||||
readLink=`which readlink` |
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then |
|
||||
if $darwin ; then |
|
||||
javaHome="`dirname \"$javaExecutable\"`" |
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" |
|
||||
else |
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`" |
|
||||
fi |
|
||||
javaHome="`dirname \"$javaExecutable\"`" |
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'` |
|
||||
JAVA_HOME="$javaHome" |
|
||||
export JAVA_HOME |
|
||||
fi |
|
||||
fi |
|
||||
fi |
|
||||
|
|
||||
if [ -z "$JAVACMD" ] ; then |
|
||||
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" |
|
||||
else |
|
||||
JAVACMD="$JAVA_HOME/bin/java" |
|
||||
fi |
|
||||
else |
|
||||
JAVACMD="`\\unset -f command; \\command -v java`" |
|
||||
fi |
|
||||
fi |
|
||||
|
|
||||
if [ ! -x "$JAVACMD" ] ; then |
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2 |
|
||||
echo " We cannot execute $JAVACMD" >&2 |
|
||||
exit 1 |
|
||||
fi |
|
||||
|
|
||||
if [ -z "$JAVA_HOME" ] ; then |
|
||||
echo "Warning: JAVA_HOME environment variable is not set." |
|
||||
fi |
|
||||
|
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher |
|
||||
|
|
||||
# traverses directory structure from process work directory to filesystem root |
|
||||
# first directory with .mvn subdirectory is considered project base directory |
|
||||
find_maven_basedir() { |
|
||||
|
|
||||
if [ -z "$1" ] |
|
||||
then |
|
||||
echo "Path not specified to find_maven_basedir" |
|
||||
return 1 |
|
||||
fi |
|
||||
|
|
||||
basedir="$1" |
|
||||
wdir="$1" |
|
||||
while [ "$wdir" != '/' ] ; do |
|
||||
if [ -d "$wdir"/.mvn ] ; then |
|
||||
basedir=$wdir |
|
||||
break |
|
||||
fi |
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc) |
|
||||
if [ -d "${wdir}" ]; then |
|
||||
wdir=`cd "$wdir/.."; pwd` |
|
||||
fi |
|
||||
# end of workaround |
|
||||
done |
|
||||
echo "${basedir}" |
|
||||
} |
|
||||
|
|
||||
# concatenates all lines of a file |
|
||||
concat_lines() { |
|
||||
if [ -f "$1" ]; then |
|
||||
echo "$(tr -s '\n' ' ' < "$1")" |
|
||||
fi |
|
||||
} |
|
||||
|
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"` |
|
||||
if [ -z "$BASE_DIR" ]; then |
|
||||
exit 1; |
|
||||
fi |
|
||||
|
|
||||
########################################################################################## |
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data. |
|
||||
########################################################################################## |
|
||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Found .mvn/wrapper/maven-wrapper.jar" |
|
||||
fi |
|
||||
else |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." |
|
||||
fi |
|
||||
if [ -n "$MVNW_REPOURL" ]; then |
|
||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
|
||||
else |
|
||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
|
||||
fi |
|
||||
while IFS="=" read key value; do |
|
||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;; |
|
||||
esac |
|
||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Downloading from: $jarUrl" |
|
||||
fi |
|
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" |
|
||||
if $cygwin; then |
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` |
|
||||
fi |
|
||||
|
|
||||
if command -v wget > /dev/null; then |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Found wget ... using wget" |
|
||||
fi |
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
|
||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
|
||||
else |
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" |
|
||||
fi |
|
||||
elif command -v curl > /dev/null; then |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Found curl ... using curl" |
|
||||
fi |
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then |
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f |
|
||||
else |
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f |
|
||||
fi |
|
||||
|
|
||||
else |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo "Falling back to using Java to download" |
|
||||
fi |
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" |
|
||||
# For Cygwin, switch paths to Windows format before running javac |
|
||||
if $cygwin; then |
|
||||
javaClass=`cygpath --path --windows "$javaClass"` |
|
||||
fi |
|
||||
if [ -e "$javaClass" ]; then |
|
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo " - Compiling MavenWrapperDownloader.java ..." |
|
||||
fi |
|
||||
# Compiling the Java class |
|
||||
("$JAVA_HOME/bin/javac" "$javaClass") |
|
||||
fi |
|
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then |
|
||||
# Running the downloader |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo " - Running MavenWrapperDownloader.java ..." |
|
||||
fi |
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") |
|
||||
fi |
|
||||
fi |
|
||||
fi |
|
||||
fi |
|
||||
########################################################################################## |
|
||||
# End of extension |
|
||||
########################################################################################## |
|
||||
|
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} |
|
||||
if [ "$MVNW_VERBOSE" = true ]; then |
|
||||
echo $MAVEN_PROJECTBASEDIR |
|
||||
fi |
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" |
|
||||
|
|
||||
# For Cygwin, switch paths to Windows format before running java |
|
||||
if $cygwin; then |
|
||||
[ -n "$M2_HOME" ] && |
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"` |
|
||||
[ -n "$JAVA_HOME" ] && |
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` |
|
||||
[ -n "$CLASSPATH" ] && |
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"` |
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] && |
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` |
|
||||
fi |
|
||||
|
|
||||
# Provide a "standardized" way to retrieve the CLI args that will |
|
||||
# work with both Windows and non-Windows executions. |
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" |
|
||||
export MAVEN_CMD_LINE_ARGS |
|
||||
|
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
|
||||
|
|
||||
exec "$JAVACMD" \ |
|
||||
$MAVEN_OPTS \ |
|
||||
$MAVEN_DEBUG_OPTS \ |
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ |
|
||||
"-Dmaven.home=${M2_HOME}" \ |
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ |
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" |
|
@ -1,188 +0,0 @@ |
|||||
@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 https://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 Maven Start Up Batch script |
|
||||
@REM |
|
||||
@REM Required ENV vars: |
|
||||
@REM JAVA_HOME - location of a JDK home dir |
|
||||
@REM |
|
||||
@REM Optional ENV vars |
|
||||
@REM M2_HOME - location of maven2's installed home dir |
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands |
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending |
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven |
|
||||
@REM e.g. to debug Maven itself, use |
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files |
|
||||
@REM ---------------------------------------------------------------------------- |
|
||||
|
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' |
|
||||
@echo off |
|
||||
@REM set title of command window |
|
||||
title %0 |
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' |
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% |
|
||||
|
|
||||
@REM set %HOME% to equivalent of $HOME |
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") |
|
||||
|
|
||||
@REM Execute a user defined script before this one |
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre |
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending |
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* |
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* |
|
||||
:skipRcPre |
|
||||
|
|
||||
@setlocal |
|
||||
|
|
||||
set ERROR_CODE=0 |
|
||||
|
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal |
|
||||
@setlocal |
|
||||
|
|
||||
@REM ==== START VALIDATION ==== |
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome |
|
||||
|
|
||||
echo. |
|
||||
echo Error: JAVA_HOME not found in your environment. >&2 |
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
|
||||
echo location of your Java installation. >&2 |
|
||||
echo. |
|
||||
goto error |
|
||||
|
|
||||
:OkJHome |
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init |
|
||||
|
|
||||
echo. |
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2 |
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2 |
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2 |
|
||||
echo location of your Java installation. >&2 |
|
||||
echo. |
|
||||
goto error |
|
||||
|
|
||||
@REM ==== END VALIDATION ==== |
|
||||
|
|
||||
:init |
|
||||
|
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". |
|
||||
@REM Fallback to current working directory if not found. |
|
||||
|
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% |
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir |
|
||||
|
|
||||
set EXEC_DIR=%CD% |
|
||||
set WDIR=%EXEC_DIR% |
|
||||
:findBaseDir |
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound |
|
||||
cd .. |
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound |
|
||||
set WDIR=%CD% |
|
||||
goto findBaseDir |
|
||||
|
|
||||
:baseDirFound |
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR% |
|
||||
cd "%EXEC_DIR%" |
|
||||
goto endDetectBaseDir |
|
||||
|
|
||||
:baseDirNotFound |
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR% |
|
||||
cd "%EXEC_DIR%" |
|
||||
|
|
||||
:endDetectBaseDir |
|
||||
|
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig |
|
||||
|
|
||||
@setlocal EnableExtensions EnableDelayedExpansion |
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a |
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% |
|
||||
|
|
||||
:endReadAdditionalConfig |
|
||||
|
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" |
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" |
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain |
|
||||
|
|
||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
|
||||
|
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( |
|
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B |
|
||||
) |
|
||||
|
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central |
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data. |
|
||||
if exist %WRAPPER_JAR% ( |
|
||||
if "%MVNW_VERBOSE%" == "true" ( |
|
||||
echo Found %WRAPPER_JAR% |
|
||||
) |
|
||||
) else ( |
|
||||
if not "%MVNW_REPOURL%" == "" ( |
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" |
|
||||
) |
|
||||
if "%MVNW_VERBOSE%" == "true" ( |
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ... |
|
||||
echo Downloading from: %DOWNLOAD_URL% |
|
||||
) |
|
||||
|
|
||||
powershell -Command "&{"^ |
|
||||
"$webclient = new-object System.Net.WebClient;"^ |
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ |
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ |
|
||||
"}"^ |
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ |
|
||||
"}" |
|
||||
if "%MVNW_VERBOSE%" == "true" ( |
|
||||
echo Finished downloading %WRAPPER_JAR% |
|
||||
) |
|
||||
) |
|
||||
@REM End of extension |
|
||||
|
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will |
|
||||
@REM work with both Windows and non-Windows executions. |
|
||||
set MAVEN_CMD_LINE_ARGS=%* |
|
||||
|
|
||||
%MAVEN_JAVA_EXE% ^ |
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^ |
|
||||
%MAVEN_OPTS% ^ |
|
||||
%MAVEN_DEBUG_OPTS% ^ |
|
||||
-classpath %WRAPPER_JAR% ^ |
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ |
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* |
|
||||
if ERRORLEVEL 1 goto error |
|
||||
goto end |
|
||||
|
|
||||
:error |
|
||||
set ERROR_CODE=1 |
|
||||
|
|
||||
:end |
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE% |
|
||||
|
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost |
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending |
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" |
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" |
|
||||
:skipRcPost |
|
||||
|
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' |
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause |
|
||||
|
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% |
|
||||
|
|
||||
cmd /C exit /B %ERROR_CODE% |
|
@ -1,173 +0,0 @@ |
|||||
package org.nl; |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* @Author:JCccc |
|
||||
* @Description: |
|
||||
* @Date: created in 15:31 2019/6/12 |
|
||||
*/ |
|
||||
public class SnowflakeIdUtils { |
|
||||
// ==============================Fields===========================================
|
|
||||
/** |
|
||||
* 开始时间截 (2015-01-01) |
|
||||
*/ |
|
||||
private final long twepoch = 1420041600000L; |
|
||||
|
|
||||
/** |
|
||||
* 机器id所占的位数 |
|
||||
*/ |
|
||||
private final long workerIdBits = 5L; |
|
||||
|
|
||||
/** |
|
||||
* 数据标识id所占的位数 |
|
||||
*/ |
|
||||
private final long datacenterIdBits = 5L; |
|
||||
|
|
||||
/** |
|
||||
* 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) |
|
||||
*/ |
|
||||
private final long maxWorkerId = -1L ^ (-1L << workerIdBits); |
|
||||
|
|
||||
/** |
|
||||
* 支持的最大数据标识id,结果是31 |
|
||||
*/ |
|
||||
private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits); |
|
||||
|
|
||||
/** |
|
||||
* 序列在id中占的位数 |
|
||||
*/ |
|
||||
private final long sequenceBits = 12L; |
|
||||
|
|
||||
/** |
|
||||
* 机器ID向左移12位 |
|
||||
*/ |
|
||||
private final long workerIdShift = sequenceBits; |
|
||||
|
|
||||
/** |
|
||||
* 数据标识id向左移17位(12+5) |
|
||||
*/ |
|
||||
private final long datacenterIdShift = sequenceBits + workerIdBits; |
|
||||
|
|
||||
/** |
|
||||
* 时间截向左移22位(5+5+12) |
|
||||
*/ |
|
||||
private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits; |
|
||||
|
|
||||
/** |
|
||||
* 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) |
|
||||
*/ |
|
||||
private final long sequenceMask = -1L ^ (-1L << sequenceBits); |
|
||||
|
|
||||
/** |
|
||||
* 工作机器ID(0~31) |
|
||||
*/ |
|
||||
private long workerId; |
|
||||
|
|
||||
/** |
|
||||
* 数据中心ID(0~31) |
|
||||
*/ |
|
||||
private long datacenterId; |
|
||||
|
|
||||
/** |
|
||||
* 毫秒内序列(0~4095) |
|
||||
*/ |
|
||||
private long sequence = 0L; |
|
||||
|
|
||||
/** |
|
||||
* 上次生成ID的时间截 |
|
||||
*/ |
|
||||
private long lastTimestamp = -1L; |
|
||||
|
|
||||
//==============================Constructors=====================================
|
|
||||
|
|
||||
/** |
|
||||
* 构造函数 |
|
||||
* |
|
||||
* @param workerId 工作ID (0~31) |
|
||||
* @param datacenterId 数据中心ID (0~31) |
|
||||
*/ |
|
||||
public SnowflakeIdUtils(long workerId, long datacenterId) { |
|
||||
if (workerId > maxWorkerId || workerId < 0) { |
|
||||
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId)); |
|
||||
} |
|
||||
if (datacenterId > maxDatacenterId || datacenterId < 0) { |
|
||||
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId)); |
|
||||
} |
|
||||
this.workerId = workerId; |
|
||||
this.datacenterId = datacenterId; |
|
||||
} |
|
||||
|
|
||||
// ==============================Methods==========================================
|
|
||||
|
|
||||
/** |
|
||||
* 获得下一个ID (该方法是线程安全的) |
|
||||
* |
|
||||
* @return SnowflakeId |
|
||||
*/ |
|
||||
public synchronized long nextId() { |
|
||||
long timestamp = timeGen(); |
|
||||
|
|
||||
//如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
|
|
||||
if (timestamp < lastTimestamp) { |
|
||||
throw new RuntimeException( |
|
||||
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp)); |
|
||||
} |
|
||||
|
|
||||
//如果是同一时间生成的,则进行毫秒内序列
|
|
||||
if (lastTimestamp == timestamp) { |
|
||||
sequence = (sequence + 1) & sequenceMask; |
|
||||
//毫秒内序列溢出
|
|
||||
if (sequence == 0) { |
|
||||
//阻塞到下一个毫秒,获得新的时间戳
|
|
||||
timestamp = tilNextMillis(lastTimestamp); |
|
||||
} |
|
||||
} |
|
||||
//时间戳改变,毫秒内序列重置
|
|
||||
else { |
|
||||
sequence = 0L; |
|
||||
} |
|
||||
|
|
||||
//上次生成ID的时间截
|
|
||||
lastTimestamp = timestamp; |
|
||||
|
|
||||
//移位并通过或运算拼到一起组成64位的ID
|
|
||||
return ((timestamp - twepoch) << timestampLeftShift) //
|
|
||||
| (datacenterId << datacenterIdShift) //
|
|
||||
| (workerId << workerIdShift) //
|
|
||||
| sequence; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 阻塞到下一个毫秒,直到获得新的时间戳 |
|
||||
* |
|
||||
* @param lastTimestamp 上次生成ID的时间截 |
|
||||
* @return 当前时间戳 |
|
||||
*/ |
|
||||
protected long tilNextMillis(long lastTimestamp) { |
|
||||
long timestamp = timeGen(); |
|
||||
while (timestamp <= lastTimestamp) { |
|
||||
timestamp = timeGen(); |
|
||||
} |
|
||||
return timestamp; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 返回以毫秒为单位的当前时间 |
|
||||
* |
|
||||
* @return 当前时间(毫秒) |
|
||||
*/ |
|
||||
protected long timeGen() { |
|
||||
return System.currentTimeMillis(); |
|
||||
} |
|
||||
|
|
||||
//==============================Test=============================================
|
|
||||
|
|
||||
/** |
|
||||
* 测试 |
|
||||
*/ |
|
||||
public static void main(String[] args) { |
|
||||
SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1); |
|
||||
System.out.println(idWorker.nextId()); |
|
||||
} |
|
||||
|
|
||||
} |
|
Loading…
Reference in new issue