Commit f29b435366a0b84669bc4eb533aa0b45a82cba81

Authored by unknown
1 parent b769b0dc
Exists in master

1.去除web相关的gradle配置,保证正常发布到nexus

.mvn/jvm.config
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 --Xmx1536m  
2 \ No newline at end of file 0 \ No newline at end of file
.mvn/wrapper/maven-wrapper.jar
No preview for this file type
.mvn/wrapper/maven-wrapper.properties
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -distributionUrl=https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.zip  
2 -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar  
3 \ No newline at end of file 0 \ No newline at end of file
bak.mvnw 0 → 100644
@@ -0,0 +1,305 @@ @@ -0,0 +1,305 @@
  1 +#!/bin/sh
  2 +# ----------------------------------------------------------------------------
  3 +# Licensed to the Apache Software Foundation (ASF) under one
  4 +# or more contributor license agreements. See the NOTICE file
  5 +# distributed with this work for additional information
  6 +# regarding copyright ownership. The ASF licenses this file
  7 +# to you under the Apache License, Version 2.0 (the
  8 +# "License"); you may not use this file except in compliance
  9 +# with the License. You may obtain a copy of the License at
  10 +#
  11 +# https://www.apache.org/licenses/LICENSE-2.0
  12 +#
  13 +# Unless required by applicable law or agreed to in writing,
  14 +# software distributed under the License is distributed on an
  15 +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16 +# KIND, either express or implied. See the License for the
  17 +# specific language governing permissions and limitations
  18 +# under the License.
  19 +# ----------------------------------------------------------------------------
  20 +
  21 +# ----------------------------------------------------------------------------
  22 +# Maven2 Start Up Batch script
  23 +#
  24 +# Required ENV vars:
  25 +# ------------------
  26 +# JAVA_HOME - location of a JDK home dir
  27 +#
  28 +# Optional ENV vars
  29 +# -----------------
  30 +# M2_HOME - location of maven2's installed home dir
  31 +# MAVEN_OPTS - parameters passed to the Java VM when running Maven
  32 +# e.g. to debug Maven itself, use
  33 +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
  34 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
  35 +# ----------------------------------------------------------------------------
  36 +
  37 +if [ -z "$MAVEN_SKIP_RC" ] ; then
  38 +
  39 + if [ -f /etc/mavenrc ] ; then
  40 + . /etc/mavenrc
  41 + fi
  42 +
  43 + if [ -f "$HOME/.mavenrc" ] ; then
  44 + . "$HOME/.mavenrc"
  45 + fi
  46 +
  47 +fi
  48 +
  49 +# OS specific support. $var _must_ be set to either true or false.
  50 +cygwin=false;
  51 +darwin=false;
  52 +mingw=false
  53 +case "`uname`" in
  54 + CYGWIN*) cygwin=true ;;
  55 + MINGW*) mingw=true;;
  56 + Darwin*) darwin=true
  57 + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
  58 + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
  59 + if [ -z "$JAVA_HOME" ]; then
  60 + if [ -x "/usr/libexec/java_home" ]; then
  61 + export JAVA_HOME="`/usr/libexec/java_home`"
  62 + else
  63 + export JAVA_HOME="/Library/Java/Home"
  64 + fi
  65 + fi
  66 + ;;
  67 +esac
  68 +
  69 +if [ -z "$JAVA_HOME" ] ; then
  70 + if [ -r /etc/gentoo-release ] ; then
  71 + JAVA_HOME=`java-config --jre-home`
  72 + fi
  73 +fi
  74 +
  75 +if [ -z "$M2_HOME" ] ; then
  76 + ## resolve links - $0 may be a link to maven's home
  77 + PRG="$0"
  78 +
  79 + # need this for relative symlinks
  80 + while [ -h "$PRG" ] ; do
  81 + ls=`ls -ld "$PRG"`
  82 + link=`expr "$ls" : '.*-> \(.*\)$'`
  83 + if expr "$link" : '/.*' > /dev/null; then
  84 + PRG="$link"
  85 + else
  86 + PRG="`dirname "$PRG"`/$link"
  87 + fi
  88 + done
  89 +
  90 + saveddir=`pwd`
  91 +
  92 + M2_HOME=`dirname "$PRG"`/..
  93 +
  94 + # make it fully qualified
  95 + M2_HOME=`cd "$M2_HOME" && pwd`
  96 +
  97 + cd "$saveddir"
  98 + # echo Using m2 at $M2_HOME
  99 +fi
  100 +
  101 +# For Cygwin, ensure paths are in UNIX format before anything is touched
  102 +if $cygwin ; then
  103 + [ -n "$M2_HOME" ] &&
  104 + M2_HOME=`cygpath --unix "$M2_HOME"`
  105 + [ -n "$JAVA_HOME" ] &&
  106 + JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  107 + [ -n "$CLASSPATH" ] &&
  108 + CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
  109 +fi
  110 +
  111 +# For Mingw, ensure paths are in UNIX format before anything is touched
  112 +if $mingw ; then
  113 + [ -n "$M2_HOME" ] &&
  114 + M2_HOME="`(cd "$M2_HOME"; pwd)`"
  115 + [ -n "$JAVA_HOME" ] &&
  116 + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
  117 +fi
  118 +
  119 +if [ -z "$JAVA_HOME" ]; then
  120 + javaExecutable="`which javac`"
  121 + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
  122 + # readlink(1) is not available as standard on Solaris 10.
  123 + readLink=`which readlink`
  124 + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
  125 + if $darwin ; then
  126 + javaHome="`dirname \"$javaExecutable\"`"
  127 + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
  128 + else
  129 + javaExecutable="`readlink -f \"$javaExecutable\"`"
  130 + fi
  131 + javaHome="`dirname \"$javaExecutable\"`"
  132 + javaHome=`expr "$javaHome" : '\(.*\)/bin'`
  133 + JAVA_HOME="$javaHome"
  134 + export JAVA_HOME
  135 + fi
  136 + fi
  137 +fi
  138 +
  139 +if [ -z "$JAVACMD" ] ; then
  140 + if [ -n "$JAVA_HOME" ] ; then
  141 + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
  142 + # IBM's JDK on AIX uses strange locations for the executables
  143 + JAVACMD="$JAVA_HOME/jre/sh/java"
  144 + else
  145 + JAVACMD="$JAVA_HOME/bin/java"
  146 + fi
  147 + else
  148 + JAVACMD="`which java`"
  149 + fi
  150 +fi
  151 +
  152 +if [ ! -x "$JAVACMD" ] ; then
  153 + echo "Error: JAVA_HOME is not defined correctly." >&2
  154 + echo " We cannot execute $JAVACMD" >&2
  155 + exit 1
  156 +fi
  157 +
  158 +if [ -z "$JAVA_HOME" ] ; then
  159 + echo "Warning: JAVA_HOME environment variable is not set."
  160 +fi
  161 +
  162 +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
  163 +
  164 +# traverses directory structure from process work directory to filesystem root
  165 +# first directory with .mvn subdirectory is considered project base directory
  166 +find_maven_basedir() {
  167 +
  168 + if [ -z "$1" ]
  169 + then
  170 + echo "Path not specified to find_maven_basedir"
  171 + return 1
  172 + fi
  173 +
  174 + basedir="$1"
  175 + wdir="$1"
  176 + while [ "$wdir" != '/' ] ; do
  177 + if [ -d "$wdir"/.mvn ] ; then
  178 + basedir=$wdir
  179 + break
  180 + fi
  181 + # workaround for JBEAP-8937 (on Solaris 10/Sparc)
  182 + if [ -d "${wdir}" ]; then
  183 + wdir=`cd "$wdir/.."; pwd`
  184 + fi
  185 + # end of workaround
  186 + done
  187 + echo "${basedir}"
  188 +}
  189 +
  190 +# concatenates all lines of a file
  191 +concat_lines() {
  192 + if [ -f "$1" ]; then
  193 + echo "$(tr -s '\n' ' ' < "$1")"
  194 + fi
  195 +}
  196 +
  197 +BASE_DIR=`find_maven_basedir "$(pwd)"`
  198 +if [ -z "$BASE_DIR" ]; then
  199 + exit 1;
  200 +fi
  201 +
  202 +##########################################################################################
  203 +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
  204 +# This allows using the maven wrapper in projects that prohibit checking in binary data.
  205 +##########################################################################################
  206 +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
  207 + if [ "$MVNW_VERBOSE" = true ]; then
  208 + echo "Found .mvn/wrapper/maven-wrapper.jar"
  209 + fi
  210 +else
  211 + if [ "$MVNW_VERBOSE" = true ]; then
  212 + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
  213 + fi
  214 + if [ -n "$MVNW_REPOURL" ]; then
  215 + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"
  216 + else
  217 + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"
  218 + fi
  219 + while IFS="=" read key value; do
  220 + case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
  221 + esac
  222 + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
  223 + if [ "$MVNW_VERBOSE" = true ]; then
  224 + echo "Downloading from: $jarUrl"
  225 + fi
  226 + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
  227 + if $cygwin; then
  228 + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
  229 + fi
  230 +
  231 + if command -v wget > /dev/null; then
  232 + if [ "$MVNW_VERBOSE" = true ]; then
  233 + echo "Found wget ... using wget"
  234 + fi
  235 + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
  236 + wget "$jarUrl" -O "$wrapperJarPath"
  237 + else
  238 + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
  239 + fi
  240 + elif command -v curl > /dev/null; then
  241 + if [ "$MVNW_VERBOSE" = true ]; then
  242 + echo "Found curl ... using curl"
  243 + fi
  244 + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
  245 + curl -o "$wrapperJarPath" "$jarUrl" -f
  246 + else
  247 + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
  248 + fi
  249 +
  250 + else
  251 + if [ "$MVNW_VERBOSE" = true ]; then
  252 + echo "Falling back to using Java to download"
  253 + fi
  254 + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
  255 + # For Cygwin, switch paths to Windows format before running javac
  256 + if $cygwin; then
  257 + javaClass=`cygpath --path --windows "$javaClass"`
  258 + fi
  259 + if [ -e "$javaClass" ]; then
  260 + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
  261 + if [ "$MVNW_VERBOSE" = true ]; then
  262 + echo " - Compiling MavenWrapperDownloader.java ..."
  263 + fi
  264 + # Compiling the Java class
  265 + ("$JAVA_HOME/bin/javac" "$javaClass")
  266 + fi
  267 + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
  268 + # Running the downloader
  269 + if [ "$MVNW_VERBOSE" = true ]; then
  270 + echo " - Running MavenWrapperDownloader.java ..."
  271 + fi
  272 + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
  273 + fi
  274 + fi
  275 + fi
  276 +fi
  277 +##########################################################################################
  278 +# End of extension
  279 +##########################################################################################
  280 +
  281 +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
  282 +if [ "$MVNW_VERBOSE" = true ]; then
  283 + echo $MAVEN_PROJECTBASEDIR
  284 +fi
  285 +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
  286 +
  287 +# For Cygwin, switch paths to Windows format before running java
  288 +if $cygwin; then
  289 + [ -n "$M2_HOME" ] &&
  290 + M2_HOME=`cygpath --path --windows "$M2_HOME"`
  291 + [ -n "$JAVA_HOME" ] &&
  292 + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  293 + [ -n "$CLASSPATH" ] &&
  294 + CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  295 + [ -n "$MAVEN_PROJECTBASEDIR" ] &&
  296 + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
  297 +fi
  298 +
  299 +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
  300 +
  301 +exec "$JAVACMD" \
  302 + $MAVEN_OPTS \
  303 + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
  304 + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
  305 + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
