张展望注释 #11

Merged
pxwi83ejl merged 1 commits from edu/Kaoshi into develop 1 year ago

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012 - 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -13,91 +13,128 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// 导入 java.net 包中的类,用于处理网络相关操作
import java.net.*;
// 导入 java.io 包中的类,用于输入输出操作
import java.io.*;
// 导入 java.nio.channels 包中的类,用于使用 NIO 通道进行高效的 I/O 操作
import java.nio.channels.*;
// 导入 java.util.Properties 类,用于处理属性文件
import java.util.Properties;
// 定义 MavenWrapperDownloader 类,用于下载 Maven 包装器 JAR 文件
public class MavenWrapperDownloader {
// 定义 Maven 包装器的版本号
private static final String WRAPPER_VERSION = "0.5.5";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
* 'downloadUrl' URL maven-wrapper.jar
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
* maven-wrapper.properties downloadUrl URL
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
* maven-wrapper.jar
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
* URL
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
// 程序的入口点
public static void main(String args[]) {
// 打印下载器启动信息
System.out.println("- Downloader started");
// 根据命令行参数创建基础目录文件对象
File baseDirectory = new File(args[0]);
// 打印使用的基础目录的绝对路径
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
// 如果 maven-wrapper.properties 文件存在,读取它并检查是否包含自定义的 wrapperUrl 参数
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
// 初始化下载 URL 为默认值
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
// 用于读取 maven-wrapper.properties 文件的输入流
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
// 打开 maven-wrapper.properties 文件的输入流
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
// 创建 Properties 对象用于存储属性文件中的键值对
Properties mavenWrapperProperties = new Properties();
// 从输入流中加载属性文件内容
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
// 获取自定义的下载 URL如果不存在则使用默认值
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
// 打印加载 maven-wrapper.properties 文件出错信息
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
// 关闭输入流
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
// 忽略关闭输入流时可能出现的异常
}
}
}
// 打印下载的 URL
System.out.println("- Downloading from: " + url);
// 创建要保存 maven-wrapper.jar 的文件对象
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
// 如果输出文件的父目录不存在,则创建它
if(!outputFile.getParentFile().exists()) {
// 如果创建父目录失败,打印错误信息
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
// 打印下载文件的保存路径
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
// 调用下载文件的方法
downloadFileFromURL(url, outputFile);
// 打印下载完成信息
System.out.println("Done");
// 正常退出程序
System.exit(0);
} catch (Throwable e) {
// 打印下载出错信息
System.out.println("- Error downloading");
// 打印异常堆栈信息
e.printStackTrace();
// 异常退出程序
System.exit(1);
}
}
// 从指定 URL 下载文件到指定目标文件的方法
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
// 如果环境变量中设置了 MVNW_USERNAME 和 MVNW_PASSWORD
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
// 获取用户名
String username = System.getenv("MVNW_USERNAME");
// 获取密码并转换为字符数组
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
// 设置认证器
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
@ -105,13 +142,20 @@ public class MavenWrapperDownloader {
}
});
}
// 创建 URL 对象
URL website = new URL(urlString);
// 用于读取网络数据的通道
ReadableByteChannel rbc;
// 打开 URL 连接并创建通道
rbc = Channels.newChannel(website.openStream());
// 创建用于写入文件的输出流
FileOutputStream fos = new FileOutputStream(destination);
// 将通道中的数据传输到文件输出流的通道中
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
// 关闭输出流
fos.close();
// 关闭通道
rbc.close();
}
}
}

File diff suppressed because it is too large Load Diff

973
mvnw vendored

File diff suppressed because it is too large Load Diff

106
mvnw.cmd vendored

@ -1,133 +1,217 @@
@REM ----------------------------------------------------------------------------
@REM 此注释块表明该文件遵循 Apache 软件基金会的许可协议
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM 可能有一个或多个贡献者与 ASF 签订了许可协议
@REM or more contributor license agreements. See the NOTICE file
@REM 查看随此项目一同分发的 NOTICE 文件,获取更多版权信息
@REM distributed with this work for additional information
@REM 关于版权归属的详细信息
@REM regarding copyright ownership. The ASF licenses this file
@REM ASF 根据 Apache 许可证 2.0 版本将此文件授权给你
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM 除非你遵守该许可协议,否则不能使用此文件
@REM with the License. You may obtain a copy of the License at
@REM
@REM 你可以在下面的链接获取许可协议副本
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM 除非适用法律要求或书面同意
@REM software distributed under the License is distributed on an
@REM 根据许可协议分发的软件按“原样”分发
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM 不附带任何形式的明示或暗示保证和条件
@REM KIND, either express or implied. See the License for the
@REM 查看许可协议以了解相关权限和限制的具体条款
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM 此注释块介绍了这是一个 Maven2 的启动批处理脚本
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM 必需的环境变量
@REM JAVA_HOME - location of a JDK home dir
@REM JAVA_HOME 环境变量,指向 JDK 的安装目录
@REM
@REM Optional ENV vars
@REM 可选的环境变量
@REM M2_HOME - location of maven2's installed home dir
@REM M2_HOME 环境变量,指向 Maven2 的安装目录
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_ECHO 环境变量,设置为 'on' 可启用批处理命令的回显
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_BATCH_PAUSE 环境变量,设置为 'on' 可在脚本结束前等待按键
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM MAVEN_OPTS 环境变量,用于在运行 Maven 时传递给 Java 虚拟机的参数
@REM e.g. to debug Maven itself, use
@REM 例如,要调试 Maven 本身,可使用以下设置
@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 MAVEN_SKIP_RC 环境变量,用于禁用加载 mavenrc 文件的标志
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@REM 以 '@' 开头的 REM 行,防止在 MAVEN_BATCH_ECHO 为 'on' 时回显注释
@echo off
@REM 关闭命令回显,避免在执行脚本时显示命令本身
@REM set title of command window
@REM 设置命令窗口的标题
title %0
@REM 将命令窗口的标题设置为当前脚本的名称
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@REM 通过将 MAVEN_BATCH_ECHO 设置为 'on' 来启用命令回显
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM 如果 MAVEN_BATCH_ECHO 环境变量的值为 'on',则开启命令回显
@REM set %HOME% to equivalent of $HOME
@REM 将 %HOME% 环境变量设置为与 $HOME 等效的值
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM 如果 %HOME% 环境变量未设置,则将其设置为当前用户的主目录
@REM Execute a user defined script before this one
@REM 在执行此脚本之前执行用户定义的脚本
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM 如果 MAVEN_SKIP_RC 环境变量不为空,则跳过执行用户定义的前置脚本
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
@REM 检查是否存在前置脚本,分别检查以 .bat 和 .cmd 结尾的文件
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
@REM 如果存在 %HOME%\mavenrc_pre.bat 文件,则调用该脚本
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
@REM 如果存在 %HOME%\mavenrc_pre.cmd 文件,则调用该脚本
:skipRcPre
@REM 跳过执行用户定义的前置脚本的标签
@setlocal
@REM 开启本地环境变量作用域,确保后续设置的变量只在当前脚本块内有效
set ERROR_CODE=0
@REM 初始化错误代码为 0表示脚本执行正常
@REM To isolate internal variables from possible post scripts, we use another setlocal
@REM 为了将内部变量与可能的后置脚本隔离开,我们再次使用 setlocal
@setlocal
@REM ==== START VALIDATION ====
@REM 开始验证环境变量
if not "%JAVA_HOME%" == "" goto OkJHome
@REM 如果 JAVA_HOME 环境变量已设置,则跳转到 OkJHome 标签
echo.
echo Error: JAVA_HOME not found in your environment. >&2
@REM 输出错误信息,提示 JAVA_HOME 环境变量未找到
echo Please set the JAVA_HOME variable in your environment to match the >&2
@REM 提示用户设置 JAVA_HOME 环境变量
echo location of your Java installation. >&2
@REM 提示用户将 JAVA_HOME 设置为 Java 安装目录
echo.
goto error
@REM 跳转到 error 标签,处理错误情况
:OkJHome
@REM JAVA_HOME 环境变量已设置的标签
if exist "%JAVA_HOME%\bin\java.exe" goto init
@REM 如果 JAVA_HOME\bin\java.exe 文件存在,则跳转到 init 标签
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
@REM 输出错误信息,提示 JAVA_HOME 设置为无效目录
echo JAVA_HOME = "%JAVA_HOME%" >&2
@REM 显示当前 JAVA_HOME 的值
echo Please set the JAVA_HOME variable in your environment to match the >&2
@REM 提示用户设置正确的 JAVA_HOME 环境变量
echo location of your Java installation. >&2
@REM 提示用户将 JAVA_HOME 设置为 Java 安装目录
echo.
goto error
@REM 跳转到 error 标签,处理错误情况
@REM ==== END VALIDATION ====
@REM 结束环境变量验证
:init
@REM 初始化标签
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM 查找项目的基础目录,即包含 .mvn 文件夹的目录
@REM Fallback to current working directory if not found.
@REM 如果未找到,则使用当前工作目录作为基础目录
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
@REM 将 MAVEN_PROJECTBASEDIR 环境变量设置为 MAVEN_BASEDIR 的值
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
@REM 如果 MAVEN_PROJECTBASEDIR 环境变量不为空,则跳转到 endDetectBaseDir 标签
set EXEC_DIR=%CD%
@REM 将 EXEC_DIR 环境变量设置为当前工作目录
set WDIR=%EXEC_DIR%
@REM 将 WDIR 环境变量设置为当前工作目录
:findBaseDir
@REM 查找基础目录的标签
IF EXIST "%WDIR%"\.mvn goto baseDirFound
@REM 如果当前目录下存在 .mvn 文件夹,则跳转到 baseDirFound 标签
cd ..
@REM 切换到上一级目录
IF "%WDIR%"=="%CD%" goto baseDirNotFound
@REM 如果已经到达根目录,则跳转到 baseDirNotFound 标签
set WDIR=%CD%
@REM 更新 WDIR 环境变量为当前目录
goto findBaseDir
@REM 继续查找基础目录
:baseDirFound
@REM 找到基础目录的标签
set MAVEN_PROJECTBASEDIR=%WDIR%
@REM 将 MAVEN_PROJECTBASEDIR 环境变量设置为找到的基础目录
cd "%EXEC_DIR%"
@REM 切换回原来的工作目录
goto endDetectBaseDir
@REM 跳转到 endDetectBaseDir 标签
:baseDirNotFound
@REM 未找到基础目录的标签
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
@REM 将 MAVEN_PROJECTBASEDIR 环境变量设置为当前工作目录
cd "%EXEC_DIR%"
@REM 切换回原来的工作目录
:endDetectBaseDir
@REM 结束基础目录检测的标签
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@REM 如果 %MAVEN_PROJECTBASEDIR%\.mvn\jvm.config 文件不存在,则跳转到 endReadAdditionalConfig 标签
@setlocal EnableExtensions EnableDelayedExpansion
@REM 开启扩展和延迟环境变量扩展
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@REM 读取 %MAVEN_PROJECTBASEDIR%\.mvn\jvm.config 文件的内容,并将其添加到 JVM_CONFIG_MAVEN_PROPS 环境变量中
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
@REM 结束本地环境变量作用域,并将 JVM_CONFIG_MAVEN_PROPS 环境变量传递到外部
:endReadAdditionalConfig
@REM 结束读取额外配置文件的标签
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
@REM 设置 MAVEN_JAVA_EXE 环境变量为 Java 可执行文件的路径
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
@REM 设置 WRAPPER_JAR 环境变量为 Maven 包装器 JAR 文件的路径
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
@REM 设置 WRAPPER_LAUNCHER 环境变量为 Maven 包装器的主类名
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
@REM 设置 DOWNLOAD_URL 环境变量为 Maven 包装器 JAR 文件的下载地址
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM 读取 %MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties 文件,查找 wrapperUrl 属性,并更新 DOWNLOAD_URL 环境变量
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM 扩展功能,允许自动从 Maven 中央仓库下载 maven-wrapper.jar 文件
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
@REM 这允许在禁止提交二进制数据的项目中使用 Maven 包装器
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
@ -153,30 +237,50 @@ if exist %WRAPPER_JAR% (
)
)
@REM End of extension
@REM 扩展功能结束
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM 提供一种“标准化”的方式来获取命令行参数
@REM work with both Windows and non-Windows executions.
@REM 适用于 Windows 和非 Windows 系统的执行环境
set MAVEN_CMD_LINE_ARGS=%*
@REM 将 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% %*
@REM 执行 Java 命令,启动 Maven 包装器
if ERRORLEVEL 1 goto error
@REM 如果执行 Java 命令返回错误码,则跳转到 error 标签
goto end
@REM 跳转到 end 标签
:error
@REM 错误处理标签
set ERROR_CODE=1
@REM 设置错误代码为 1表示脚本执行出错
:end
@REM 结束标签
@endlocal & set ERROR_CODE=%ERROR_CODE%
@REM 结束本地环境变量作用域,并将错误代码传递到外部
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM 如果 MAVEN_SKIP_RC 环境变量不为空,则跳过执行用户定义的后置脚本
@REM check for post script, once with legacy .bat ending and once with .cmd ending
@REM 检查是否存在后置脚本,分别检查以 .bat 和 .cmd 结尾的文件
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
@REM 如果存在 %HOME%\mavenrc_post.bat 文件,则调用该脚本
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
@REM 如果存在 %HOME%\mavenrc_post.cmd 文件,则调用该脚本
:skipRcPost
@REM 跳过执行用户定义的后置脚本的标签
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
@REM 如果 MAVEN_BATCH_PAUSE 环境变量设置为 'on',则暂停脚本执行
if "%MAVEN_BATCH_PAUSE%" == "on" pause
@REM 等待用户按键
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
@REM 如果 MAVEN_TERMINATE_CMD 环境变量设置为 'on',则退出命令提示符并返回错误代码
exit /B %ERROR_CODE%
@REM 退出当前批处理脚本并返回错误代码