bak.mvnw.cmd 0 → 100644
@@ -0,0 +1,172 @@ @@ -0,0 +1,172 @@
  1 +@REM ----------------------------------------------------------------------------
  2 +@REM Licensed to the Apache Software Foundation (ASF) under one
  3 +@REM or more contributor license agreements. See the NOTICE file
  4 +@REM distributed with this work for additional information
  5 +@REM regarding copyright ownership. The ASF licenses this file
  6 +@REM to you under the Apache License, Version 2.0 (the
  7 +@REM "License"); you may not use this file except in compliance
  8 +@REM with the License. You may obtain a copy of the License at
  9 +@REM
  10 +@REM https://www.apache.org/licenses/LICENSE-2.0
  11 +@REM
  12 +@REM Unless required by applicable law or agreed to in writing,
  13 +@REM software distributed under the License is distributed on an
  14 +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15 +@REM KIND, either express or implied. See the License for the
  16 +@REM specific language governing permissions and limitations
  17 +@REM under the License.
  18 +@REM ----------------------------------------------------------------------------
  19 +
  20 +@REM ----------------------------------------------------------------------------
  21 +@REM Maven2 Start Up Batch script
  22 +@REM
  23 +@REM Required ENV vars:
  24 +@REM JAVA_HOME - location of a JDK home dir
  25 +@REM
  26 +@REM Optional ENV vars
  27 +@REM M2_HOME - location of maven2's installed home dir
  28 +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
  29 +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
  30 +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
  31 +@REM e.g. to debug Maven itself, use
  32 +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
  33 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
  34 +@REM ----------------------------------------------------------------------------
  35 +
  36 +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
  37 +@echo off
  38 +@REM set title of command window
  39 +title %0
  40 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
  41 +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
  42 +
  43 +@REM set %HOME% to equivalent of $HOME
  44 +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
  45 +
  46 +@REM Execute a user defined script before this one
  47 +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
  48 +@REM check for pre script, once with legacy .bat ending and once with .cmd ending
  49 +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
  50 +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
  51 +:skipRcPre
  52 +
  53 +@setlocal
  54 +
  55 +set ERROR_CODE=0
  56 +
  57 +@REM To isolate internal variables from possible post scripts, we use another setlocal
  58 +@setlocal
  59 +
  60 +@REM ==== START VALIDATION ====
  61 +if not "%JAVA_HOME%" == "" goto OkJHome
  62 +
  63 +echo.
  64 +echo Error: JAVA_HOME not found in your environment. >&2
  65 +echo Please set the JAVA_HOME variable in your environment to match the >&2
  66 +echo location of your Java installation. >&2
  67 +echo.
  68 +goto error
  69 +
  70 +:OkJHome
  71 +if exist "%JAVA_HOME%\bin\java.exe" goto init
  72 +
  73 +echo.
  74 +echo Error: JAVA_HOME is set to an invalid directory. >&2
  75 +echo JAVA_HOME = "%JAVA_HOME%" >&2
  76 +echo Please set the JAVA_HOME variable in your environment to match the >&2
  77 +echo location of your Java installation. >&2
  78 +echo.
  79 +goto error
  80 +
  81 +@REM ==== END VALIDATION ====
  82 +
  83 +:init
  84 +
  85 +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
  86 +@REM Fallback to current working directory if not found.
  87 +
  88 +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
  89 +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
  90 +
  91 +set EXEC_DIR=%CD%
  92 +set WDIR=%EXEC_DIR%
  93 +:findBaseDir
  94 +IF EXIST "%WDIR%"\.mvn goto baseDirFound
  95 +cd ..
  96 +IF "%WDIR%"=="%CD%" goto baseDirNotFound
  97 +set WDIR=%CD%
  98 +goto findBaseDir
  99 +
  100 +:baseDirFound
  101 +set MAVEN_PROJECTBASEDIR=%WDIR%
  102 +cd "%EXEC_DIR%"
  103 +goto endDetectBaseDir
  104 +
  105 +:baseDirNotFound
  106 +set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
  107 +cd "%EXEC_DIR%"
  108 +
  109 +:endDetectBaseDir
  110 +
  111 +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
  112 +
  113 +@setlocal EnableExtensions EnableDelayedExpansion
  114 +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
  115 +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
  116 +
  117 +:endReadAdditionalConfig
  118 +
  119 +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
  120 +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
  121 +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
  122 +
  123 +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"
  124 +
  125 +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
  126 + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
  127 +)
  128 +
  129 +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
  130 +@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
  131 +if exist %WRAPPER_JAR% (
  132 + echo Found %WRAPPER_JAR%
  133 +) else (
  134 + if not "%MVNW_REPOURL%" == "" (
  135 + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"
  136 + )
  137 + echo Couldn't find %WRAPPER_JAR%, downloading it ...
  138 + echo Downloading from: %DOWNLOAD_URL%
  139 +
  140 + powershell -Command "&{"^
  141 + "$webclient = new-object System.Net.WebClient;"^
  142 + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
  143 + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
  144 + "}"^
  145 + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
  146 + "}"
  147 + echo Finished downloading %WRAPPER_JAR%
  148 +)
  149 +@REM End of extension
  150 +
  151 +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
  152 +if ERRORLEVEL 1 goto error
  153 +goto end
  154 +
  155 +:error
  156 +set ERROR_CODE=1
  157 +
  158 +:end
  159 +@endlocal & set ERROR_CODE=%ERROR_CODE%
  160 +
  161 +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
  162 +@REM check for post script, once with legacy .bat ending and once with .cmd ending
  163 +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
  164 +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
  165 +:skipRcPost
  166 +
  167 +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
  168 +if "%MAVEN_BATCH_PAUSE%" == "on" pause
  169 +
  170 +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
  171 +
  172 +exit /B %ERROR_CODE%