@ -1,116 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 定义项目的根元素,使用 Maven POM 4.0.0 架构 -->
<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">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- 指定 POM 模型的版本,固定为 4.0.0 -->
<modelVersion>4.0.0</modelVersion>
<!-- 定义项目的父 POM继承父项目的配置 -->
<parent>
<!-- 父项目的组 ID -->
<groupId>org.springframework.boot</groupId>
<!-- 父项目的项目 ID -->
<artifactId>spring-boot-starter-parent</artifactId>
<!-- 父项目的版本 -->
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
<!-- 查找父项目的相对路径,为空表示从仓库中查找 -->
<relativePath/>
</parent>
<!-- 项目的组 ID通常是公司或组织的域名倒序 -->
<groupId>com.jlwl</groupId>
<!-- 导入项目的名称 -->
<artifactId>springbootus5uu</artifactId>
<!-- 项目的版本SNAPSHOT 表示快照版本 -->
<version>0.0.1-SNAPSHOT</version>
<!-- 项目的名称 -->
<name>springboot-schema</name>
<!-- 项目的描述信息,说明是 springboot 学习框架,以及打 war 包的命令 -->
<description>springboot学习框架(war包对应的pom打war包执行【mvn clean package -f pom-war.xml】)</description>
<!-- 项目的打包方式,这里指定为 war 包 -->
<packaging>war</packaging>
<!-- 定义项目的属性 -->
<properties>
<!-- Java 版本 -->
<java.version>1.8</java.version>
<!-- FastJson 版本 -->
<fastjson.version>1.2.8</fastjson.version>
<!-- Maven JAR 插件版本 -->
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
<!-- 定义项目的依赖 -->
<dependencies>
<!-- Spring Boot Web 启动器依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- MyBatis Spring Boot 启动器依赖 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
<!-- Spring Boot JDBC 启动器依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- Spring Boot Tomcat 启动器依赖scope 为 provided 表示运行时由容器提供 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- MySQL 数据库连接驱动依赖 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- Apache Shiro Spring 集成依赖 -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.3.2</version>
</dependency>
<!-- MyBatis-Plus 依赖 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>2.3</version>
</dependency>
<!-- MyBatis-Plus Spring Boot 启动器依赖 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatisplus-spring-boot-starter</artifactId>
<version>1.0.5</version>
</dependency>
<!-- Google Protobuf Java 依赖 -->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.10.0</version>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.10.0</version>
</dependency>
<!-- Apache Commons Lang3 依赖 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<!-- Java 验证 API 依赖 -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<!-- Apache Commons IO 依赖 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- Hutool 工具集依赖 -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.0.12</version>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.0.12</version>
</dependency>
<!-- FastJson -->
<!-- FastJson 依赖,版本使用属性中定义的值 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- 百度人工智能 -->
<!-- 百度人工智能 Java SDK 依赖 -->
<dependency>
<groupId>com.baidu.aip</groupId>
<artifactId>java-sdk</artifactId>
<version>4.4.1</version>
<groupId>com.baidu.aip</groupId>
<artifactId>java-sdk</artifactId>
<version>4.4.1</version>
</dependency>
<!-- Spring Boot 测试启动器依赖scope 为 test 表示只在测试时使用 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<!-- 排除 JUnit Vintage 引擎依赖 -->
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
@ -120,23 +142,27 @@
</dependency>
</dependencies>
<!-- 定义项目的构建配置 -->
<build>
<!-- 最终生成的 WAR 包名称 -->
<finalName>springbootus5uu</finalName>
<!-- 定义构建插件 -->
<plugins>
<!-- Spring Boot Maven 插件 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- 跳过单元测试 -->
<!-- 跳过单元测试的插件配置 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- 设置为 true 表示跳过单元测试 -->
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>

@ -1,143 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 声明 XML 文档的版本为 1.0,字符编码为 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">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- 定义项目的根元素,指定 Maven POM 的命名空间和 XML 模式实例命名空间,并设置模式位置 -->
<modelVersion>4.0.0</modelVersion>
<!-- 指定项目的模型版本为 4.0.0 -->
<parent>
<!-- 定义项目的父项目配置 -->
<groupId>org.springframework.boot</groupId>
<!-- 父项目的组 ID这里是 Spring Boot 项目的组 ID -->
<artifactId>spring-boot-starter-parent</artifactId>
<!-- 父项目的工件 IDspring-boot-starter-parent 是 Spring Boot 的起始父项目 -->
<version>2.2.2.RELEASE</version>
<!-- 父项目的版本号 -->
<relativePath/> <!-- lookup parent from repository -->
<!-- 不指定父项目的相对路径,从仓库中查找父项目 -->
</parent>
<groupId>com.jlwl</groupId>
<!-- 项目的组 ID标识项目所属的组织或组 -->
<!-- 导入项目的名称 -->
<artifactId>springbootus5uu</artifactId>
<!-- 项目的工件 ID唯一标识项目 -->
<version>0.0.1-SNAPSHOT</version>
<!-- 项目的版本号,这里是一个快照版本 -->
<name>springboot-schema</name>
<description>springboot学习框架</description>
<!-- 项目的名称,用于展示等用途 -->
<description>springboot学习框架(war包对应的pom打war包执行【mvn clean package -f pom-war.xml】)</description>
<!-- 项目的描述信息,说明项目用途以及打 war 包的相关指令 -->
<packaging>war</packaging>
<!-- 指定项目打包的类型为 war 包 -->
<properties>
<!-- 定义项目的属性 -->
<java.version>1.8</java.version>
<!-- 指定项目使用的 Java 版本为 1.8 -->
<fastjson.version>1.2.8</fastjson.version>
<!-- 定义 fastjson 依赖的版本号为 1.2.8 -->
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<!-- 定义 maven-jar-plugin 插件的版本号为 3.1.1 -->
</properties>
<dependencies>
<!-- 定义项目的依赖关系 -->
<dependency>
<!-- 单个依赖项的配置 -->
<groupId>org.springframework.boot</groupId>
<!-- 依赖的组 ID这里是 Spring Boot 的组 ID -->
<artifactId>spring-boot-starter-web</artifactId>
<!-- 依赖的工件 IDspring-boot-starter-web 是 Spring Boot 的 Web 启动器依赖 -->
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<!-- MyBatis Spring Boot 集成依赖的组 ID -->
<artifactId>mybatis-spring-boot-starter</artifactId>
<!-- MyBatis Spring Boot 启动器依赖的工件 ID -->
<version>2.1.1</version>
<!-- 依赖的版本号为 2.1.1 -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<groupId>org.springframework.boot</groupId>
<!-- Spring Boot 组 ID -->
<artifactId>spring-boot-starter-jdbc</artifactId>
<!-- Spring Boot 的 JDBC 启动器依赖的工件 ID -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<!-- Spring Boot 组 ID -->
<artifactId>spring-boot-starter-tomcat</artifactId>
<!-- Spring Boot 的 Tomcat 启动器依赖的工件 ID -->
<scope>provided</scope>
<!-- 依赖的作用域为 provided表示在编译和测试阶段可用但在运行时由容器提供不会被打包进最终的 war 包 -->
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>mysql</groupId>
<!-- MySQL 数据库驱动的组 ID -->
<artifactId>mysql-connector-java</artifactId>
<!-- MySQL 数据库驱动的工件 ID -->
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<!-- Apache Shiro 框架的组 ID -->
<artifactId>shiro-spring</artifactId>
<!-- Shiro 与 Spring 集成的依赖的工件 ID -->
<version>1.3.2</version>
<!-- 依赖的版本号为 1.3.2 -->
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<!-- 项目组 ID这里是 Baomidou -->
<artifactId>mybatis-plus</artifactId>
<!-- MyBatis-Plus 框架的工件 ID -->
<version>2.3</version>
<!-- 依赖的版本号为 2.3 -->
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<!-- Baomidou 组 ID -->
<artifactId>mybatisplus-spring-boot-starter</artifactId>
<!-- MyBatis-Plus 与 Spring Boot 集成的启动器依赖的工件 ID -->
<version>1.0.5</version>
<!-- 依赖的版本号为 1.0.5 -->
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.10.0</version>
<groupId>com.google.protobuf</groupId>
<!-- Google Protocol Buffers 的组 ID -->
<artifactId>protobuf-java</artifactId>
<!-- Google Protocol Buffers Java 库的工件 ID -->
<version>3.10.0</version>
<!-- 依赖的版本号为 3.10.0 -->
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
<groupId>org.apache.commons</groupId>
<!-- Apache Commons 项目的组 ID -->
<artifactId>commons-lang3</artifactId>
<!-- Apache Commons Lang 3 库的工件 ID -->
<version>3.0</version>
<!-- 依赖的版本号为 3.0 -->
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<groupId>javax.validation</groupId>
<!-- Java 验证 API 的组 ID -->
<artifactId>validation-api</artifactId>
<!-- 验证 API 的工件 ID -->
<version>2.0.1.Final</version>
<!-- 依赖的版本号为 2.0.1.Final -->
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<groupId>commons-io</groupId>
<!-- Apache Commons IO 项目的组 ID -->
<artifactId>commons-io</artifactId>
<!-- Apache Commons IO 库的工件 ID -->
<version>2.5</version>
<!-- 依赖的版本号为 2.5 -->
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.0.12</version>
<groupId>cn.hutool</groupId>
<!-- Hutool 工具库的组 ID -->
<artifactId>hutool-all</artifactId>
<!-- Hutool 全功能工具库的工件 ID -->
<version>4.0.12</version>
<!-- 依赖的版本号为 4.0.12 -->
</dependency>
<!-- FastJson -->
<dependency>
<groupId>com.alibaba</groupId>
<!-- 阿里巴巴的组 ID -->
<artifactId>fastjson</artifactId>
<!-- FastJson 库的工件 ID -->
<version>${fastjson.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.microsoft.sqlserver</groupId>-->
<!-- <artifactId>sqljdbc4</artifactId>-->
<!-- <scope>4.0</scope>-->
<!-- <version>4.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.0.jre8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.0.jre8</version>
<scope>runtime</scope>
<!-- 使用之前定义的 fastjson.version 属性作为版本号 -->
</dependency>
<!-- 百度人工智能 -->
<dependency>
<groupId>com.baidu.aip</groupId>
<artifactId>java-sdk</artifactId>
<version>4.4.1</version>
<groupId>com.baidu.aip</groupId>
<!-- 百度 AI 组 ID -->
<artifactId>java-sdk</artifactId>
<!-- 百度 AI Java SDK 的工件 ID -->
<version>4.4.1</version>
<!-- 依赖的版本号为 4.4.1 -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<!-- Spring Boot 组 ID -->
<artifactId>spring-boot-starter-test</artifactId>
<!-- Spring Boot 测试启动器依赖的工件 ID -->
<scope>test</scope>
<!-- 依赖的作用域为测试 -->
<exclusions>
<!-- 排除不需要的依赖 -->
<exclusion>
<groupId>org.junit.vintage</groupId>
<!-- 要排除的依赖的组 ID -->
<artifactId>junit-vintage-engine</artifactId>
<!-- 要排除的依赖的工件 ID -->
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<!-- 定义项目的构建配置 -->
<finalName>springbootus5uu</finalName>
<!-- 设置最终生成的 war 包的名称为 springbootus5uu -->
<plugins>
<!-- 定义项目使用的插件 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<!-- Spring Boot 组 ID -->
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- Spring Boot Maven 插件的工件 ID -->
</plugin>
<!-- 跳过单元测试 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<!-- Apache Maven 插件组 ID -->
<artifactId>maven-surefire-plugin</artifactId>
<!-- Maven Surefire 插件的工件 ID用于运行单元测试 -->
<configuration>
<!-- 插件的配置 -->
<skipTests>true</skipTests>
<!-- 设置为 true 表示在构建过程中跳过单元测试 -->
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>
Loading…
Cancel
Save