bak.pom.xml 0 → 100644
@@ -0,0 +1,237 @@ @@ -0,0 +1,237 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4 + <modelVersion>4.0.0</modelVersion>
  5 + <groupId>com.alibaba</groupId>
  6 + <artifactId>easyexcel</artifactId>
  7 + <version>2.2.5</version>
  8 + <packaging>jar</packaging>
  9 + <name>easyexcel</name>
  10 +
  11 + <description>easyexcel is a excel handle tools written in Java</description>
  12 +
  13 + <url>https://github.com/alibaba/easyexcel</url>
  14 + <inceptionYear>2018</inceptionYear>
  15 +
  16 +
  17 + <properties>
  18 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  19 + <jdk.version>1.6</jdk.version>
  20 + <gpg.skip>true</gpg.skip>
  21 + <maven.javadoc.skip>true</maven.javadoc.skip>
  22 + </properties>
  23 +
  24 + <scm>
  25 + <url>https://github.com/alibaba/easyexcel</url>
  26 + <connection>scm:git:https://git@github.com/alibaba/easyexcel.git</connection>
  27 + </scm>
  28 +
  29 + <!--<repositories>-->
  30 + <!--<repository>-->
  31 + <!--<id>local-file</id>-->
  32 + <!--<url>file://${basedir}/lib/</url>-->
  33 + <!--<layout>default</layout>-->
  34 + <!--</repository>-->
  35 + <!--</repositories>-->
  36 +
  37 + <organization>
  38 + <name>Alibaba Group</name>
  39 + <url>https://github.com/alibaba</url>
  40 + </organization>
  41 +
  42 + <developers>
  43 + <developer>
  44 + <id>jipengfei</id>
  45 + <name>jipengfei</name>
  46 + <email>1558143046@qq.com</email>
  47 + </developer>
  48 + </developers>
  49 +
  50 + <licenses>
  51 + <license>
  52 + <name>Apache 2</name>
  53 + <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
  54 + <distribution>repo</distribution>
  55 + <comments>A business-friendly OSS license</comments>
  56 + </license>
  57 + </licenses>
  58 +
  59 + <dependencies>
  60 + <dependency>
  61 + <groupId>org.apache.poi</groupId>
  62 + <artifactId>poi</artifactId>
  63 + <version>3.17</version>
  64 + </dependency>
  65 + <dependency>
  66 + <groupId>org.apache.poi</groupId>
  67 + <artifactId>poi-ooxml</artifactId>
  68 + <version>3.17</version>
  69 + </dependency>
  70 + <dependency>
  71 + <groupId>org.apache.poi</groupId>
  72 + <artifactId>poi-ooxml-schemas</artifactId>
  73 + <version>3.17</version>
  74 + </dependency>
  75 + <dependency>
  76 + <groupId>cglib</groupId>
  77 + <artifactId>cglib</artifactId>
  78 + <version>3.1</version>
  79 + </dependency>
  80 + <dependency>
  81 + <groupId>org.slf4j</groupId>
  82 + <artifactId>slf4j-api</artifactId>
  83 + <version>1.7.26</version>
  84 + </dependency>
  85 + <dependency>
  86 + <groupId>org.ehcache</groupId>
  87 + <artifactId>ehcache</artifactId>
  88 + <version>3.4.0</version>
  89 + </dependency>
  90 + <!--test-->
  91 + <dependency>
  92 + <groupId>ch.qos.logback</groupId>
  93 + <artifactId>logback-classic</artifactId>
  94 + <version>1.2.3</version>
  95 + <scope>test</scope>
  96 + </dependency>
  97 + <dependency>
  98 + <groupId>com.alibaba</groupId>
  99 + <artifactId>fastjson</artifactId>
  100 + <version>1.2.71</version>
  101 + <scope>test</scope>
  102 + </dependency>
  103 + <dependency>
  104 + <groupId>org.projectlombok</groupId>
  105 + <artifactId>lombok</artifactId>
  106 + <version>1.18.8</version>
  107 + <scope>test</scope>
  108 + </dependency>
  109 + <dependency>
  110 + <groupId>org.springframework.boot</groupId>
  111 + <artifactId>spring-boot</artifactId>
  112 + <version>1.5.21.RELEASE</version>
  113 + <scope>test</scope>
  114 + </dependency>
  115 + <dependency>
  116 + <groupId>org.springframework.boot</groupId>
  117 + <artifactId>spring-boot-starter-web</artifactId>
  118 + <version>1.5.21.RELEASE</version>
  119 + <scope>test</scope>
  120 + </dependency>
  121 + <dependency>
  122 + <groupId>junit</groupId>
  123 + <artifactId>junit</artifactId>
  124 + <version>4.12</version>
  125 + <scope>test</scope>
  126 + </dependency>
  127 + </dependencies>
  128 + <distributionManagement>
  129 + <snapshotRepository>
  130 + <id>ossrh</id>
  131 + <url>https://oss.sonatype.org/content/repositories/snapshots</url>
  132 + </snapshotRepository>
  133 + <repository>
  134 + <id>ossrh</id>
  135 + <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
  136 + </repository>
  137 + </distributionManagement>
  138 +
  139 + <build>
  140 + <plugins>
  141 + <!-- code style -->
  142 + <plugin>
  143 + <groupId>org.apache.maven.plugins</groupId>
  144 + <artifactId>maven-pmd-plugin</artifactId>
  145 + <version>3.8</version>
  146 + <configuration>
  147 + <printFailingErrors>true</printFailingErrors>
  148 + <verbose>true</verbose>
  149 + <rulesets>
  150 + <ruleset>rulesets/java/ali-comment.xml</ruleset>
  151 + <ruleset>rulesets/java/ali-concurrent.xml</ruleset>
  152 + <ruleset>rulesets/java/ali-constant.xml</ruleset>
  153 + <ruleset>rulesets/java/ali-exception.xml</ruleset>
  154 + <ruleset>rulesets/java/ali-flowcontrol.xml</ruleset>
  155 + <ruleset>rulesets/java/ali-naming.xml</ruleset>
  156 + <ruleset>rulesets/java/ali-oop.xml</ruleset>
  157 + <ruleset>rulesets/java/ali-orm.xml</ruleset>
  158 + <ruleset>rulesets/java/ali-other.xml</ruleset>
  159 + <ruleset>rulesets/java/ali-set.xml</ruleset>
  160 + </rulesets>
  161 + <excludes>
  162 + <exclude>com/alibaba/excel/event/AnalysisEventListener.java</exclude>
  163 + <exclude>com/alibaba/excel/metadata/DataFormatter.java</exclude>
  164 + <exclude>com/alibaba/excel/util/DateUtils.java</exclude>
  165 + <exclude>com/alibaba/excel/metadata/format/DataFormatter.java</exclude>
  166 + <exclude>com/alibaba/excel/metadata/format/ExcelGeneralNumberFormat.java</exclude>
  167 + </excludes>
  168 + </configuration>
  169 + <executions>
  170 + <execution>
  171 + <id>pmd-check-verify</id>
  172 + <phase>validate</phase>
  173 + <goals>
  174 + <goal>check</goal>
  175 + </goals>
  176 + </execution>
  177 + </executions>
  178 + <dependencies>
  179 + <dependency>
  180 + <groupId>com.alibaba.p3c</groupId>
  181 + <artifactId>p3c-pmd</artifactId>
  182 + <version>1.3.6</version>
  183 + </dependency>
  184 + </dependencies>
  185 + </plugin>
  186 + <plugin>
  187 + <groupId>org.apache.maven.plugins</groupId>
  188 + <artifactId>maven-compiler-plugin</artifactId>
  189 + <configuration>
  190 + <source>1.6</source>
  191 + <target>1.6</target>
  192 + </configuration>
  193 + </plugin>
  194 + <plugin>
  195 + <artifactId>maven-source-plugin</artifactId>
  196 + <version>2.1</version>
  197 + <configuration>
  198 + <attach>true</attach>
  199 + </configuration>
  200 + <executions>
  201 + <execution>
  202 + <phase>compile</phase>
  203 + <goals>
  204 + <goal>jar</goal>
  205 + </goals>
  206 + </execution>
  207 + </executions>
  208 + </plugin>
  209 + <plugin>
  210 + <groupId>org.apache.maven.plugins</groupId>
  211 + <artifactId>maven-gpg-plugin</artifactId>
  212 + <version>1.6</version>
  213 + <executions>
  214 + <execution>
  215 + <phase>verify</phase>
  216 + <goals>
  217 + <goal>sign</goal>
  218 + </goals>
  219 + </execution>
  220 + </executions>
  221 + </plugin>
  222 + <plugin>
  223 + <groupId>org.apache.maven.plugins</groupId>
  224 + <artifactId>maven-javadoc-plugin</artifactId>
  225 + <version>3.1.0</version>
  226 + <executions>
  227 + <execution>
  228 + <id>attach-javadocs</id>
  229 + <goals>
  230 + <goal>jar</goal>
  231 + </goals>
  232 + </execution>
  233 + </executions>
  234 + </plugin>
  235 + </plugins>
  236 + </build>
  237 +</project>
bin/.gitignore
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -/com/  
1 -/*  
2 - * This file was generated by the Gradle 'init' task.  
3 - *  
4 - * This generated file contains a sample Java Library project to get you started.  
5 - * For more details take a look at the Java Libraries chapter in the Gradle  
6 - * user guide available at https://docs.gradle.org/4.5.1/userguide/java_library_plugin.html  
7 - */  
8 -buildscript {  
9 - repositories {  
10 - mavenCentral()  
11 -  
12 - }  
13 - dependencies {  
14 - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE")  
15 - }  
16 -}  
17 1
18 apply plugin: 'java' 2 apply plugin: 'java'
19 apply plugin: 'eclipse' 3 apply plugin: 'eclipse'
20 apply plugin: 'application' 4 apply plugin: 'application'
21 -apply plugin: 'org.springframework.boot'  
22 -apply plugin: 'io.spring.dependency-management'  
23 apply plugin: 'maven' 5 apply plugin: 'maven'
24 6
25 jar.enabled = true 7 jar.enabled = true
@@ -37,8 +19,6 @@ dependencies { @@ -37,8 +19,6 @@ dependencies {
37 "ch.qos.logback:logback-classic:1.2.3", 19 "ch.qos.logback:logback-classic:1.2.3",
38 "com.alibaba:fastjson:1.2.71", 20 "com.alibaba:fastjson:1.2.71",
39 "org.projectlombok:lombok:1.18.8", 21 "org.projectlombok:lombok:1.18.8",
40 - "org.springframework.boot:spring-boot",  
41 - "org.springframework.boot:spring-boot-starter-web",  
42 "junit:junit:4.12" 22 "junit:junit:4.12"
43 ) 23 )
44 } 24 }
@@ -74,7 +54,7 @@ uploadArchives { @@ -74,7 +54,7 @@ uploadArchives {
74 authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) 54 authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD)
75 } 55 }
76 pom.project { 56 pom.project {
77 - version '2.2.5' 57 + version '2.2.8'
78 artifactId ARTIFACT_Id 58 artifactId ARTIFACT_Id
79 groupId GROUP_ID 59 groupId GROUP_ID
80 packaging TYPE 60 packaging TYPE
@@ -1,305 +0,0 @@ @@ -1,305 +0,0 @@
1 -#!/bin/sh  
2 -# ----------------------------------------------------------------------------  
3 -# Licensed to the Apache Software Foundation (ASF) under one  
4 -# or more contributor license agreements. See the NOTICE file  
5 -# distributed with this work for additional information  
6 -# regarding copyright ownership. The ASF licenses this file  
7 -# to you under the Apache License, Version 2.0 (the  
8 -# "License"); you may not use this file except in compliance  
9 -# with the License. You may obtain a copy of the License at  
10 -#  
11 -# https://www.apache.org/licenses/LICENSE-2.0  
12 -#  
13 -# Unless required by applicable law or agreed to in writing,  
14 -# software distributed under the License is distributed on an  
15 -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY  
16 -# KIND, either express or implied. See the License for the  
17 -# specific language governing permissions and limitations  
18 -# under the License.  
19 -# ----------------------------------------------------------------------------  
20 -  
21 -# ----------------------------------------------------------------------------  
22 -# Maven2 Start Up Batch script  
23 -#  
24 -# Required ENV vars:  
25 -# ------------------  
26 -# JAVA_HOME - location of a JDK home dir  
27 -#  
28 -# Optional ENV vars  
29 -# -----------------  
30 -# M2_HOME - location of maven2's installed home dir  
31 -# MAVEN_OPTS - parameters passed to the Java VM when running Maven  
32 -# e.g. to debug Maven itself, use  
33 -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000  
34 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files  
35 -# ----------------------------------------------------------------------------  
36 -  
37 -if [ -z "$MAVEN_SKIP_RC" ] ; then  
38 -  
39 - if [ -f /etc/mavenrc ] ; then  
40 - . /etc/mavenrc  
41 - fi  
42 -  
43 - if [ -f "$HOME/.mavenrc" ] ; then  
44 - . "$HOME/.mavenrc"  
45 - fi  
46 -  
47 -fi  
48 -  
49 -# OS specific support. $var _must_ be set to either true or false.  
50 -cygwin=false;  
51 -darwin=false;  
52 -mingw=false  
53 -case "`uname`" in  
54 - CYGWIN*) cygwin=true ;;  
55 - MINGW*) mingw=true;;  
56 - Darwin*) darwin=true  
57 - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home  
58 - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html  
59 - if [ -z "$JAVA_HOME" ]; then  
60 - if [ -x "/usr/libexec/java_home" ]; then  
61 - export JAVA_HOME="`/usr/libexec/java_home`"  
62 - else  
63 - export JAVA_HOME="/Library/Java/Home"  
64 - fi  
65 - fi  
66 - ;;  
67 -esac  
68 -  
69 -if [ -z "$JAVA_HOME" ] ; then  
70 - if [ -r /etc/gentoo-release ] ; then  
71 - JAVA_HOME=`java-config --jre-home`  
72 - fi  
73 -fi  
74 -  
75 -if [ -z "$M2_HOME" ] ; then  
76 - ## resolve links - $0 may be a link to maven's home  
77 - PRG="$0"  
78 -  
79 - # need this for relative symlinks  
80 - while [ -h "$PRG" ] ; do  
81 - ls=`ls -ld "$PRG"`  
82 - link=`expr "$ls" : '.*-> \(.*\)$'`  
83 - if expr "$link" : '/.*' > /dev/null; then  
84 - PRG="$link"  
85 - else  
86 - PRG="`dirname "$PRG"`/$link"  
87 - fi  
88 - done  
89 -  
90 - saveddir=`pwd`  
91 -  
92 - M2_HOME=`dirname "$PRG"`/..  
93 -  
94 - # make it fully qualified  
95 - M2_HOME=`cd "$M2_HOME" && pwd`  
96 -  
97 - cd "$saveddir"  
98 - # echo Using m2 at $M2_HOME  
99 -fi  
100 -  
101 -# For Cygwin, ensure paths are in UNIX format before anything is touched  
102 -if $cygwin ; then  
103 - [ -n "$M2_HOME" ] &&  
104 - M2_HOME=`cygpath --unix "$M2_HOME"`  
105 - [ -n "$JAVA_HOME" ] &&  
106 - JAVA_HOME=`cygpath --unix "$JAVA_HOME"`  
107 - [ -n "$CLASSPATH" ] &&  
108 - CLASSPATH=`cygpath --path --unix "$CLASSPATH"`  
109 -fi  
110 -  
111 -# For Mingw, ensure paths are in UNIX format before anything is touched  
112 -if $mingw ; then  
113 - [ -n "$M2_HOME" ] &&  
114 - M2_HOME="`(cd "$M2_HOME"; pwd)`"  
115 - [ -n "$JAVA_HOME" ] &&  
116 - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"  
117 -fi  
118 -  
119 -if [ -z "$JAVA_HOME" ]; then  
120 - javaExecutable="`which javac`"  
121 - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then  
122 - # readlink(1) is not available as standard on Solaris 10.  
123 - readLink=`which readlink`  
124 - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then  
125 - if $darwin ; then  
126 - javaHome="`dirname \"$javaExecutable\"`"  
127 - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"  
128 - else  
129 - javaExecutable="`readlink -f \"$javaExecutable\"`"  
130 - fi  
131 - javaHome="`dirname \"$javaExecutable\"`"  
132 - javaHome=`expr "$javaHome" : '\(.*\)/bin'`  
133 - JAVA_HOME="$javaHome"  
134 - export JAVA_HOME  
135 - fi  
136 - fi  
137 -fi  
138 -  
139 -if [ -z "$JAVACMD" ] ; then  
140 - if [ -n "$JAVA_HOME" ] ; then  
141 - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then  
142 - # IBM's JDK on AIX uses strange locations for the executables  
143 - JAVACMD="$JAVA_HOME/jre/sh/java"  
144 - else  
145 - JAVACMD="$JAVA_HOME/bin/java"  
146 - fi  
147 - else  
148 - JAVACMD="`which java`"  
149 - fi  
150 -fi  
151 -  
152 -if [ ! -x "$JAVACMD" ] ; then  
153 - echo "Error: JAVA_HOME is not defined correctly." >&2  
154 - echo " We cannot execute $JAVACMD" >&2  
155 - exit 1  
156 -fi  
157 -  
158 -if [ -z "$JAVA_HOME" ] ; then  
159 - echo "Warning: JAVA_HOME environment variable is not set."  
160 -fi  
161 -  
162 -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher  
163 -  
164 -# traverses directory structure from process work directory to filesystem root  
165 -# first directory with .mvn subdirectory is considered project base directory  
166 -find_maven_basedir() {  
167 -  
168 - if [ -z "$1" ]  
169 - then  
170 - echo "Path not specified to find_maven_basedir"  
171 - return 1  
172 - fi  
173 -  
174 - basedir="$1"  
175 - wdir="$1"  
176 - while [ "$wdir" != '/' ] ; do  
177 - if [ -d "$wdir"/.mvn ] ; then  
178 - basedir=$wdir  
179 - break  
180 - fi  
181 - # workaround for JBEAP-8937 (on Solaris 10/Sparc)  
182 - if [ -d "${wdir}" ]; then  
183 - wdir=`cd "$wdir/.."; pwd`  
184 - fi  
185 - # end of workaround  
186 - done  
187 - echo "${basedir}"  
188 -}  
189 -  
190 -# concatenates all lines of a file  
191 -concat_lines() {  
192 - if [ -f "$1" ]; then  
193 - echo "$(tr -s '\n' ' ' < "$1")"  
194 - fi  
195 -}  
196 -  
197 -BASE_DIR=`find_maven_basedir "$(pwd)"`  
198 -if [ -z "$BASE_DIR" ]; then  
199 - exit 1;  
200 -fi  
201 -  
202 -##########################################################################################  
203 -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central  
204 -# This allows using the maven wrapper in projects that prohibit checking in binary data.  
205 -##########################################################################################  
206 -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then  
207 - if [ "$MVNW_VERBOSE" = true ]; then  
208 - echo "Found .mvn/wrapper/maven-wrapper.jar"  
209 - fi  
210 -else  
211 - if [ "$MVNW_VERBOSE" = true ]; then  
212 - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."  
213 - fi  
214 - if [ -n "$MVNW_REPOURL" ]; then  
215 - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"  
216 - else  
217 - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"  
218 - fi  
219 - while IFS="=" read key value; do  
220 - case "$key" in (wrapperUrl) jarUrl="$value"; break ;;  
221 - esac  
222 - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"  
223 - if [ "$MVNW_VERBOSE" = true ]; then  
224 - echo "Downloading from: $jarUrl"  
225 - fi  
226 - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"  
227 - if $cygwin; then  
228 - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`  
229 - fi  
230 -  
231 - if command -v wget > /dev/null; then  
232 - if [ "$MVNW_VERBOSE" = true ]; then  
233 - echo "Found wget ... using wget"  
234 - fi  
235 - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then  
236 - wget "$jarUrl" -O "$wrapperJarPath"  
237 - else  
238 - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"  
239 - fi  
240 - elif command -v curl > /dev/null; then  
241 - if [ "$MVNW_VERBOSE" = true ]; then  
242 - echo "Found curl ... using curl"  
243 - fi  
244 - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then  
245 - curl -o "$wrapperJarPath" "$jarUrl" -f  
246 - else  
247 - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f  
248 - fi  
249 -  
250 - else  
251 - if [ "$MVNW_VERBOSE" = true ]; then  
252 - echo "Falling back to using Java to download"  
253 - fi  
254 - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"  
255 - # For Cygwin, switch paths to Windows format before running javac  
256 - if $cygwin; then  
257 - javaClass=`cygpath --path --windows "$javaClass"`  
258 - fi  
259 - if [ -e "$javaClass" ]; then  
260 - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then  
261 - if [ "$MVNW_VERBOSE" = true ]; then  
262 - echo " - Compiling MavenWrapperDownloader.java ..."  
263 - fi  
264 - # Compiling the Java class  
265 - ("$JAVA_HOME/bin/javac" "$javaClass")  
266 - fi  
267 - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then  
268 - # Running the downloader  
269 - if [ "$MVNW_VERBOSE" = true ]; then  
270 - echo " - Running MavenWrapperDownloader.java ..."  
271 - fi  
272 - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")  
273 - fi  
274 - fi  
275 - fi  
276 -fi  
277 -##########################################################################################  
278 -# End of extension  
279 -##########################################################################################  
280 -  
281 -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}  
282 -if [ "$MVNW_VERBOSE" = true ]; then  
283 - echo $MAVEN_PROJECTBASEDIR  
284 -fi  
285 -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"  
286 -  
287 -# For Cygwin, switch paths to Windows format before running java  
288 -if $cygwin; then  
289 - [ -n "$M2_HOME" ] &&  
290 - M2_HOME=`cygpath --path --windows "$M2_HOME"`  
291 - [ -n "$JAVA_HOME" ] &&  
292 - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`  
293 - [ -n "$CLASSPATH" ] &&  
294 - CLASSPATH=`cygpath --path --windows "$CLASSPATH"`  
295 - [ -n "$MAVEN_PROJECTBASEDIR" ] &&  
296 - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`  
297 -fi  
298 -  
299 -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain  
300 -  
301 -exec "$JAVACMD" \  
302 - $MAVEN_OPTS \  
303 - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \  
304 - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \  
305 - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"  
mvnw.cmd.bak
@@ -1,172 +0,0 @@ @@ -1,172 +0,0 @@
1 -@REM ----------------------------------------------------------------------------  
2 -@REM Licensed to the Apache Software Foundation (ASF) under one  
3 -@REM or more contributor license agreements. See the NOTICE file  
4 -@REM distributed with this work for additional information  
5 -@REM regarding copyright ownership. The ASF licenses this file  
6 -@REM to you under the Apache License, Version 2.0 (the  
7 -@REM "License"); you may not use this file except in compliance  
8 -@REM with the License. You may obtain a copy of the License at  
9 -@REM  
10 -@REM https://www.apache.org/licenses/LICENSE-2.0  
11 -@REM  
12 -@REM Unless required by applicable law or agreed to in writing,  
13 -@REM software distributed under the License is distributed on an  
14 -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY  
15 -@REM KIND, either express or implied. See the License for the  
16 -@REM specific language governing permissions and limitations  
17 -@REM under the License.  
18 -@REM ----------------------------------------------------------------------------  
19 -  
20 -@REM ----------------------------------------------------------------------------  
21 -@REM Maven2 Start Up Batch script  
22 -@REM  
23 -@REM Required ENV vars:  
24 -@REM JAVA_HOME - location of a JDK home dir  
25 -@REM  
26 -@REM Optional ENV vars  
27 -@REM M2_HOME - location of maven2's installed home dir  
28 -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands  
29 -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending  
30 -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven  
31 -@REM e.g. to debug Maven itself, use  
32 -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000  
33 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files  
34 -@REM ----------------------------------------------------------------------------  
35 -  
36 -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'  
37 -@echo off  
38 -@REM set title of command window  
39 -title %0  
40 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'  
41 -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%  
42 -  
43 -@REM set %HOME% to equivalent of $HOME  
44 -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")  
45 -  
46 -@REM Execute a user defined script before this one  
47 -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre  
48 -@REM check for pre script, once with legacy .bat ending and once with .cmd ending  
49 -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"  
50 -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"  
51 -:skipRcPre  
52 -  
53 -@setlocal  
54 -  
55 -set ERROR_CODE=0  
56 -  
57 -@REM To isolate internal variables from possible post scripts, we use another setlocal  
58 -@setlocal  
59 -  
60 -@REM ==== START VALIDATION ====  
61 -if not "%JAVA_HOME%" == "" goto OkJHome  
62 -  
63 -echo.  
64 -echo Error: JAVA_HOME not found in your environment. >&2  
65 -echo Please set the JAVA_HOME variable in your environment to match the >&2  
66 -echo location of your Java installation. >&2  
67 -echo.  
68 -goto error  
69 -  
70 -:OkJHome  
71 -if exist "%JAVA_HOME%\bin\java.exe" goto init  
72 -  
73 -echo.  
74 -echo Error: JAVA_HOME is set to an invalid directory. >&2  
75 -echo JAVA_HOME = "%JAVA_HOME%" >&2  
76 -echo Please set the JAVA_HOME variable in your environment to match the >&2  
77 -echo location of your Java installation. >&2  
78 -echo.  
79 -goto error  
80 -  
81 -@REM ==== END VALIDATION ====  
82 -  
83 -:init  
84 -  
85 -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".  
86 -@REM Fallback to current working directory if not found.  
87 -  
88 -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%  
89 -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir  
90 -  
91 -set EXEC_DIR=%CD%  
92 -set WDIR=%EXEC_DIR%  
93 -:findBaseDir  
94 -IF EXIST "%WDIR%"\.mvn goto baseDirFound  
95 -cd ..  
96 -IF "%WDIR%"=="%CD%" goto baseDirNotFound  
97 -set WDIR=%CD%  
98 -goto findBaseDir  
99 -  
100 -:baseDirFound  
101 -set MAVEN_PROJECTBASEDIR=%WDIR%  
102 -cd "%EXEC_DIR%"  
103 -goto endDetectBaseDir  
104 -  
105 -:baseDirNotFound  
106 -set MAVEN_PROJECTBASEDIR=%EXEC_DIR%  
107 -cd "%EXEC_DIR%"  
108 -  
109 -:endDetectBaseDir  
110 -  
111 -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig  
112 -  
113 -@setlocal EnableExtensions EnableDelayedExpansion  
114 -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a  
115 -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%  
116 -  
117 -:endReadAdditionalConfig  
118 -  
119 -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"  
120 -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"  
121 -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain  
122 -  
123 -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"  
124 -  
125 -FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (  
126 - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B  
127 -)  
128 -  
129 -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central  
130 -@REM This allows using the maven wrapper in projects that prohibit checking in binary data.  
131 -if exist %WRAPPER_JAR% (  
132 - echo Found %WRAPPER_JAR%  
133 -) else (  
134 - if not "%MVNW_REPOURL%" == "" (  
135 - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"  
136 - )  
137 - echo Couldn't find %WRAPPER_JAR%, downloading it ...  
138 - echo Downloading from: %DOWNLOAD_URL%  
139 -  
140 - powershell -Command "&{"^  
141 - "$webclient = new-object System.Net.WebClient;"^  
142 - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^  
143 - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^  
144 - "}"^  
145 - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^  
146 - "}"  
147 - echo Finished downloading %WRAPPER_JAR%  
148 -)  
149 -@REM End of extension  
150 -  
151 -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*  
152 -if ERRORLEVEL 1 goto error  
153 -goto end  
154 -  
155 -:error  
156 -set ERROR_CODE=1  
157 -  
158 -:end  
159 -@endlocal & set ERROR_CODE=%ERROR_CODE%  
160 -  
161 -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost  
162 -@REM check for post script, once with legacy .bat ending and once with .cmd ending  
163 -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"  
164 -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"  
165 -:skipRcPost  
166 -  
167 -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'  
168 -if "%MAVEN_BATCH_PAUSE%" == "on" pause  
169 -  
170 -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%  
171 -  
172 -exit /B %ERROR_CODE%  
pom.xml.bak
@@ -1,237 +0,0 @@ @@ -1,237 +0,0 @@
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
3 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
4 - <modelVersion>4.0.0</modelVersion>  
5 - <groupId>com.alibaba</groupId>  
6 - <artifactId>easyexcel</artifactId>  
7 - <version>2.2.5</version>  
8 - <packaging>jar</packaging>  
9 - <name>easyexcel</name>  
10 -  
11 - <description>easyexcel is a excel handle tools written in Java</description>  
12 -  
13 - <url>https://github.com/alibaba/easyexcel</url>  
14 - <inceptionYear>2018</inceptionYear>  
15 -  
16 -  
17 - <properties>  
18 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
19 - <jdk.version>1.6</jdk.version>  
20 - <gpg.skip>true</gpg.skip>  
21 - <maven.javadoc.skip>true</maven.javadoc.skip>  
22 - </properties>  
23 -  
24 - <scm>  
25 - <url>https://github.com/alibaba/easyexcel</url>  
26 - <connection>scm:git:https://git@github.com/alibaba/easyexcel.git</connection>  
27 - </scm>  
28 -  
29 - <!--<repositories>-->  
30 - <!--<repository>-->  
31 - <!--<id>local-file</id>-->  
32 - <!--<url>file://${basedir}/lib/</url>-->  
33 - <!--<layout>default</layout>-->  
34 - <!--</repository>-->  
35 - <!--</repositories>-->  
36 -  
37 - <organization>  
38 - <name>Alibaba Group</name>  
39 - <url>https://github.com/alibaba</url>  
40 - </organization>  
41 -  
42 - <developers>  
43 - <developer>  
44 - <id>jipengfei</id>  
45 - <name>jipengfei</name>  
46 - <email>1558143046@qq.com</email>  
47 - </developer>  
48 - </developers>  
49 -  
50 - <licenses>  
51 - <license>  
52 - <name>Apache 2</name>  
53 - <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>  
54 - <distribution>repo</distribution>  
55 - <comments>A business-friendly OSS license</comments>  
56 - </license>  
57 - </licenses>  
58 -  
59 - <dependencies>  
60 - <dependency>  
61 - <groupId>org.apache.poi</groupId>  
62 - <artifactId>poi</artifactId>  
63 - <version>3.17</version>  
64 - </dependency>  
65 - <dependency>  
66 - <groupId>org.apache.poi</groupId>  
67 - <artifactId>poi-ooxml</artifactId>  
68 - <version>3.17</version>  
69 - </dependency>  
70 - <dependency>  
71 - <groupId>org.apache.poi</groupId>  
72 - <artifactId>poi-ooxml-schemas</artifactId>  
73 - <version>3.17</version>  
74 - </dependency>  
75 - <dependency>  
76 - <groupId>cglib</groupId>  
77 - <artifactId>cglib</artifactId>  
78 - <version>3.1</version>  
79 - </dependency>  
80 - <dependency>  
81 - <groupId>org.slf4j</groupId>  
82 - <artifactId>slf4j-api</artifactId>  
83 - <version>1.7.26</version>  
84 - </dependency>  
85 - <dependency>  
86 - <groupId>org.ehcache</groupId>  
87 - <artifactId>ehcache</artifactId>  
88 - <version>3.4.0</version>  
89 - </dependency>  
90 - <!--test-->  
91 - <dependency>  
92 - <groupId>ch.qos.logback</groupId>  
93 - <artifactId>logback-classic</artifactId>  
94 - <version>1.2.3</version>  
95 - <scope>test</scope>  
96 - </dependency>  
97 - <dependency>  
98 - <groupId>com.alibaba</groupId>  
99 - <artifactId>fastjson</artifactId>  
100 - <version>1.2.71</version>  
101 - <scope>test</scope>  
102 - </dependency>  
103 - <dependency>  
104 - <groupId>org.projectlombok</groupId>  
105 - <artifactId>lombok</artifactId>  
106 - <version>1.18.8</version>  
107 - <scope>test</scope>  
108 - </dependency>  
109 - <dependency>  
110 - <groupId>org.springframework.boot</groupId>  
111 - <artifactId>spring-boot</artifactId>  
112 - <version>1.5.21.RELEASE</version>  
113 - <scope>test</scope>  
114 - </dependency>  
115 - <dependency>  
116 - <groupId>org.springframework.boot</groupId>  
117 - <artifactId>spring-boot-starter-web</artifactId>  
118 - <version>1.5.21.RELEASE</version>  
119 - <scope>test</scope>  
120 - </dependency>  
121 - <dependency>  
122 - <groupId>junit</groupId>  
123 - <artifactId>junit</artifactId>  
124 - <version>4.12</version>  
125 - <scope>test</scope>  
126 - </dependency>  
127 - </dependencies>  
128 - <distributionManagement>  
129 - <snapshotRepository>  
130 - <id>ossrh</id>  
131 - <url>https://oss.sonatype.org/content/repositories/snapshots</url>  
132 - </snapshotRepository>  
133 - <repository>  
134 - <id>ossrh</id>  
135 - <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>  
136 - </repository>  
137 - </distributionManagement>  
138 -  
139 - <build>  
140 - <plugins>  
141 - <!-- code style -->  
142 - <plugin>  
143 - <groupId>org.apache.maven.plugins</groupId>  
144 - <artifactId>maven-pmd-plugin</artifactId>  
145 - <version>3.8</version>  
146 - <configuration>  
147 - <printFailingErrors>true</printFailingErrors>  
148 - <verbose>true</verbose>  
149 - <rulesets>  
150 - <ruleset>rulesets/java/ali-comment.xml</ruleset>  
151 - <ruleset>rulesets/java/ali-concurrent.xml</ruleset>  
152 - <ruleset>rulesets/java/ali-constant.xml</ruleset>  
153 - <ruleset>rulesets/java/ali-exception.xml</ruleset>  
154 - <ruleset>rulesets/java/ali-flowcontrol.xml</ruleset>  
155 - <ruleset>rulesets/java/ali-naming.xml</ruleset>  
156 - <ruleset>rulesets/java/ali-oop.xml</ruleset>  
157 - <ruleset>rulesets/java/ali-orm.xml</ruleset>  
158 - <ruleset>rulesets/java/ali-other.xml</ruleset>  
159 - <ruleset>rulesets/java/ali-set.xml</ruleset>  
160 - </rulesets>  
161 - <excludes>  
162 - <exclude>com/alibaba/excel/event/AnalysisEventListener.java</exclude>  
163 - <exclude>com/alibaba/excel/metadata/DataFormatter.java</exclude>  
164 - <exclude>com/alibaba/excel/util/DateUtils.java</exclude>  
165 - <exclude>com/alibaba/excel/metadata/format/DataFormatter.java</exclude>  
166 - <exclude>com/alibaba/excel/metadata/format/ExcelGeneralNumberFormat.java</exclude>  
167 - </excludes>  
168 - </configuration>  
169 - <executions>  
170 - <execution>  
171 - <id>pmd-check-verify</id>  
172 - <phase>validate</phase>  
173 - <goals>  
174 - <goal>check</goal>  
175 - </goals>  
176 - </execution>  
177 - </executions>  
178 - <dependencies>  
179 - <dependency>  
180 - <groupId>com.alibaba.p3c</groupId>  
181 - <artifactId>p3c-pmd</artifactId>  
182 - <version>1.3.6</version>  
183 - </dependency>  
184 - </dependencies>  
185 - </plugin>  
186 - <plugin>  
187 - <groupId>org.apache.maven.plugins</groupId>  
188 - <artifactId>maven-compiler-plugin</artifactId>  
189 - <configuration>  
190 - <source>1.6</source>  
191 - <target>1.6</target>  
192 - </configuration>  
193 - </plugin>  
194 - <plugin>  
195 - <artifactId>maven-source-plugin</artifactId>  
196 - <version>2.1</version>  
197 - <configuration>  
198 - <attach>true</attach>  
199 - </configuration>  
200 - <executions>  
201 - <execution>  
202 - <phase>compile</phase>  
203 - <goals>  
204 - <goal>jar</goal>  
205 - </goals>  
206 - </execution>  
207 - </executions>  
208 - </plugin>  
209 - <plugin>  
210 - <groupId>org.apache.maven.plugins</groupId>  
211 - <artifactId>maven-gpg-plugin</artifactId>  
212 - <version>1.6</version>  
213 - <executions>  
214 - <execution>  
215 - <phase>verify</phase>  
216 - <goals>  
217 - <goal>sign</goal>  
218 - </goals>  
219 - </execution>  
220 - </executions>  
221 - </plugin>  
222 - <plugin>  
223 - <groupId>org.apache.maven.plugins</groupId>  
224 - <artifactId>maven-javadoc-plugin</artifactId>  
225 - <version>3.1.0</version>  
226 - <executions>  
227 - <execution>  
228 - <id>attach-javadocs</id>  
229 - <goals>  
230 - <goal>jar</goal>  
231 - </goals>  
232 - </execution>  
233 - </executions>  
234 - </plugin>  
235 - </plugins>  
236 - </build>  
237 -</project>  
src/test/java/com/taover/easyexcel/test/demo/read/ReadTest.java
@@ -3,7 +3,6 @@ package com.taover.easyexcel.test.demo.read; @@ -3,7 +3,6 @@ package com.taover.easyexcel.test.demo.read;
3 import java.io.File; 3 import java.io.File;
4 import java.util.List; 4 import java.util.List;
5 import java.util.Map; 5 import java.util.Map;
6 -import java.util.Map.Entry;  
7 6
8 import org.junit.Ignore; 7 import org.junit.Ignore;
9 import org.junit.Test; 8 import org.junit.Test;
@@ -266,6 +265,19 @@ public class ReadTest { @@ -266,6 +265,19 @@ public class ReadTest {
266 // LOGGER.info("读取到数据:{}\n{}", JSON.toJSONString(item.getKey()), JSON.toJSONString(item.getValue())); 265 // LOGGER.info("读取到数据:{}\n{}", JSON.toJSONString(item.getKey()), JSON.toJSONString(item.getValue()));
267 // } 266 // }
268 } 267 }
  268 +
  269 + public void readTestSynchronousRead() {
  270 + File dDir = new File("D:\\readtest");
  271 + String[] sonFileNameArr = dDir.list();
  272 + for(String item: sonFileNameArr) {
  273 + List<Map<Integer, String>> listMap = EasyExcel.read("D:\\readtest\\"+item).headRowNumber(0).readHiddenRow(false).sheet(true).doReadSync();
  274 + LOGGER.info("======文件名称:"+item+"======");
  275 + for (Map<Integer, String> data : listMap) {
  276 + // 返回每条数据的键值对 表示所在的列 和所在列的值
  277 + LOGGER.info(">{}", JSON.toJSONString(data));
  278 + }
  279 + }
  280 + }
269 281
270 /** 282 /**
271 * 不创建对象的读 283 * 不创建对象的读
@@ -279,6 +291,6 @@ public class ReadTest { @@ -279,6 +291,6 @@ public class ReadTest {
279 291
280 public static void main(String args[]) { 292 public static void main(String args[]) {
281 ReadTest rt = new ReadTest(); 293 ReadTest rt = new ReadTest();
282 - rt.synchronousRead(); 294 + rt.readTestSynchronousRead();
283 } 295 }
284 } 296 }
src/test/java/com/taover/easyexcel/test/demo/web/DownloadData.java
@@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
1 -package com.taover.easyexcel.test.demo.web;  
2 -  
3 -import java.util.Date;  
4 -  
5 -import com.taover.easyexcel.annotation.ExcelProperty;  
6 -  
7 -import lombok.Data;  
8 -  
9 -/**  
10 - * 基础数据类  
11 - *  
12 - * @author Jiaju Zhuang  
13 - **/  
14 -@Data  
15 -public class DownloadData {  
16 - @ExcelProperty("字符串标题")  
17 - private String string;  
18 - @ExcelProperty("日期标题")  
19 - private Date date;  
20 - @ExcelProperty("数字标题")  
21 - private Double doubleData;  
22 -}  
src/test/java/com/taover/easyexcel/test/demo/web/EasyexcelApplication.java
@@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
1 -package com.taover.easyexcel.test.demo.web;  
2 -  
3 -import org.springframework.boot.SpringApplication;  
4 -import org.springframework.boot.autoconfigure.SpringBootApplication;  
5 -  
6 -@SpringBootApplication  
7 -public class EasyexcelApplication {  
8 -  
9 - public static void main(String[] args) {  
10 - SpringApplication.run(EasyexcelApplication.class, args);  
11 - }  
12 -}  
src/test/java/com/taover/easyexcel/test/demo/web/UploadDAO.java
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -package com.taover.easyexcel.test.demo.web;  
2 -  
3 -import java.util.List;  
4 -  
5 -import org.springframework.stereotype.Repository;  
6 -  
7 -import com.taover.easyexcel.test.demo.read.DemoData;  
8 -  
9 -/**  
10 - * 假设这个是你的DAO存储。当然还要这个类让spring管理,当然你不用需要存储,也不需要这个类。  
11 - *  
12 - * @author Jiaju Zhuang  
13 - **/  
14 -@Repository  
15 -public class UploadDAO {  
16 -  
17 - public void save(List<UploadData> list) {  
18 - // 如果是mybatis,尽量别直接调用多次insert,自己写一个mapper里面新增一个方法batchInsert,所有数据一次性插入  
19 - }  
20 -}  
src/test/java/com/taover/easyexcel/test/demo/web/UploadData.java
@@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
1 -package com.taover.easyexcel.test.demo.web;  
2 -  
3 -import java.util.Date;  
4 -  
5 -import lombok.Data;  
6 -  
7 -/**  
8 - * 基础数据类  
9 - *  
10 - * @author Jiaju Zhuang  
11 - **/  
12 -@Data  
13 -public class UploadData {  
14 - private String string;  
15 - private Date date;  
16 - private Double doubleData;  
17 -}  
src/test/java/com/taover/easyexcel/test/demo/web/UploadDataListener.java
@@ -1,85 +0,0 @@ @@ -1,85 +0,0 @@
1 -package com.taover.easyexcel.test.demo.web;  
2 -  
3 -import java.util.ArrayList;  
4 -import java.util.List;  
5 -  
6 -import org.slf4j.Logger;  
7 -import org.slf4j.LoggerFactory;  
8 -  
9 -import com.taover.easyexcel.context.AnalysisContext;  
10 -import com.taover.easyexcel.event.AnalysisEventListener;  
11 -import com.alibaba.fastjson.JSON;  
12 -  
13 -/**  
14 - * 模板的读取类  
15 - *  
16 - * @author Jiaju Zhuang  
17 - */  
18 -// 有个很重要的点 DemoDataListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去  
19 -public class UploadDataListener extends AnalysisEventListener<UploadData> {  
20 - private static final Logger LOGGER =  
21 - LoggerFactory.getLogger(com.taover.easyexcel.test.demo.read.DemoDataListener.class);  
22 - /**  
23 - * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收  
24 - */  
25 - private static final int BATCH_COUNT = 5;  
26 - List<UploadData> list = new ArrayList<UploadData>();  
27 - /**  
28 - * 假设这个是一个DAO,当然有业务逻辑这个也可以是一个service。当然如果不用存储这个对象没用。  
29 - */  
30 - private UploadDAO uploadDAO;  
31 -  
32 - public UploadDataListener() {  
33 - // 这里是demo,所以随便new一个。实际使用如果到了spring,请使用下面的有参构造函数  
34 - uploadDAO = new UploadDAO();  
35 - }  
36 -  
37 - /**  
38 - * 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来  
39 - *  
40 - * @param uploadDAO  
41 - */  
42 - public UploadDataListener(UploadDAO uploadDAO) {  
43 - this.uploadDAO = uploadDAO;  
44 - }  
45 -  
46 - /**  
47 - * 这个每一条数据解析都会来调用  
48 - *  
49 - * @param data  
50 - * one row value. Is is same as {@link AnalysisContext#readRowHolder()}  
51 - * @param context  
52 - */  
53 - @Override  
54 - public void invoke(UploadData data, AnalysisContext context) {  
55 - LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data));  
56 - list.add(data);  
57 - // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM  
58 - if (list.size() >= BATCH_COUNT) {  
59 - saveData();  
60 - // 存储完成清理 list  
61 - list.clear();  
62 - }  
63 - }  
64 -  
65 - /**  
66 - * 所有数据解析完成了 都会来调用  
67 - *  
68 - * @param context  
69 - */  
70 - @Override  
71 - public void doAfterAllAnalysed(AnalysisContext context) {  
72 - // 这里也要保存数据,确保最后遗留的数据也存储到数据库  
73 - saveData();  
74 - LOGGER.info("所有数据解析完成!");  
75 - }  
76 -  
77 - /**  
78 - * 加上存储数据库  
79 - */  
80 - private void saveData() {  
81 - LOGGER.info("{}条数据,开始存储数据库!", list.size());  
82 - uploadDAO.save(list);  
83 - LOGGER.info("存储数据库成功!");  
84 - }  
85 -}  
src/test/java/com/taover/easyexcel/test/demo/web/WebTest.java
@@ -1,110 +0,0 @@ @@ -1,110 +0,0 @@
1 -package com.taover.easyexcel.test.demo.web;  
2 -  
3 -import java.io.IOException;  
4 -import java.net.URLEncoder;  
5 -import java.util.ArrayList;  
6 -import java.util.Date;  
7 -import java.util.HashMap;  
8 -import java.util.List;  
9 -import java.util.Map;  
10 -  
11 -import javax.servlet.http.HttpServletResponse;  
12 -  
13 -import org.springframework.beans.factory.annotation.Autowired;  
14 -import org.springframework.stereotype.Controller;  
15 -import org.springframework.web.bind.annotation.GetMapping;  
16 -import org.springframework.web.bind.annotation.PostMapping;  
17 -import org.springframework.web.bind.annotation.ResponseBody;  
18 -import org.springframework.web.multipart.MultipartFile;  
19 -  
20 -import com.alibaba.fastjson.JSON;  
21 -import com.taover.easyexcel.EasyExcel;  
22 -  
23 -/**  
24 - * web读写案例  
25 - *  
26 - * @author Jiaju Zhuang  
27 - **/  
28 -@Controller  
29 -public class WebTest {  
30 -  
31 - @Autowired  
32 - private UploadDAO uploadDAO;  
33 -  
34 - /**  
35 - * 文件下载(失败了会返回一个有部分数据的Excel)  
36 - * <p>  
37 - * 1. 创建excel对应的实体对象 参照{@link DownloadData}  
38 - * <p>  
39 - * 2. 设置返回的 参数  
40 - * <p>  
41 - * 3. 直接写,这里注意,finish的时候会自动关闭OutputStream,当然你外面再关闭流问题不大  
42 - */  
43 - @GetMapping("download")  
44 - public void download(HttpServletResponse response) throws IOException {  
45 - // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman  
46 - response.setContentType("application/vnd.ms-excel");  
47 - response.setCharacterEncoding("utf-8");  
48 - // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系  
49 - String fileName = URLEncoder.encode("测试", "UTF-8");  
50 - response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");  
51 - EasyExcel.write(response.getOutputStream(), DownloadData.class).sheet("模板").doWrite(data());  
52 - }  
53 -  
54 - /**  
55 - * 文件下载并且失败的时候返回json(默认失败了会返回一个有部分数据的Excel)  
56 - *  
57 - * @since 2.1.1  
58 - */  
59 - @GetMapping("downloadFailedUsingJson")  
60 - public void downloadFailedUsingJson(HttpServletResponse response) throws IOException {  
61 - // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman  
62 - try {  
63 - response.setContentType("application/vnd.ms-excel");  
64 - response.setCharacterEncoding("utf-8");  
65 - // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系  
66 - String fileName = URLEncoder.encode("测试", "UTF-8");  
67 - response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");  
68 - // 这里需要设置不关闭流  
69 - EasyExcel.write(response.getOutputStream(), DownloadData.class).autoCloseStream(Boolean.FALSE).sheet("模板")  
70 - .doWrite(data());  
71 - } catch (Exception e) {  
72 - // 重置response  
73 - response.reset();  
74 - response.setContentType("application/json");  
75 - response.setCharacterEncoding("utf-8");  
76 - Map<String, String> map = new HashMap<String, String>();  
77 - map.put("status", "failure");  
78 - map.put("message", "下载文件失败" + e.getMessage());  
79 - response.getWriter().println(JSON.toJSONString(map));  
80 - }  
81 - }  
82 -  
83 - /**  
84 - * 文件上传  
85 - * <p>  
86 - * 1. 创建excel对应的实体对象 参照{@link UploadData}  
87 - * <p>  
88 - * 2. 由于默认一行行的读取excel,所以需要创建excel一行一行的回调监听器,参照{@link UploadDataListener}  
89 - * <p>  
90 - * 3. 直接读即可  
91 - */  
92 - @PostMapping("upload")  
93 - @ResponseBody  
94 - public String upload(MultipartFile file) throws IOException {  
95 - EasyExcel.read(file.getInputStream(), UploadData.class, new UploadDataListener(uploadDAO)).sheet().doRead();  
96 - return "success";  
97 - }  
98 -  
99 - private List<DownloadData> data() {  
100 - List<DownloadData> list = new ArrayList<DownloadData>();  
101 - for (int i = 0; i < 10; i++) {  
102 - DownloadData data = new DownloadData();  
103 - data.setString("字符串" + 0);  
104 - data.setDate(new Date());  
105 - data.setDoubleData(0.56);  
106 - list.add(data);  
107 - }  
108 - return list;  
109 - }  
110 -}