1 java1

1.1 tcomat

01.环境变量
    CATALINA_BASE:%TOMCAT_HOME%
    CATALINA_HOME:%TOMCAT_HOME%
    TOMCAT_HOME:C:\software\apache-tomcat-8.5.56
    Path:%TOMCAT_HOME%\bin

02.测试
    startup

03.配置
    a.启动时闪退:找不到路径
        startup.bat/shutdown.bat加两行
        SET JAVA_HOME=C:\software\jdk-1.8.0_231
        SET TOMCAT_HOME=C:\software\apache-tomcat-8.5.56
    b.start.up乱码
        conf/logging.properties修改java.util.logging.ConsoleHandler.encoding = GBK
        集群情况下,CATALINA_HOME会自动启动CATALINA_HOME指定Tomcat,单机环境下就会造成多个Tomcat
        只能启动一个,而集群中需要开启多个不同的Tomcat,因此在单机环境下需要删除CATALINA_HOME,多机
        环境下可以选择不删除。

04.Tomcat启动项目变慢
    a.原因一:Tomcat在启动过程中会检查jar,当有大量的jar被检测的时候,启动需要很长时间
        catalina.properties文件 -> tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\ ->
        修改为 -> tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*.jar
    b.原因二:createSecureRandom 类产生安全随机类 SecureRandom 的实例作为会话 ID
        C:\software\jdk-1.8.0_231\jre\lib\security -> java.security文件 ->
        securerandom.source=file:/dev/random -> 修改为 -> securerandom.source=file:/dev/urandom

1.2 jdk

01.环境变量
    JAVA_HOME:C:\software\jdk-1.8.0_231
    JRE_HOME:%JAVA_HOME%\jre
    CLASS_PATH:.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
    path:%JAVA_HOME%\bin

02.环境变量
    JAVA_HOME:C:\software\jdk-11.0.11
    CLASS_PATH:.;%JAVA_HOME%\lib
    path:%JAVA_HOME%\bin

03.测试
    java -version

1.3 maven

01.常用信息1
    a.环境变量
        MAVEN_HOME:C:\software\apache-maven-3.6.3
        path:%MAVEN_HOME%\bin
    b.常用镜像
        https://repo.maven.apache.org/maven2
        https://maven.aliyun.com/repository/public
        检查顺序:Mirror镜像 -> settings.xml中的Profile仓库 -> POM中声明的仓库
    c.生命周期
        验证 validate 验证项目是否正确且所有必须信息是可用的
        编译 compile  源代码编译在此阶段完成
        测试 Test     使用适当的单元测试框架(例如JUnit)运行测试
        包装 package  创建JAR/WAR包如在 pom.xml 中定义提及的包,包括四步resources、compile、test、package
        检查 verify   对集成测试的结果进行检查,以保证质量达标
        安装 install  安装打包的项目到本地仓库,以供其他项目使用
        部署 deploy   拷贝最终的工程包到远程仓库中,以共享给其他开发人员和工程
        -----------------------------------------------------------------------------------------------------
        compile并不包含clean,执行compile之前先清理项目,可以显式地组合这两个命令:mvn clean compile
        package并不包含clean,package会自动触发其前面的所有阶段(validate、compile、test),最终将项目打包,可以显式地组合这两个命令:mvn clean package
        install并不包含clean,install会自动触发其前面的所有阶段(validate、compile、test、package),最终将项目打包并安装到本地仓库,可以显式地组合这两个命令:mvn clean install
    d.批量删除失败的包(下载失败的后缀: .lastUpdated)
        C:\software\apache-maven-3.6.3\repository>for /r %i in (*.lastUpdated) do del %i

02.常用信息2
    a.分类1
        mvn -v
        mvn clean                                                                     --清理项目
        mvn dependency:purge-local-repository                                         --清理本地Maven仓库缓存,然后重新下载安装
        mvn dependency:tree                                                           --查看依赖树,检查是否有冲突
        mvn clean install                                                             --强制更新依赖
        mvn dependency:tree | grep fastjson                                           --查找tree依赖
        mvn compile exec:java -Dexec.mainClass=fucking.concurrency.demo.WrongCounterDemo
    b.分类2
        cd jh4j-product-onboard-unpack
        mvn clean generate-resources                                                  --方式1:执行解压
        mvn dependency:unpack                                                         --方式2:直接执行插件目标
        jad -8 -o -r -sjava -d src classes/**/*.class                                 --方式3:使用jad批量解析
        java -jar /path/to/cfr.jar --outputdir src/decompiled --comments false --decodefinally false jh4j-cloud-common-data-2.3.0.jar
    c.分类3
        mvn clean
        mvn clean package
        mvn clean install -pl 单模块名 -am -Dmaven.test.skip=true
    d.分类4
        Spring Boot:java -jar myapp.jar
        普通jar:java -cp myapp.jar:lib/* com.example.MainClass

03.常用信息3
    a.方案1:强制更新依赖(推荐)
        使用 Maven 的 -U 参数强制更新所有依赖:mvn clean install -U
        -U 参数会强制检查远程仓库的更新,包括 SNAPSHOT 依赖和之前失败的依赖
    b.方案2:清除特定依赖的本地缓存
        如果只想清除特定依赖的缓存,可以手动删除该依赖在本地仓库中的文件夹:
        # Windows
        rmdir /s "C:\Users\<用户名>\.m2\repository\com\jhict\jh4j-cloud-common-bom"
        # Linux/MacOS
        rm -rf ~/.m2/repository/com/jhict/jh4j-cloud-common-bom
        然后重新构建项目
    c.方案3:使用 Maven 依赖插件清理本地仓库
        # 清理并重新下载所有依赖
        mvn dependency:purge-local-repository
        # 仅清理,不重新下载
        mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false
    d.方案4:完全清理本地 Maven 仓库
        # 如果问题持续存在,可以完全清理本地 Maven 缓存
        # Windows
        rmdir /s "C:\Users\<用户名>\.m2\repository"
        # Linux/MacOS
        rm -rf ~/.m2/repository
    e.说明
        该错误通常由以下原因造成:
        私有依赖不在公共仓库中:com.jhict:jh4j-cloud-common-bom 看起来是一个私有依赖,不存在于阿里云 Maven 公共仓库中
        需要配置私有仓库:您可能需要添加包含该依赖的私有 Maven 仓库
        网络问题导致的缓存失败:之前的网络问题导致下载失败,结果被缓存
        -----------------------------------------------------------------------------------------------------
        首先尝试强制更新:mvn clean install -U
        如果仍然失败,检查是否需要配置私有仓库
        如果确认该依赖不再需要,从 POM 文件中移除相关的 import
        作为最后手段,完全清理本地 Maven 缓存
    f.解决,20250828
        使用前需要切换,构建工具 -> maven -> /Users/troyesivens/.m2/settings_jh4j.xml

04.常用信息4
    a.mvn命令(package包括四步resources、compile、test、package)
        a.只编译main目录中的java文件
            mvn compile
        b.测试
            mvn test
        c.打成jar/war
            mvn package
        d.将开发的模块放入本地仓库,供其他模块以GAV的方式使用
            mvn install
        e.删除编译后的target目录
            mvn clean
    b.删除失效的包
        set REPOSITORY_PATH=D:\software\apache-maven-3.6.3\repository
        rem ****************clean start****************
        for /f "delims=" i
        )
        rem ****************clean end****************
        pause
    c.要在执行 compile 和 install 之前自动执行 clean
        使用 maven-clean-plugin 配置:
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
                <execution>
                    <id>auto-clean</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        这种方式会在 initialize 阶段执行 clean,而 initialize 阶段在 compile 之前执行。
    d.settings.xml(pom.xml编码方式来配置Tomcat服务器)
        <?xml version="1.0" encoding="UTF-8"?>
        <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
          <localRepository>C:/software/apache-maven-3.6.3/repository</localRepository>
          <pluginGroups></pluginGroups>
          <proxies></proxies>
          <servers></servers>
          <mirrors>
            <mirror>
              <id>aliyunmaven</id>
              <mirrorOf>*</mirrorOf>
              <name>阿里云公共仓库</name>
               <url>https://maven.aliyun.com/repository/public</url>
            </mirror>
          </mirrors>
          <profiles>
            <profile>
              <id>jdk-1.8</id>
              <activation>
                <jdk>1.8</jdk>
              </activation>
              <properties>
                <java.version>1.8</java.version>
                <maven.test.skip>true</maven.test.skip>
                <maven.compiler.source>8</maven.compiler.source>
                <maven.compiler.target>8</maven.compiler.target>
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
              </properties>
            </profile>
          </profiles>
        </settings>
    e.让pom.xml中的repositories生效
        <mirrors>
          <!-- mirror
          <mirror>
            <id>mirrorId</id>
            <mirrorOf>repositoryId</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://my.repository.com/repo/path</url>
          </mirror>
           -->
         <mirror>
            <id>nexus</id>
            <mirrorOf>*,!libs-snapshot,!libs-release</mirrorOf>
            <url>http://192.168.69.166:8081/repository/maven-public/</url>
          </mirror>
        </mirrors>
        配置!libs-snapshot,!libs-release,这样配置libs-release和libs-snapshot不会从settings.xml配置仓库中查找

05.常用信息5
    a.用途
        Cargo,一个通用的容器管理工具,它可以通过 Maven 插件来管理应用服务器(如 Tomcat)的启动、停止和部署
    b.项目名称
        <finalName>MavenWebProject</finalName>:指定生成的 WAR 包的名称
    c.插件定义
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.4.9</version>
    d.容器配置
        <containerId>tomcat8x</containerId>:指定使用的容器类型,这里是 Tomcat 8.x
        <home>D:\software\Java\apache-tomcat-8.5.45</home>:指定 Tomcat 的安装目录
    e.配置类型
        <type>existing</type>:表示使用现有的 Tomcat 安装
        <home>D:\software\Java\apache-tomcat-8.5.45</home>:再次指定 Tomcat 的安装目录
        <cargo.servlet.port>8080</cargo.servlet.port>:指定 Tomcat 的运行端口,默认为 8080
    f.执行配置
        <execution>:定义插件的执行阶段和目标
        <phase>install</phase>:指定在 Maven 的 install 阶段执行 Cargo 插件
        <goal>run</goal>:指定执行的目标为 run,即启动 Tomcat 并部署应用

1.4 gradle

01.环境变量
    GRADLE_HOME:C:\software\gradle-6.2.2
    GRADLE_USER_HOME:C:\software\gradle-6.2.2\repository
    path:%GRADLE_HOME%\bin

02.测试
    gradle -v

03.命令
    a.分类1
        gradle tasks: 列出所有可用的任务
        gradle build: 构建项目,包括编译代码、运行测试等
        gradle clean: 删除构建目录,通常用于清理项目
        gradle test: 运行项目中的测试
        gradle assemble: 生成项目的可分发文件(如 JAR、WAR)
        gradle check: 执行所有验证任务,包括测试
        gradle dependencies: 显示项目的依赖关系
        gradle help: 显示帮助信息
    b.分类2
        gradle init: 初始化一个新的 Gradle 项目
        gradle wrapper: 生成 Gradle Wrapper 文件,使项目可以使用特定版本的 Gradle 构建
        gradle properties: 显示项目属性
        gradle compileJava: 编译 Java 源代码
        gradle jar: 创建 JAR 文件

04.配置
    a.默认本地仓库
        C:\Users\13514\.gradle\caches\modules-2\files-2.1
    b.新建本地仓库
        C:\software\gradle-6.2.2\repository
    c.每个项目build.gradle
        repositories {
            mavenLocal()
            maven {
                url 'https://maven.aliyun.com/repository/public'
            }
            mavenCentral()
            jcenter()
        }
    d.编译生成的target
        gradle构建输出通常存放在项目目录下的 build 文件夹中,而不是 Maven 的 target 文件夹。
        具体来说,编译后的类文件、生成的 JAR 文件、测试结果等都会放在 build 文件夹内的相应子目录中。

1.5 curl

01.环境变量
    path:C:\software\curl-7.64.1\I386
          C:\software\libiconv-1.9.2\bin

02.测试
    curl www.baidu.com -i | iconv -f utf-8 -t gbk

1.6 mingw

01.环境变量(https://sourceforge.net/projects/mingw-w64/files/,选择x86_64-win32-seh)
    MINGW_HOME:C:\software\mingw64-8.1.0
    LIBRARY_PATH:%MINGW_HOME%\lib
    C_INCLUDE_PATH:%MINGW_HOME%\include
    path:C:\software\mingw64-8.1.0\bin
          C:\software\mingw64-8.1.0\libexec\gcc\x86_64-w64-mingw32\8.1.0
          C:\software\llvm-10.0.0\bin

02.测试
    gcc -v

1.7 nacos

01.介绍
    Nacos 致力于帮助您发现、配置和管理微服务。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据及流量管理。
    简单来说可以当作注册中心,代替Eureka或者ZK;可以当作配置中心,代替Appllo和Config

02.下载
    https://github.com/alibaba/nacos/releases/tag/2.0.0-ALPHA.2
    nacos-server-2.0.0-ALPHA.2.tar.gz                                            --已编译Linux和macOS格式
    nacos-server-2.0.0-ALPHA.2.zip                                               --windows版本
    Source code(zip)                                                           --windows版本源码
    Source code (tar.gz)                                                        --Linux和macOS格式源码

03.部署模式
    Nacos支持三种部署模式
    单机模式 - 用于测试和单机试用。
    集群模式 - 用于生产环境,确保高可用。
    多集群模式 - 用于多数据中心场景。

04.conf目录
    nacos-mysql.sql                                                              --初始化SQL
    application.properties                                                       --配置数据库

05.配置conf
    spring.datasource.platform=mysql
    db.num=1
    db.url.0=jdbc:mysql://localhost:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
    db.user=root
    db.password=123456

06.启动并访问
    cd C:\software\nacos\bin
    startup.cmd -m standalone                                                    --standalone指定为单机模式,否则以cluster集群模式启动
    ---------------------------------------------------------------------------------------------------------
    http://localhost:8848/nacos
    nacos/nacos

1.8 seata

01.网址
    https://github.com/seata/seata/releases

02.配置,conf/application.yml
    server:
      port: 7091

    spring:
      application:
        name: seata-server

    logging:
      config: classpath:logback-spring.xml
      file:
        path: ${user.home}/logs/seata
      extend:
        logstash-appender:
          destination: 127.0.0.1:4560
        kafka-appender:
          bootstrap-servers: 127.0.0.1:9092
          topic: logback_to_logstash

    console:
      user:
        username: seata
        password: seata
    seata:
      config:
        # support: nacos 、 consul 、 apollo 、 zk  、 etcd3
        type: nacos
        nacos:
          server-addr: 127.0.0.1:8848
          namespace:
          group: DEFAULT_GROUP
          username: nacos
          password: nacos
          context-path:
          ##if use MSE Nacos with auth, mutex with username/password attribute
          #access-key:
          #secret-key:
          data-id: seataServer.properties
      registry:
        # support: nacos 、 eureka 、 redis 、 zk  、 consul 、 etcd3 、 sofa
        type: nacos
        preferred-networks: 30.240.*
        nacos:
          application: seata-server
          server-addr: 127.0.0.1:8848
          group: DEFAULT_GROUP
          namespace:
          cluster: default
          username: nacos
          password: nacos
          context-path:
          ##if use MSE Nacos with auth, mutex with username/password attribute
          #access-key:
          #secret-key:
      server:
        service-port: 8091 #If not configured, the default is '${server.port} + 1000'
        max-commit-retry-timeout: -1
        max-rollback-retry-timeout: -1
        rollback-retry-timeout-unlock-enable: false
        enable-check-auth: true
        enable-parallel-request-handle: true
        retry-dead-threshold: 130000
        xaer-nota-retry-timeout: 60000
        enableParallelRequestHandle: true
        recovery:
          committing-retry-period: 1000
          async-committing-retry-period: 1000
          rollbacking-retry-period: 1000
          timeout-retry-period: 1000
        undo:
          log-save-days: 7
          log-delete-period: 86400000
        session:
          branch-async-queue-size: 5000 #branch async remove queue size
          enable-branch-async-remove: false #enable to asynchronous remove branchSession
      store:
        # support: file 、 db 、 redis
        mode: db
        session:
          mode: file
        lock:
          mode: file
        file:
          dir: sessionStore
          max-branch-session-size: 16384
          max-global-session-size: 512
          file-write-buffer-cache-size: 16384
          session-reload-read-size: 100
          flush-disk-mode: async
        db:
          datasource: druid
          db-type: mysql
          driver-class-name: com.mysql.jdbc.Driver
          url: jdbc:mysql://127.0.0.1:3306/ry-seata?rewriteBatchedStatements=true
          user: mysql
          password: 123456
          min-conn: 10
          max-conn: 100
          global-table: global_table
          branch-table: branch_table
          lock-table: lock_table
          distributed-lock-table: distributed_lock
          query-limit: 1000
          max-wait: 5000
        redis:
          mode: single
          database: 0
          min-conn: 10
          max-conn: 100
          password:
          max-total: 100
          query-limit: 1000
          single:
            host: 127.0.0.1
            port: 6379
          sentinel:
            master-name:
            sentinel-hosts:
      security:
        secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
        tokenValidityInMilliseconds: 1800000
        ignore:
          urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login
      metrics:
        enabled: false
        registry-type: compact
        exporter-list: prometheus
        exporter-prometheus-port: 9898
      transport:
        rpc-tc-request-timeout: 15000
        enable-tc-server-batch-send-response: false
        shutdown:
          wait: 3
        thread-factory:
          boss-thread-prefix: NettyBoss
          worker-thread-prefix: NettyServerNIOWorker
          boss-thread-size: 1

03.运行
    127.0.0.1:7091
    seata
    seata

1.9 sentinel

01.下载
    https://github.com/alibaba/Sentinel/releases

02.启动
    c:
    cd C:\software\sentinel
    java -jar sentinel-dashboard-1.8.6.jar

03.运行
    http://localhost:8858/
    sentinel
    sentinel

1.10 xxl-job

01.下载
    https://www.xuxueli.com/xxl-job/

02.启动
    c:
    cd C:\software\xxl-job
    java -jar xxl-job-admin-2.3.0.jar

03.运行
    http://127.0.0.1:8888/xxl-job-admin/
    admin
    123456

1.11 skywalking

01.下载
    https://archive.apache.org/dist/skywalking/6.6.0/

02.启动:执行startup.bat之后会启动如下两个服务:
    默认是h2,重启数据丢失,将数据进行持久化,改为mysql重启数据不丢失
    (1)Skywalking-Collector:追踪信息收集器,通过 gRPC/Http 收集客户端的采集信息 ,Http默认端口 12800,gRPC默认端口 11800。
    (2)Skywalking-Webapp:管理平台页面 默认端口 8080
    (3)登录信息 admin/admin

03.运行
    http://127.0.0.1:8868
    admin
    admin

2 java2

2.1 pom

01.SpringBoot启动类的相关机制
    a.SpringBoot 识别启动类的主要依据
        类上有 @SpringBootApplication 注解
        包含 main() 方法
        通常继承 SpringBootServletInitializer(用于支持 WAR 部署)
    b.启动类位置的重要性
        启动类通常位于根包下(在您的例子中是 org.jeecg)
        SpringBoot 默认会扫描启动类所在包及其子包下的所有组件
        您的项目中通过 @ComponentScan 显式指定了要扫描的包:{"org.jeecg", "cn.jggroup"}
    c.配置文件位置
        配置文件(application.properties/application.yml)不一定要和启动类在同一个模块,但通常建议:主配置文件放在启动类模块的 resources 目录下
        SpringBoot 会按以下顺序寻找配置文件:
        file:./config/
        file:./
        classpath:/config/
        classpath:/

02.jar包/pom包
    a.报错
        [INFO]
        [INFO] YDSZBOOT平台 1.0.0 ................................... SUCCESS [  0.005 s]
        [INFO] ydsz-boot-base-core 1.0.0 .......................... SUCCESS [  9.009 s]
        [INFO] ydsz-module-system 1.0.0 ........................... SUCCESS [  0.001 s]
        [INFO] ydsz-system-api 1.0.0 .............................. SUCCESS [  0.000 s]
        [INFO] ydsz-system-local-api 1.0.0 ........................ SUCCESS [  1.616 s]
        [INFO] ydsz-module-biz 1.0.0 .............................. SUCCESS [  0.002 s]
        [INFO] ydsz-module-yunzhijia 1.0.0 ........................ SUCCESS [  1.830 s]
        [INFO] ydsz-system-biz 1.0.0 .............................. SUCCESS [ 11.774 s]
        [INFO] ydsz-module-ejia 1.0.0 ............................. SUCCESS [  2.949 s]
        [INFO] ydsz-module-abnormal-shipment 1.0.0 ................ SUCCESS [  3.007 s]
        [INFO] ydsz-module-access 1.0.0 ........................... SUCCESS [  3.805 s]
        [INFO] ydsz-module-birthday 1.0.0 ......................... SUCCESS [  3.092 s]
        [INFO] ydsz-module-eas 1.0.0 .............................. SUCCESS [  3.866 s]
        [INFO] ydsz-module-ejiaNotic 1.0.0 ........................ SUCCESS [  2.431 s]
        [INFO] ydsz-module-empower 1.0.0 .......................... SUCCESS [  3.119 s]
        [INFO] ydsz-module-finance 1.0.0 .......................... SUCCESS [  3.672 s]
        [INFO] ydsz-module-erp 1.0.0 .............................. SUCCESS [  2.229 s]
        [INFO] ydsz-module-examine 1.0.0 .......................... SUCCESS [  3.210 s]
        [INFO] ydsz-module-kpi-task 1.0.0 ......................... SUCCESS [  4.284 s]
        [INFO] ydsz-module-meetCheck 1.0.0 ........................ SUCCESS [  3.852 s]
        [INFO] ydsz-module-produce 1.0.0 .......................... SUCCESS [  3.211 s]
        [INFO] ydsz-module-prove 1.0.0 ............................ SUCCESS [  2.270 s]
        [INFO] ydsz-module-sales 1.0.0 ............................ SUCCESS [  2.733 s]
        [INFO] ydsz-module-task 1.0.0 ............................. SUCCESS [  3.917 s]
        [INFO] ydsz-moudle-capitalManage 1.0.0 .................... SUCCESS [  2.724 s]
        [INFO] ydsz-moudle-train 1.0.0 ............................ SUCCESS [  4.361 s]
        [INFO] ydsz-moudle-ysgzh 0.0.1-SNAPSHOT ................... SUCCESS [  2.869 s]
        [INFO] ydsz-module-demo 1.0.0 ............................. SUCCESS [  3.965 s]
        [INFO] ydsz-system-cloud-api 1.0.0 ........................ SUCCESS [  1.560 s]
        [INFO] ydsz-system-start 1.0.0 ............................ FAILURE [  3.658 s]
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time:  01:35 min
        [INFO] Finished at: 2024-12-28T09:14:32+08:00
        [INFO] ------------------------------------------------------------------------
        [ERROR] Failed to execute goal on project ydsz-system-start: Could not resolve dependencies for project cn.jggroup:ydsz-system-start:jar:1.0.0
        [ERROR] dependency: cn.jggroup:ydsz-module-biz:jar:1.0.0 (compile)
        [ERROR]     Could not find artifact cn.jggroup:ydsz-module-biz:jar:1.0.0 in aliyun (https://maven.aliyun.com/repository/public)
        [ERROR]     Could not find artifact cn.jggroup:ydsz-module-biz:jar:1.0.0 in jeecg (https://maven.jeecg.org/nexus/content/repositories/jeecg)
        [ERROR]     Could not find artifact cn.jggroup:ydsz-module-biz:jar:1.0.0 in central (https://repo.maven.apache.org/maven2)
        [ERROR]
        [ERROR] -> [Help 1]
        -----------------------------------------------------------------------------------------------------
        主要原因是在 ydsz-system-start/pom.xml 中引用了 ydsz-module-biz 依赖,但这个依赖的打包类型是 pom,不能直接作为 jar 包依赖。
    b.提问
        可以将 ydsz-module-biz 变成jar包不
        -----------------------------------------------------------------------------------------------------
        从项目结构来看,ydsz-module-biz 是一个聚合模块,包含了多个子模块:
        在backend/ydsz-module-system/ydsz-system-start/pom.xml逐个引入每个子模块
        <dependency>
          <groupId>cn.jggroup</groupId>
          <artifactId>ydsz-module-demo</artifactId>
          <version>1.0.0</version>
        </dependency>
        <dependency>
          <groupId>cn.jggroup</groupId>
          <artifactId>ydsz-module-abnormal-shipment</artifactId>
          <version>1.0.0</version>
        </dependency>

03.子模块没有继承父模块中的依赖,可能是由于以下几种原因
    a.子模块的 POM 没有显式继承父模块
        如果子模块的 pom.xml 中没有使用 <parent> 标签继承父模块的配置,
        则父模块中的依赖不会自动继承到子模块中。确保子模块的 pom.xml 文件包含以下内容:
        <parent>
            <groupId>父模块的 groupId</groupId>
            <artifactId>父模块的 artifactId</artifactId>
            <version>父模块的版本</version>
        </parent>
    b.父模块的依赖声明在<dependencyManagement>中
        如果父模块中的依赖声明在 <dependencyManagement> 部分中,
        而不是直接在 <dependencies> 中,子模块需要显式声明依赖才会生效。例如: 父模块:
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.jeecgframework.jimureport</groupId>
                    <artifactId>jimureport-spring-boot-starter</artifactId>
                    <version>1.6.5</version>
                </dependency>
            </dependencies>
        </dependencyManagement>
        -----------------------------------------------------------------------------------------------------
        子模块需要显式声明依赖:
        <dependencies>
            <dependency>
                <groupId>org.jeecgframework.jimureport</groupId>
                <artifactId>jimureport-spring-boot-starter</artifactId>
            </dependency>
        </dependencies>
    c.子模块中对依赖进行了排除或覆盖
        子模块可能通过 <exclusions> 或覆盖方式排除了父模块中的依赖。
        检查子模块的 pom.xml,看是否有类似如下的配置:
        <dependency>
            <groupId>org.jeecgframework.jimureport</groupId>
            <artifactId>jimureport-spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>jimureport-spring-boot-starter</artifactId>
                    <groupId>org.jeecgframework</groupId>
                </exclusion>
            </exclusions>
        </dependency>
    d.父模块和子模块的依赖范围不一致
        父模块中定义的依赖范围(例如 scope)可能导致该依赖对子模块不可见。例如:
        <dependency>
            <groupId>org.jeecgframework.jimureport</groupId>
            <artifactId>jimureport-spring-boot-starter</artifactId>
            <version>1.6.5</version>
            <scope>provided</scope>
        </dependency>
    e.构建工具的配置问题
        如果使用的是多模块项目,检查项目是否正确加载了父模块。例如:
        父模块的 POM 文件中是否包含所有子模块:
        <modules>
            <module>子模块路径</module>
        </modules>
    f.总结
        子模块正确继承父模块。
        父模块中使用 <dependencies> 而非 <dependencyManagement>,或者子模块显式声明依赖。
        检查依赖范围与排除配置是否合理。

04.<dependencies>和<dependencyManagement>中引入依赖的区别
    a.直接在 <dependencies> 中引入依赖
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <version>2.6.6</version>
            </dependency>
        </dependencies>
        -----------------------------------------------------------------------------------------------------
        直接引入并使用该依赖
        子模块会直接继承父模块声明的所有依赖
        必须指定版本号(除非父POM已经指定)
        会直接下载jar包到本地仓库并在项目中使用
    b.在 <dependencyManagement> 中引入依赖
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                    <version>2.6.6</version>
                </dependency>
            </dependencies>
        </dependencyManagement>
        -----------------------------------------------------------------------------------------------------
        只是声明依赖,并不实际引入
        统一管理项目的依赖版本
        子模块需要声明使用才会引入(不需要版本号)
        子模块可以选择性地使用父模块声明的依赖
    c.总结
        <dependencies>: 实际引入依赖
        直接下载使用
        子模块强制继承
        -----------------------------------------------------------------------------------------------------
        <dependencyManagement>: 依赖版本管理
        只是声明,不实际引入
        统一管理版本
        子模块需要时再引入
        避免版本冲突
        -----------------------------------------------------------------------------------------------------
        在你的项目中,建议:
        在父POM中使用 <dependencyManagement> 统一管理依赖版本
        2. 在子模块中使用 <dependencies> 引入实际需要的依赖
        这样可以更好地控制依赖,避免版本冲突

05.引入pom、jar区别
    a.spring-boot-starter-parent
        a.引入
            <parent>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>2.6.6</version>
            </parent>
        b.说明
            这是一个特殊的POM文件(只有.pom文件,没有.jar文件)
            作为父POM存在,用于继承
            主要功能:
                定义了默认的Java版本
                定义了默认的编码方式
                提供依赖管理(版本管理)
                提供插件管理
                定义了资源过滤器
            不包含实际的代码,只包含Maven配置
    b.spring-boot-starter 和 spring-boot-starter-web
        a.引入
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
                <version>2.6.6</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <version>2.6.6</version>
            </dependency>
        c.说明
            这些是实际的依赖包(有.jar文件)
            包含实际的代码和功能实现
            spring-boot-starter:核心启动器,提供核心功能
                spring-core
                spring-context
                日志功能等
            spring-boot-starter-web:web启动器,提供web相关功能
                spring-webmvc
                内嵌tomcat
                web相关功能等
    c.总结
        a.简单来说
            spring-boot-starter-parent:相当于一个"设置中心",只包含配置信息(.pom)
            spring-boot-starter和spring-boot-starter-web:相当于"功能模块",包含实际代码(.jar)
        b.举个例子
            spring-boot-starter-parent就像是一个"菜谱",告诉你各种配料(依赖)应该用什么品牌、用多少
            spring-boot-starter和spring-boot-starter-web就是实际的"配料",你可以用它们来做菜(开发应用)
        c.这就是为什么
            spring-boot-starter-parent只有.pom文件
            而其他starter有.jar文件,因为它们包含实际运行需要的代码

2.2 label

00.关键标签
    a.relativePath
        Maven寻找父POM的方式说明:
        1.当<relativePath/>为空时,Maven会:
        优先从本地仓库查找父POM
        如果本地仓库没有,则从远程仓库查找
        不会在当前项目目录中查找
        2.当指定具体路径时,如<relativePath>../parent/pom.xml</relativePath>:
        Maven会优先在指定路径查找父POM
        如果指定路径未找到,再按默认方式查找
        3. 当完全不写relativePath时:
        Maven会先在当前项目目录中查找父POM
        如果未找到,再从本地仓库和远程仓库查找
        -----------------------------------------------------------------------------------------------------
        同一个jar包,被依赖时,parent必须是pom,其dependency必须是该pom里面的module
        一个pom里面的module,既然作为module放到pom,就不能此时【既加入到module,又放到dependency】
    b.<scope>元素
        compile(默认值):参与项目的全部生命周期,会被打包到最终的artifact中
        provided:参与编译、测试阶段,不会被打包到最终的artifact中,典型用例:servlet-api,因为运行时由容器提供
        runtime:不参与编译,但会参与测试和运行阶段,会被打包到最终的artifact中,典型用例:JDBC驱动
        test:只参与测试阶段,不参与编译和运行,不会被打包到最终的artifact中
        system:类似provided,需要显式提供jar包的路径。不推荐使用
        import:只用于<dependencyManagement>中,用于导入其他pom的依赖管理配置
    c.<optional>元素
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>some-library</artifactId>
            <version>1.0</version>
            <optional>true</optional>
        </dependency>
        -----------------------------------------------------------------------------------------------------
        作用:标记一个依赖为可选的,即不会被默认传递到依赖这个项目的其他项目中。
        值:true:将依赖标记为可选;false:依赖不是可选的(默认值)
        使用场景:当一个项目有多个特性,每个特性依赖不同的库时,可以使用<optional>true</optional>来标记这些特定的依赖。
        传递性:被标记为optional的依赖不会被传递到依赖于当前项目的其他项目中。如果其他项目需要使用这个可选依赖,需要在自己的pom文件中显式声明。
        -----------------------------------------------------------------------------------------------------
        注意事项:
        使用optional可以减少不必要的依赖传递,但也可能导致运行时类找不到的问题。
        在使用optional依赖时,需要确保最终使用者了解这些可选依赖,并在需要时显式引入。
        -----------------------------------------------------------------------------------------------------
        生命周期影响:
        <optional>标签本身不直接影响Maven的生命周期。
        它主要影响依赖的传递性,而不是依赖在当前项目中的使用。

01.常用元素
    a.分类1
        project:包含pom一些约束的信息
        modelVersion:指定当前pom的版本
        parent:子模块对父模块的继承
        modules:聚合多个maven项目
    b.分类2
        groupId:主项目标示,定义当前maven属于哪个项目,反写公司网址+项目名
        artifactId:实际项目模块标识,项目名+模块名
        version:当前项目版本号,第一个0标识大版本号,第二个0标示分支版本号,第三个0标识小版本号,0.0.1,snapshot快照,alpha内部测试,beta公测,release稳定,GA正式发布
    c.分类3
        name:项目描述名
        url:项目地址
        description:项目描述
        developers:开发人员列表
        licenses:许可证
        organization:组织
    d.分类4
        dependencyManagement:依赖的管理
        dependencies:依赖列表
        dependency:依赖项目 里面放置坐标
        -----------------------------------------------------------------------------------------------------
        scope:包的依赖范围 test
        optional:设置依赖是否可选
        exclusions:排除依赖传递列表
    e.分类5
        build:为构建行为提供支持
        plugins:插件列表

02.依赖范围
    a.说明
        maven中三种classpath、编译,测试,运行
    b.5种类型
        compile:默认范围,编译测试运行都有效
        provided:在编译和测试时有效
        runtime:在测试和运行时有效
        test:只在测试时有效
        system:在编译和测试时有效,与本机系统关联,可移植性差
    c.具体说明
        a.compile
            默认就是compile,什么都不配置也就是意味着compile。
            compile表示被依赖项目需要参与当前项目的编译,
            当然后续的测试,运行周期也参与其中,是一个比较强的依赖。
            打包的时候通常需要包含进去。
            默认的scope,在部署的时候将会打包到lib目录下,项目在编译,测试,运行阶段都需要
        b.provided
            provided适合在编译和测试的环境,他和compile很接近,
            但是provide仅仅需要在编译和测试阶段,同样provide将不会被打包到lib目录下。
        c.runntime
            runntime这个scope,仅仅适用于运行环境,在编译和测试环境下都不会被使用
        d.test
            scope为test表示依赖项目仅仅参与测试相关的工作,在编译和运行环境下都不会被使用,更别说打包了。
        c.system
            从参与度来说,也provided相同,不过被依赖项不会从maven仓库抓,
            而是从本地文件系统拿,一定需要配合systemPath属性使用。
    d.scope的依赖传递
        A–>B–>C。当前项目为A,A依赖于B,B依赖于C。知道B在A项目中的scope,那么怎么知道C在A中的scope呢?答案是:
        当C是test或者provided时,C直接被丢弃,A不依赖C;
        否则A依赖C,C的scope继承于B的scope。
    e.为什么需要区分这些scope
        可以用来限制dependency的范围可以在不同的环境下打包不同的jar包,
        比如junit测试类的jar包不需要在编译运行的时候,就可以设置scope为test。
    f.最后还有一个<optional>true</optional>是什么意思,怎么用的呢?
        <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-devtools</artifactId>
           <optional>true</optional>
        </dependency>
        在SpringBoot官网文件中你可以得到解释就是,
        <optional>true</optional>的话,其他项目依赖此项目也不会进行传递,只能本项目使用。

03.继承范畴
    a.在Maven的父子模块中,子模块会继承父模块的build配置
        a.继承规则
            插件配置(plugins)会被继承
            资源配置(resources)会被继承
            但子模块可以覆盖父模块的配置
        b.在你的例子中
            <!-- 父模块 pom.xml -->
            <build>
              <resources>
                <resource>
                  <directory>src/main/resources</directory>
                  <filtering>true</filtering>
                </resource>
                <resource>
                  <directory>src/main/java</directory>
                  <includes>
                    <include>**/*.xml</include>
                    <include>**/*.json</include>
                    <include>**/*.ftl</include>
                  </includes>
                </resource>
              </resources>
            </build>
            -------------------------------------------------------------------------------------------------
            <!-- 子模块 jeecg-module-common/pom.xml -->
            <build>
              <!-- 完全相同的配置 -->
            </build>
        c.建议修改
            由于父模块已经定义了这些配置,子模块中的重复配置是不必要的
            你可以删除子模块中的build配置,直接继承父模块的配置
            如果子模块需要特殊配置,只需要添加差异部分
        d.最佳实践
            <!-- 父模块保留完整配置 -->
            <build>
              <plugins>...</plugins>
              <resources>...</resources>
            </build>
            -------------------------------------------------------------------------------------------------
            <!-- 子模块只需要特殊配置(如果有的话) -->
            <build>
              <plugins>
                <!-- 只添加额外的插件 -->
              </plugins>
              <resources>
                <!-- 只添加额外的资源配置 -->
              </resources>
            </build>
            -------------------------------------------------------------------------------------------------
            所以,你可以安全地删除jeecg-module-common/pom.xml中的build配置,因为它已经从父模块继承了完全相同的配置。这样可以减少配置的重复,使项目结构更清晰。
            如果将来需要为子模块添加特殊的构建配置,再单独添加即可。
    b.父子模块,哪些可以继承,哪些可以覆盖
        a.可继承的元素
            a.项目依赖 Dependencies
                <dependencies>
                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-web</artifactId>
                    </dependency>
                </dependencies>
            b.依赖管理 DependencyManagement
                <dependencyManagement>
                    <dependencies>
                        <dependency>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-dependencies</artifactId>
                            <version>${spring-boot.version}</version>
                            <type>pom</type>
                            <scope>import</scope>
                        </dependency>
                    </dependencies>
                </dependencyManagement>
            c.插件配置 Plugins
                <build>
                    <plugins>
                        <plugin>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-maven-plugin</artifactId>
                        </plugin>
                    </plugins>
                </build>
            d.插件管理 PluginManagement
                <build>
                    <pluginManagement>
                        <plugins>
                            <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <version>3.8.1</version>
                            </plugin>
                        </plugins>
                    </pluginManagement>
                </build>
            e.属性配置 Properties
                <properties>
                    <java.version>1.8</java.version>
                    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                </properties>
            f.资源配置 Resources
                <build>
                    <resources>
                        <resource>
                            <directory>src/main/resources</directory>
                        </resource>
                    </resources>
                </build>
        b.可覆盖的元素
            a.项目坐标信息
                <groupId>com.example</groupId>
                <artifactId>child-module</artifactId>
                <version>1.0.0</version>
                <packaging>jar</packaging>
            b.依赖版本
                <dependencies>
                    <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-web</artifactId>
                        <version>2.5.0</version>  <!-- 覆盖父模块版本 -->
                    </dependency>
                </dependencies>
            c.插件配置
                <build>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <configuration>  <!-- 覆盖父模块配置 -->
                                <source>11</source>
                                <target>11</target>
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            d.属性值
                <properties>
                    <java.version>11</java.version>  <!-- 覆盖父模块属性值 -->
                </properties>
        c.最佳实践
            a.在父模块中使用dependencyManagement
                <dependencyManagement>
                    <dependencies>
                        <!-- 声明依赖但不实际引入 -->
                    </dependencies>
                </dependencyManagement>
            b.在父模块中使用pluginManagement
                <build>
                    <pluginManagement>
                        <plugins>
                            <!-- 声明插件但不实际使用 -->
                        </plugins>
                    </pluginManagement>
                </build>
            c.在子模块中选择性引入
                <dependencies>
                    <!-- 只引入需要的依赖 -->
                </dependencies>
                <build>
                    <plugins>
                        <!-- 只使用需要的插件 -->
                    </plugins>
                </build>
            d.使用属性引用
                <properties>
                    <spring.version>5.3.0</spring.version>
                </properties>
                <dependencies>
                    <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-core</artifactId>
                        <version>${spring.version}</version>
                    </dependency>
                </dependencies>

04.父子模块
    a.父模块
          <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.6.6</version>
          </parent>

          <!--gav-->
          <groupId>cn.jggroup</groupId>
          <artifactId>ydsz-boot-parent</artifactId>
          <version>1.0.0</version>

          <!--pack、name-->
          <packaging>pom</packaging>
          <name>ydsz-boot-parent</name>

          <!--modules-->
          <modules>
            <module>ydsz-module-code</module>
            <module>ydsz-module-jimu</module>
            <module>ydsz-module-system</module>
            <module>ydsz-module-biz</module>
          </modules>
    b.子模块1,继承父模块
          <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.6.6</version>
            <relativePath/>
          </parent>
          <groupId>cn.jggroup</groupId>
          <artifactId>ydsz-module-code</artifactId>
          <version>1.0.0</version>
    c.子模块2,使用spring的starter
          <modelVersion>4.0.0</modelVersion>
          <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.6.6</version>
            <relativePath/>
          </parent>
          <groupId>cn.jggroup</groupId>
          <artifactId>ydsz-module-code</artifactId>
          <version>1.0.0</version>

05.build
    a.说明
        <build>
           <plugins>
              <!-- maven依赖打包配置 -->
              <!--  引入上面的 maven-dependency-plugin示例 -->
              <!-- maven主文件打包 -->
              <!-- 引入上面的 maven-jar-plugin 示例 -->
           </plugins>
        </build>
    b.includeSystemScope标签
        <build>
           <plugins>
             <!-- 只需要保留一个 spring-boot-maven-plugin 配置 -->
             <plugin>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-maven-plugin</artifactId>
               <version>2.6.6</version>
               <configuration>
                 <includeSystemScope>true</includeSystemScope>
               </configuration>
             </plugin>
           </plugins>
        </build>
        -----------------------------------------------------------------------------------------------------
        <includeSystemScope>true</includeSystemScope> 这个配置的含义是:
        在使用 spring-boot-maven-plugin 打包时,将 scope 为 system 的依赖也打包到最终的 jar/war 文件中。
        -----------------------------------------------------------------------------------------------------
        具体解释:
        Maven 中依赖的 scope 有几种类型:compile、provided、runtime、test、system 等
        其中 system scope 表示依赖项不从 Maven 仓库获取,而是从本地文件系统获取
        默认情况下,spring-boot-maven-plugin 打包时会排除 system scope 的依赖
        设置 includeSystemScope 为 true 后,这些本地依赖也会被打包进去
        -----------------------------------------------------------------------------------------------------
        这个配置在以下场景特别有用:
        当项目依赖了一些本地的 jar 包(比如未发布到 Maven 仓库的内部库)
        使用了一些只能通过本地文件引入的专有软件包
        需要引入特定版本但在 Maven 仓库中找不到的依赖
    c.<resources>标签的2种位置
        a.在 <build> 内部
            <build>
                <resources>
                    <!-- resource配置 -->
                </resources>
            </build>
        b.在 <project> 下与 <build> 平级
            <project>
                <build>
                    <!-- build配置 -->
                </build>
                <resources>
                    <!-- resource配置 -->
                </resources>
            </project>
        c.区别
            <build> 内部的 <resources> 是标准推荐的配置方式
                这是Maven官方推荐的位置
                更符合Maven的构建生命周期管理
                与其他构建相关配置(如plugins)保持一致的组织结构
            -------------------------------------------------------------------------------------------------
            与 <build> 平级的 <resources> 是较老的写法
                在早期版本的Maven中使用
                仍然有效,但不推荐
                可能在未来版本中被废弃
            -------------------------------------------------------------------------------------------------
            建议:使用第一种方式,将 <resources> 放在 <build> 标签内部,这样更规范且更易维护。
    d.pluginManagement父模块定义的插件,子模块必须显示继承吗
        a.在父模块中的pluginManagement定义
            <!-- 一、统一管理插件版本和配置,避免子模块重复配置 -->
            <pluginManagement>
              <plugins>
                <!-- 指定JDK编译版本 -->
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>3.8.1</version>
                  <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                  </configuration>
                </plugin>
                <!-- Spring Boot Maven 插件 -->
                <plugin>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-maven-plugin</artifactId>
                  <version>2.6.6</version>
                  <configuration>
                    <includeSystemScope>true</includeSystemScope>
                  </configuration>
                </plugin>
              </plugins>
            </pluginManagement>
            这个配置定义了插件的版本和默认配置,但不会自动应用这些插件。
        b.子模块有两种方式使用这些插件:
            a.简单引用 - 只需声明插件的 groupId 和 artifactId
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                    </plugin>
                </plugins>
            b.覆盖配置 - 可以选择性地覆盖父模块中的配置:
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>11</source>  <!-- 覆盖父模块的配置 -->
                            <target>11</target>
                        </configuration>
                    </plugin>
                </plugins>
        c.而父模块中的plugins(不是pluginManagement)部分
            <plugins>
              <!-- 打包跳过测试 -->
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                  <skipTests>true</skipTests>
                </configuration>
              </plugin>
            </plugins>
            这部分配置会自动被所有子模块继承,不需要在子模块中显式声明。
        d.总结
            pluginManagement: 定义可选的插件配置,子模块需要显式声明才会使用
            plugins: 定义必须的插件配置,子模块自动继承,无需显式声明
    e.父子模块,示例1
        a.父模块
              <build>
                <!-- 一、统一管理插件版本和配置,避免子模块重复配置 -->
                <pluginManagement>
                  <plugins>
                    <!-- maven-compiler-plugin:指定JDK编译版本 -->
                    <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <version>3.8.1</version>
                      <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <encoding>UTF-8</encoding>
                      </configuration>
                    </plugin>
                    <!-- spring-boot-maven-plugin:能够将springboot项目打包为可执行的jar/war -->
                    <plugin>
                      <groupId>org.springframework.boot</groupId>
                      <artifactId>spring-boot-maven-plugin</artifactId>
                      <version>2.6.6</version>
                      <configuration>
                        <includeSystemScope>true</includeSystemScope>
                      </configuration>
                    </plugin>
                  </plugins>
                </pluginManagement>
                <plugins>
                  <!-- 二、所有子模块都会继承这个配置 -->
                  <!-- maven-resources-plugin:避免font文件的二进制文件格式压缩破坏 -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                    <configuration>
                      <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                        <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                        <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                        <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                      </nonFilteredFileExtensions>
                    </configuration>
                  </plugin>
                  <!-- maven-surefire-plugin:打包跳过测试 -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version>
                    <configuration>
                      <skipTests>true</skipTests>
                    </configuration>
                  </plugin>
                </plugins>
              </build>
        b.子模块
              <build>
                <plugins>
                  <!-- 一、统一管理插件版本和配置,避免子模块重复配置:继承父模块  -->
                  <!-- maven-compiler-plugin:指定JDK编译版本 -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                      <source>1.8</source>
                      <target>1.8</target>
                      <encoding>UTF-8</encoding>
                    </configuration>
                  </plugin>
                  <!-- spring-boot-maven-plugin:能够将springboot项目打包为可执行的jar/war -->
                  <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>2.6.6</version>
                    <configuration>
                      <includeSystemScope>true</includeSystemScope>
                    </configuration>
                  </plugin>

                  <!-- 二、所有子模块都会继承这个配置:覆盖配置 -->
                  <!-- maven-resources-plugin:避免font文件的二进制文件格式压缩破坏 -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                    <configuration>
                      <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                        <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                        <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                        <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                      </nonFilteredFileExtensions>
                    </configuration>
                  </plugin>
                  <!-- maven-surefire-plugin:打包跳过测试 -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version>
                    <configuration>
                      <skipTests>true</skipTests>
                    </configuration>
                  </plugin>
                </plugins>

                <!-- 三、模块特定的资源配置 -->
                <resources>
                  <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                  </resource>
                  <resource>
                    <directory>src/main/java</directory>
                    <includes>
                      <include>**/*.xml</include>
                      <include>**/*.json</include>
                      <include>**/*.ftl</include>
                    </includes>
                  </resource>
                </resources>
              </build>
    f.父子模块,示例2
        a.父模块
              <build>
                <pluginManagement>
                  <plugins>
                    <!-- spring-boot-maven-plugin:能够将springboot项目打包为可执行的jar/war -->
                    <plugin>
                      <groupId>org.springframework.boot</groupId>
                      <artifactId>spring-boot-maven-plugin</artifactId>
                      <version>2.6.6</version>
                      <configuration>
                        <includeSystemScope>true</includeSystemScope>
                      </configuration>
                    </plugin>
                    <!-- maven-compiler-plugin:指定JDK编译版本 -->
                    <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <version>3.8.1</version>
                      <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <encoding>UTF-8</encoding>
                      </configuration>
                    </plugin>
                    <!-- maven-surefire-plugin:打包跳过测试 -->
                    <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-surefire-plugin</artifactId>
                      <version>2.22.2</version>
                      <configuration>
                        <skipTests>true</skipTests>
                      </configuration>
                    </plugin>
                    <!-- maven-resources-plugin:避免font文件的二进制文件格式压缩破坏 -->
                    <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-resources-plugin</artifactId>
                      <version>3.1.0</version>
                      <configuration>
                        <nonFilteredFileExtensions>
                          <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                          <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                          <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                          <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                          <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                        </nonFilteredFileExtensions>
                      </configuration>
                    </plugin>
                  </plugins>
                </pluginManagement>
              </build>
        b.子模块
              <build>
                <plugins>
                  <!-- spring-boot-maven-plugin:能够将springboot项目打包为可执行的jar/war -->
                  <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>2.6.6</version>
                    <configuration>
                      <includeSystemScope>true</includeSystemScope>
                    </configuration>
                  </plugin>
                  <!-- maven-compiler-plugin:指定JDK编译版本 -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                      <source>1.8</source>
                      <target>1.8</target>
                      <encoding>UTF-8</encoding>
                    </configuration>
                  </plugin>
                  <!-- maven-surefire-plugin:打包跳过测试 -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version>
                    <configuration>
                      <skipTests>true</skipTests>
                    </configuration>
                  </plugin>
                  <!-- maven-resources-plugin:避免font文件的二进制文件格式压缩破坏 -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                    <configuration>
                      <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                        <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                        <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                        <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                      </nonFilteredFileExtensions>
                    </configuration>
                  </plugin>
                </plugins>
                <!-- 全局资源配置 -->
                <resources>
                  <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                  </resource>
                  <resource>
                    <directory>src/main/java</directory>
                    <includes>
                      <include>**/*.xml</include>
                      <include>**/*.json</include>
                      <include>**/*.ftl</include>
                    </includes>
                  </resource>
                </resources>
              </build>
    g.收集配置
        a.示例1
            <build>
              <plugins>
                <!-- maven依赖打包配置 -->
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-dependency-plugin</artifactId>
                  <executions>
                    <execution>
                      <id>copy-dependencies</id>
                      <phase>prepare-package</phase>
                      <goals>
                        <goal>copy-dependencies</goal>
                      </goals>
                      <configuration>
                        <outputDirectory>
                          ${project.build.directory}/lib
                        </outputDirectory>
                      </configuration>
                    </execution>
                  </executions>
                </plugin>

                <!-- maven主文件打包 -->
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-jar-plugin</artifactId>
                  <!-- <version>2.4</version>-->
                  <!-- 对要打的jar包进行配置 -->
                  <configuration>
                    <outputDirectory>
                      <!--输入打包可执行的jar到twin-web\libs\下-->
                      ${project.build.directory}/twin-web/
                    </outputDirectory>
                    <!-- Configuration of the archiver -->
                    <archive>
                      <!--生成的jar中,不要包含pom.xml和pom.properties这两个文件-->
                      <addMavenDescriptor>false</addMavenDescriptor>
                      <!-- Manifest specific configuration -->
                      <manifest>
                        <!-- 指定运行类 -->
                        <mainClass>
                          cn.test.App
                        </mainClass>
                        <!--是否要把第三方jar放到manifest的classpath中-->
                        <addClasspath>true</addClasspath>
                        <!-- 生成的manifest中classpath的前缀-->
                        <!-- 因为要把第三方jar放到lib目录下, 所以classpath的前缀是lib/ -->
                        <classpathPrefix>lib/</classpathPrefix>
                      </manifest>
                      <manifestEntries>
                        <!-- 增加配置文件的classpath-->
                        <Class-Path>./config/</Class-Path>
                      </manifestEntries>
                    </archive>
                    <!--过滤掉不希望包含在jar中的文件-->
                    <excludes>
                      <!-- 排除不需要的文件夹(路径是jar包内部的路径) -->
                      <exclude>**/assembly/</exclude>
                    </excludes>
                  </configuration>
                </plugin>
              </plugins>
            </build>
        b.示例2
            <build>
              <plugins>
                <!-- 指定JDK编译版本 -->
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                  </configuration>
                </plugin>
                <!-- 打包跳过测试 -->
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                    <skipTests>true</skipTests>
                  </configuration>
                </plugin>
                <!-- 避免font文件的二进制文件格式压缩破坏 -->
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-resources-plugin</artifactId>
                  <version>3.1.0</version>
                  <configuration>
                    <nonFilteredFileExtensions>
                      <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                      <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                      <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                      <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                      <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                  </configuration>
                </plugin>
              </plugins>
              <resources>
                <resource>
                  <directory>src/main/resources</directory>
                  <filtering>true</filtering>
                </resource>
                <resource>
                  <directory>src/main/java</directory>
                  <includes>
                    <include>**/*.xml</include>
                    <include>**/*.json</include>
                    <include>**/*.ftl</include>
                  </includes>
                </resource>
              </resources>
            </build>
        c.示例3
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <includeSystemScope>true</includeSystemScope>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>

06.distributionManagement
    a.说明
        a.说明
            <distributionManagement> 是 Maven 构建工具中的一个配置元素,主要用于定义 Maven 项目在发布过程中与远程仓库
            的交互。它指定了项目构建的最终发布位置,通常包括常规版本和快照版本的仓库位置,以及用于发布时的相关信息。
        b.<repository>:发布常规版本的仓库
            这个部分定义了 Maven 项目发布稳定版本(如 1.0.0、1.0.1 等)的目标仓库。
            例如,当你执行 mvn deploy 命令时,Maven 会将构建的发行版(release)部署到这个仓库。
            <repository>
              <id>repo-id</id>       <!-- 仓库的唯一标识符 -->
              <name>Repo Name</name>  <!-- 仓库的名称 -->
              <url>https://example.com/repository/releases</url> <!-- 仓库的 URL -->
            </repository>
        c.<snapshotRepository>:发布快照版本的仓库
            这个部分定义了 Maven 项目发布快照版本(Snapshot version,如 1.0.0-SNAPSHOT)的目标仓库。
            快照版本是开发过程中使用的版本,通常是一个不稳定、正在开发中的版本。
            <snapshotRepository>
              <id>repo-id</id>
              <name>Snapshot Repo</name>
              <url>https://example.com/repository/snapshots</url>
            </snapshotRepository>
            注意:<snapshotRepository> 和 <repository> 的区别是,<snapshotRepository> 用于快照版本,<repository> 用于稳定版本。
        d.<pluginRepository>:插件仓库
            pluginRepository 用于定义插件的存储库,类似于 repository 和 snapshotRepository,但是它专门用于插件的下载和发布。
            <pluginRepository>
              <id>plugin-repo</id>
              <url>https://example.com/repository/plugins</url>
            </pluginRepository>
    b.示例
        <distributionManagement>
          <!-- 发布版本构件的仓库 -->
          <repository>
            <id>rdc-releases</id>
            <url>https://packages.aliyun.com/maven/repository/2277291-release-HoKXzy/</url>
          </repository>
          <!-- 发布快照构件的仓库 -->
          <snapshotRepository>
            <id>rdc-snapshots</id>
            <url>https://packages.aliyun.com/maven/repository/2277291-snapshot-HWJRaP/</url>
          </snapshotRepository>
        </distributionManagement>

        <repositories>
          <!-- 阿里云公共仓库 -->
          <repository>
            <id>aliyun</id>
            <name>aliyun</name>
            <url>https://maven.aliyun.com/repository/public</url>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
          </repository>

          <!-- 阿里云Spring仓库 -->
          <repository>
            <id>spring-aliyun</id>
            <name>Spring Aliyun</name>
            <url>https://maven.aliyun.com/repository/spring</url>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
          </repository>

          <!-- Maven中央仓库 -->
          <repository>
            <id>central</id>
            <name>Maven Central</name>
            <url>https://repo1.maven.org/maven2/</url>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
          </repository>

          <!-- Spring官方仓库 -->
          <repository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/release</url>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
          </repository>

          <!-- Apache快照仓库 -->
          <repository>
            <id>apache-snapshots</id>
            <name>Apache Snapshots</name>
            <url>https://repository.apache.org/snapshots/</url>
            <releases>
              <enabled>false</enabled>
            </releases>
            <snapshots>
              <enabled>true</enabled>
            </snapshots>
          </repository>

          <!-- 添加 Jeecg 仓库 -->
          <repository>
            <id>jeecg</id>
            <name>jeecg Repository</name>
            <url>http://maven.jeecg.com:8090/nexus/content/repositories/jeecg</url>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
          </repository>

          <!-- 添加 Jeecg 快照仓库 -->
          <repository>
            <id>jeecg-snapshots</id>
            <name>jeecg Snapshot Repository</name>
            <url>http://maven.jeecg.com:8090/nexus/content/repositories/snapshots/</url>
            <releases>
              <enabled>false</enabled>
            </releases>
            <snapshots>
              <enabled>true</enabled>
            </snapshots>
          </repository>
        </repositories>

        <!-- 插件仓库配置 -->
        <pluginRepositories>
          <pluginRepository>
            <id>aliyun-plugin</id>
            <name>aliyun plugin</name>
            <url>https://maven.aliyun.com/repository/public</url>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
          </pluginRepository>
        </pluginRepositories>

07.dependencyManagement
    a.说明
        <dependencies>: 实际引入依赖
        直接下载使用
        子模块强制继承
        -----------------------------------------------------------------------------------------------------
        <dependencyManagement>: 依赖版本管理
        只是声明,不实际引入
        统一管理版本
        子模块需要时再引入
        避免版本冲突
        -----------------------------------------------------------------------------------------------------
        在你的项目中,建议:
        在父POM中使用 <dependencyManagement> 统一管理依赖版本
        2. 在子模块中使用 <dependencies> 引入实际需要的依赖
        这样可以更好地控制依赖,避免版本冲突
    b.示例
        <modelVersion>4.0.0</modelVersion>
        <parent>
          <!--
          spring-boot-starter-parent 是 Spring Boot 提供的父 POM,主要作用:
          1. 统一管理项目的依赖版本和插件版本,减少手动配置的复杂性。
          2. 提供合理的 Maven 插件默认配置,如编译、打包和测试插件。
          3. 推荐用于 Spring Boot 项目的 Maven 构建中,简化配置。
          版本 2.6.6 对应 Spring Boot 2.6.6 版本。
          -->
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-parent</artifactId>
          <version>2.6.6</version>
        </parent>

        <!--gav-->
        <groupId>cn.jggroup</groupId>
        <artifactId>ydsz-boot-parent</artifactId>
        <version>1.0.0</version>

        <!--pack、name-->
        <packaging>pom</packaging>
        <name>ydsz-boot-parent</name>

        <!--modules-->
        <modules>
          <module>ydsz-module-common</module>
          <module>ydsz-module-system</module>
        </modules>

        <!--properties-->
        <properties>
          <maven.compiler.source>8</maven.compiler.source>
          <maven.compiler.target>8</maven.compiler.target>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>

        <dependencyManagement>
          <dependencies>
            <!--=======================================core工具包:=============================================-->
            <!-- Core模块:相当于公共包-->
            <dependency>
              <groupId>cn.jggroup</groupId>
              <artifactId>ydsz-module-common</artifactId>
              <version>1.0.0</version>
            </dependency>

            <!--=======================================springboot系列1=========================================-->
            <!--
            spring-boot-starter 是 Spring Boot 的核心依赖包,包含以下模块:
            1. Spring Framework 的基础模块(如 spring-beans、spring-context)。
            2. 日志功能(默认使用 SLF4J 和 Logback)。
            3. 提供 Spring Boot 应用运行所需的最小依赖集合。
            -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Spring Boot Web: 提供 Web 应用开发的核心依赖,包括 MVC 和嵌入式服务器 -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-web</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Spring Boot Test: 包含测试工具和框架,如 JUnit、Mockito,默认包括 slf4j -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-test</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Spring Boot Redis: 提供 Redis 数据访问支持 -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-data-redis</artifactId>
              <version>2.6.6</version>
            </dependency>

            <!--=======================================springboot系列2=========================================-->
            <!-- Spring Boot WebSocket: 支持 WebSocket 通信 -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-websocket</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Spring Boot Mail: 提供邮件发送支持 -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-mail</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Spring Boot AOP: 支持面向切面编程(Aspect Oriented Programming) -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-aop</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Spring Boot Validation: 支持数据校验(如 @Valid 和 @Validated 注解) -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-validation</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Spring Boot Freemarker: 提供 FreeMarker 模板引擎支持 -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-freemarker</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Spring Boot Actuator: 提供应用监控和指标采集 -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-actuator</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Micrometer Prometheus: 提供 Prometheus 的指标采集支持 -->
            <dependency>
              <groupId>io.micrometer</groupId>
              <artifactId>micrometer-registry-prometheus</artifactId>
              <version>1.8.4</version>
            </dependency>
            <!-- Spring Boot Quartz: 提供定时任务管理支持 -->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-quartz</artifactId>
              <version>2.6.6</version>
            </dependency>
            <!-- Knife4j: 增强版 Swagger 文档生成工具,提供更友好的 API 文档界面 -->
            <dependency>
              <groupId>com.github.xiaoymin</groupId>
              <artifactId>knife4j-spring-boot-starter</artifactId>
              <version>3.0.3</version>
            </dependency>
            <!-- Spring Boot Configuration: 支持配置属性提示-->
            <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-configuration-processor</artifactId>
              <version>2.6.6</version>
              <optional>true</optional>
            </dependency>

            <!--=======================================开源服务utils:基础工具类==================================-->
            <!-- commons-lang: 提供对 Java 基础类库(如 String、Number)的早期增强工具类 -->
            <dependency>
              <groupId>commons-lang</groupId>
              <artifactId>commons-lang</artifactId>
              <version>2.6</version>
            </dependency>
            <!-- commons-lang3: 提供对 Java 基础类库(如 String、Object)的增强工具类,是 commons-lang 的升级版 -->
            <dependency>
              <groupId>org.apache.commons</groupId>
              <artifactId>commons-lang3</artifactId>
              <version>3.10</version>
            </dependency>
            <!-- commons-io: 提供文件、流、路径等 IO 操作的工具类 -->
            <dependency>
              <groupId>commons-io</groupId>
              <artifactId>commons-io</artifactId>
              <version>2.15.1</version>
            </dependency>
            <!-- commons-text: 提供字符串处理相关的高级工具类 -->
            <dependency>
              <groupId>org.apache.commons</groupId>
              <artifactId>commons-text</artifactId>
              <version>1.11.0</version>
            </dependency>
            <!-- commons-pool2: 提供对象池管理功能的工具类库,用于资源复用 -->
            <dependency>
              <groupId>org.apache.commons</groupId>
              <artifactId>commons-pool2</artifactId>
              <version>2.11.1</version>
            </dependency>
            <!-- commons-codec: 提供常见的编码解码功能,例如 Base64 编码/解码、URL 编码/解码、哈希算法等 -->
            <dependency>
              <groupId>commons-codec</groupId>
              <artifactId>commons-codec</artifactId>
              <version>1.14</version>
            </dependency>
            <!-- Hutool: 一个国产的 Java 工具类库,集成了常用工具方法(如日期、字符串、文件操作等) -->
            <dependency>
              <groupId>cn.hutool</groupId>
              <artifactId>hutool-all</artifactId>
              <version>5.5.4</version>
            </dependency>
            <!-- Guava: Google 提供的核心工具库,包含集合、缓存、并发、字符串操作等功能 -->
            <dependency>
              <groupId>com.google.guava</groupId>
              <artifactId>guava</artifactId>
              <version>29.0-jre</version>
            </dependency>

            <!--=======================================开源服务utils:处理各种类型================================-->
            <!-- OkHttp: 一个轻量级、高性能的 HTTP 客户端库,用于发送 HTTP 请求 -->
            <dependency>
              <groupId>com.squareup.okhttp3</groupId>
              <artifactId>okhttp</artifactId>
              <version>4.4.1</version>
            </dependency>
            <!-- dom4j: 一个用于解析和操作 XML 文档的 Java 库,支持 XPath 查询 -->
            <dependency>
              <groupId>dom4j</groupId>
              <artifactId>dom4j</artifactId>
              <version>1.6.1</version>
            </dependency>
            <!-- Lombok: 提供简化 Java 代码的注解,如自动生成 Getter/Setter、构造方法等 -->
            <dependency>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>1.18.22</version>
            </dependency>
            <!-- FastJSON: 一个高性能的 JSON 解析和序列化工具,支持 JSON 转对象和对象转 JSON -->
            <dependency>
              <groupId>com.alibaba</groupId>
              <artifactId>fastjson</artifactId>
              <version>1.2.83</version>
            </dependency>
            <!-- Pegdown: 一个轻量级的 Markdown 解析器,用于将 Markdown 转换为 HTML -->
            <dependency>
              <groupId>org.pegdown</groupId>
              <artifactId>pegdown</artifactId>
              <version>1.6.0</version>
            </dependency>
            <!-- Pinyin4j: 一个将汉字转换为拼音的工具库,用于处理中文拼音相关功能 -->
            <dependency>
              <groupId>com.belerweb</groupId>
              <artifactId>pinyin4j</artifactId>
              <version>2.5.0</version>
            </dependency>
            <!-- commons-beanutils: 提供对 Java Bean 属性的操作工具类(如拷贝、转换等功能) -->
            <dependency>
              <groupId>commons-beanutils</groupId>
              <artifactId>commons-beanutils</artifactId>
              <version>1.9.4</version>
            </dependency>
            <!-- gson: Google 提供的一个 Java 库,用于将 Java 对象转换为 JSON 字符串,反之亦然 -->
            <dependency>
              <groupId>com.google.code.gson</groupId>
              <artifactId>gson</artifactId>
              <version>2.8.6</version>
            </dependency>
            <!-- json-lib: 用于在 Java 中处理 JSON 数据的库,支持将 Java 对象与 JSON 格式互转,支持多种 JSON 格式 -->
            <dependency>
              <groupId>net.sf.json-lib</groupId>
              <artifactId>json-lib</artifactId>
              <version>2.4</version>
              <classifier>jdk15</classifier>
            </dependency>
            <!-- jdom: 一个用于处理 XML 的 Java 库,提供了比传统的 DOM 更简洁、更易用的 API,支持创建、解析和修改 XML 文档 -->
            <dependency>
              <groupId>org.jdom</groupId>
              <artifactId>jdom</artifactId>
              <version>1.1</version>
            </dependency>
            <!-- 二维码: ZXing (Zebra Crossing) 是一个开源的二维码生成与解码库,用于生成二维码或扫描二维码 -->
            <dependency>
              <groupId>com.google.zxing</groupId>
              <artifactId>javase</artifactId>
              <version>3.3.1</version>
            </dependency>
            <!-- 阿里SDK: 阿里巴巴提供的 Java SDK,用于集成支付宝的支付功能,包括支付请求、退款等操作 -->
            <dependency>
              <groupId>com.alipay.sdk</groupId>
              <artifactId>alipay-sdk-java</artifactId>
              <version>3.1.0</version>
            </dependency>

            <!--=======================================开源服务:连接sql========================================-->
            <!--mybatis-plus-->
            <dependency>
              <groupId>com.baomidou</groupId>
              <artifactId>mybatis-plus-boot-starter</artifactId>
              <version>3.5.1</version>
            </dependency>
            <!--druid-->
            <dependency>
              <groupId>com.alibaba</groupId>
              <artifactId>druid-spring-boot-starter</artifactId>
              <version>1.2.18</version>
            </dependency>
            <!--dynamic-->
            <dependency>
              <groupId>com.baomidou</groupId>
              <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
              <version>3.2.0</version>
            </dependency>
            <!--mysql-->
            <dependency>
              <groupId>mysql</groupId>
              <artifactId>mysql-connector-java</artifactId>
              <version>8.0.27</version>
              <scope>runtime</scope>
            </dependency>
            <!--sqlserver-->
            <dependency>
              <groupId>com.microsoft.sqlserver</groupId>
              <artifactId>sqljdbc4</artifactId>
              <version>4.0</version>
              <scope>runtime</scope>
            </dependency>
            <!--oracle-->
            <dependency>
              <groupId>com.oracle</groupId>
              <artifactId>ojdbc6</artifactId>
              <version>11.2.0.3</version>
              <scope>runtime</scope>
            </dependency>
            <!--postgresql-->
            <dependency>
              <groupId>org.postgresql</groupId>
              <artifactId>postgresql</artifactId>
              <version>42.2.25</version>
              <scope>runtime</scope>
            </dependency>

            <!--=======================================开源服务:上传文件========================================-->
            <!-- commons-fileupload: 用于处理文件上传功能 -->
            <dependency>
              <groupId>commons-fileupload</groupId>
              <artifactId>commons-fileupload</artifactId>
              <version>1.4</version>
              <exclusions>
                <exclusion>
                  <artifactId>commons-io</artifactId>
                  <groupId>commons-io</groupId>
                </exclusion>
              </exclusions>
            </dependency>
            <!-- 七牛云 SDK: 用于调用七牛云存储服务进行文件上传和管理 -->
            <dependency>
              <groupId>com.qiniu</groupId>
              <artifactId>qiniu-java-sdk</artifactId>
              <version>7.4.0</version>
              <exclusions>
                <exclusion>
                  <artifactId>okhttp</artifactId>
                  <groupId>com.squareup.okhttp3</groupId>
                </exclusion>
              </exclusions>
            </dependency>
            <!-- MinIO SDK: 用于调用 MinIO 对象存储服务,进行文件上传与管理 -->
            <dependency>
              <groupId>io.minio</groupId>
              <artifactId>minio</artifactId>
              <version>8.0.3</version>
              <exclusions>
                <exclusion>
                  <artifactId>okio</artifactId>
                  <groupId>com.squareup.okio</groupId>
                </exclusion>
                <exclusion>
                  <artifactId>okhttp</artifactId>
                  <groupId>com.squareup.okhttp3</groupId>
                </exclusion>
              </exclusions>
            </dependency>
            <!-- 阿里云短信: 用于调用阿里云短信服务 API,发送短信 -->
            <dependency>
              <groupId>com.aliyun</groupId>
              <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
              <version>2.1.0</version>
            </dependency>
            <!-- 阿里云 OSS: 用于调用阿里云对象存储服务(OSS)API,进行文件存储与管理 -->
            <dependency>
              <groupId>com.aliyun.oss</groupId>
              <artifactId>aliyun-sdk-oss</artifactId>
              <version>3.11.2</version>
            </dependency>

            <!--=======================================开源服务:rbac权限=======================================-->
            <!-- JWT: 用于生成和验证 JSON Web Token 的工具 -->
            <dependency>
              <groupId>com.auth0</groupId>
              <artifactId>java-jwt</artifactId>
              <version>3.11.0</version>
            </dependency>
            <!-- Shiro: Apache Shiro 的 Spring Boot 集成,提供强大的身份认证与权限管理功能 -->
            <dependency>
              <groupId>org.apache.shiro</groupId>
              <artifactId>shiro-spring-boot-starter</artifactId>
              <version>1.12.0</version>
            </dependency>
            <!-- Shiro-Redis: 将 Apache Shiro 会话存储到 Redis 中的扩展 -->
            <dependency>
              <groupId>org.crazycake</groupId>
              <artifactId>shiro-redis</artifactId>
              <version>3.1.0</version>
              <exclusions>
                <exclusion>
                  <groupId>org.apache.shiro</groupId>
                  <artifactId>shiro-core</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
            <!-- JustAuth: 一个支持多平台的第三方登录工具 -->
            <dependency>
              <groupId>com.xkcoding.justauth</groupId>
              <artifactId>justauth-spring-boot-starter</artifactId>
              <version>1.3.4</version>
              <exclusions>
                <exclusion>
                  <artifactId>hutool-core</artifactId>
                  <groupId>cn.hutool</groupId>
                </exclusion>
                <exclusion>
                  <artifactId>fastjson</artifactId>
                  <groupId>com.alibaba</groupId>
                </exclusion>
              </exclusions>
            </dependency>
            <!-- Jackson Kotlin Module: 解决 OkHttp 引入 Kotlin 导致的启动警告问题 -->
            <dependency>
              <groupId>com.fasterxml.jackson.module</groupId>
              <artifactId>jackson-module-kotlin</artifactId>
              <version>2.13.2</version>
            </dependency>

            <!--=======================================非开源服务:ydsz项目======================================-->
            <!--codegenerate(非开源,且加密)-->
            <dependency>
              <groupId>org.jeecgframework.boot</groupId>
              <artifactId>codegenerate</artifactId>
              <version>1.4.3</version>
            </dependency>
            <!--jimureport(非开源,且加密)-->
            <dependency>
              <groupId>org.jeecgframework.jimureport</groupId>
              <artifactId>jimureport-spring-boot-starter</artifactId>
              <version>1.6.5</version>
              <exclusions>
                <exclusion>
                  <artifactId>autopoi-web</artifactId>
                  <groupId>org.jeecgframework</groupId>
                </exclusion>
              </exclusions>
            </dependency>
          </dependencies>
        </dependencyManagement>

2.3 point

01.Maven核心原理
    a.坐标体系
        a.坐标冲突案例
            <!-- 错误:同一artifactId声明两次 -->
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.5.13</version>
            </dependency>
            <dependency>
                <groupId>com.aliyun</groupId>
                <artifactId>httpclient</artifactId> <!-- 同名不同组! -->
                <version>1.0.0</version>
            </dependency>
        b.现象
            NoSuchMethodError 随机出现,因类加载器加载了错误Jar
    b.依赖传递
        a.依赖解析流程
            略
        b.传递规则
            最短路径优先:A→B→C→D(1.0) vs A→E→D(2.0) → 选择D(2.0)
            第一声明优先:先声明的依赖版本胜出
    c.生命周期
        a.关键特性
            执行mvn install会自动触发从validate到install的所有阶段
        b.插件绑定
            每个阶段由具体插件实现(如compile阶段绑定maven-compiler-plugin)
    d.仓库体系
        a.私服核心价值
            缓存公共依赖 → 加速构建
            托管内部二方包 → 安全隔离
            控制依赖审批流 → 合规管控

02.常见坑点1
    a.坑1:循环依赖
        a.案例
            订单模块order依赖支付模块payment,而payment又反向依赖order
        b.报错
            [ERROR] A cycle was detected in the dependency graph
        c.解决方案
            a.抽取公共层
                order-api ← order-core & payment-core
            b.依赖倒置
                java 体验AI代码助手 代码解读复制代码// 在payment模块定义接口
                public interface PaymentService {
                    void pay(Order order); // 参数用Order接口
                }
                // order模块实现接口
                public class OrderServiceImpl implements PaymentService {
                    // 实现逻辑
                }
    b.坑2:依赖冲突
        a.典型场景:引入A、B两个组件
            A依赖C:1.0
            B依赖C:2.0 → Maven按规则选择其一,导致另一方兼容性问题
        b.定位工具
            mvn dependency:tree -Dverbose
            -------------------------------------------------------------------------------------------------
            com.example:demo:jar:1.0
            [INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
            [INFO] |  - commons-logging:commons-logging:jar:1.2:compile
            [INFO] - com.aliyun:oss-sdk:jar:2.0.0:compile
            [INFO]    - commons-logging:commons-logging:jar:1.1.3:compile (版本冲突)
        c.强制统一版本
            <dependencyManagement>
                <dependencies>
                    <dependency>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                        <version>1.2</version> <!-- 强制指定 -->
                    </dependency>
                </dependencies>
            </dependencyManagement>
    c.坑3:快照依赖
        a.错误配置
            <dependency>
                <groupId>com.internal</groupId>
                <artifactId>core-utils</artifactId>
                <version>1.0-SNAPSHOT</version> <!-- 快照版本! -->
            </dependency>
        b.风险
            相同版本号可能对应不同内容,导致生产环境行为不一致
        c.规范
            生产发布:必须使用RELEASE(如1.0.0)
            内部联调:使用SNAPSHOT但需配合持续集成
    d.坑4:依赖范围错误
        a.误用案例:
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>4.0.1</version>
                <scope>compile</scope> <!-- 应为provided -->
            </dependency>
        b.后果
            Tomcat中运行时抛出java.lang.ClassCastException(容器已提供该包)
        c.范围对照表
            Scope编译测试运行典型用例
            compile✓✓✓Spring Core
            provided✓✓✗Servlet API
            runtime✗✓✓JDBC驱动
            test✗✓✗JUnit
    e.坑5:资源过滤缺失
        a.问题现象
            src/main/resources下的application.yml未替换变量:
            db:
              url: ${DB_URL}  # 未被替换!
        b.修复方案
            <build>
              <resources>
                <resource>
                  <directory>src/main/resources</directory>
                  <filtering>true</filtering> <!-- 开启过滤 -->
                </resource>
              </resources>
            </build>
        c.同时需在pom.xml中定义变量
            <properties>
              <DB_URL>jdbc:mysql://localhost:3306/test</DB_URL>
            </properties>

03.常见坑点2
    a.坑1:插件版本过时
        a.经典案例:JDK 17+项目使用旧版编译器插件
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.1</version> <!-- 不支持JDK17 -->
            </plugin>
        b.报错
            Fatal error compiling: invalid target release: 17
        c.升级方案
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.11.0</version>
              <configuration>
                <source>17</source>
                <target>17</target>
              </configuration>
            </plugin>
    b.坑2:多模块构建顺序
        a.错误结构:
            parent-pom
              ├── user-service
              ├── payment-service  # 依赖order-service
              └── order-service
        b.构建命令
            mvn clean install → 可能先构建payment-service失败
        c.正确配置
           <!-- parent-pom中声明构建顺序 -->
            <modules>
              <module>order-service</module>
              <module>payment-service</module> <!-- 确保顺序 -->
              <module>user-service</module>
            </modules>
    c.坑3:本地仓库污染
        a.故障场景
            mvn clean install成功,同事却失败
        b.根源
            本地缓存了损坏的lastUpdated文件
        c.清理方案
            # 清除所有无效文件
            find ~/.m2 -name "*.lastUpdated" -exec rm {} ;
            # 强制重新下载
            mvn clean install -U
    d.坑4:私服配置错误
        a.慢如蜗牛的原因
            中央仓库直连(国内访问慢)
            镜像配置错误
        b.优化配置(settings.xml)
            <mirrors>
              <mirror>
                <id>aliyun</id>
                <name>Aliyun Maven Mirror</name>
                <url>https://maven.aliyun.com/repository/public</url>
                <mirrorOf>central</mirrorOf> <!-- 覆盖中央仓库 -->
              </mirror>
            </mirrors>
    e.坑5:IDE与命令行行为不一致
        a.典型分歧
            Eclipse能编译,命令行失败 → .project与pom.xml不一致
            IDEA运行正常,mvn test失败 → 测试资源未配置
        b.统一方案
            <!-- 显式配置测试资源 -->
            <testResources>
              <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
              </testResource>
            </testResources>

2.4 shade

01.ydsz-boot-starter_1.1.0
    a.核心模块 - ydsz-boot-starter
        合并原有的三个模块:
        ydsz-boot-base-core
        ydsz-boot-starter
        ydsz-module-system
        打包成一个完整的 jar 包
        包含所有核心功能、系统功能和启动器配置
    b.业务模块结构
        ydsz-module-biz (作为根项目)
         ├── pom.xml (父pom)
         │   - 引入 ydsz-boot-starter 依赖
         │   - 管理所有公共依赖版本
         │   - 配置构建等公共设置
         ├── ydsz-module-demo
         │   └── pom.xml (只继承父pom,不直接依赖starter)
         ├── ydsz-module-task
         │   └── pom.xml (只继承父pom,不直接依赖starter)
         └── 其他业务模块
    c.说明
        父模块 ydsz-module-biz 引入 ydsz-boot-starter,包含所有核心功能
        子模块(demo、task等)只继承父模块,通过父模块间接使用 starter 的功能
        子模块可以专注于自己的业务逻辑,不需要关心核心依赖
    d.具体内容
        root/
        ├── pom.xml (已经设计完成)
        ├── ydsz-module-demo/
        │   ├── pom.xml
        │   └── src/
        │       ├── main/
        │       │   ├── java/
        │       │   │   └── cn/
        │       │   │       └── jggroup/
        │       │   │           └── demo/
        │       │   │               ├── DemoApplication.java
        │       │   │               ├── controller/
        │       │   │               ├── service/
        │       │   │               └── mapper/
        │       │   └── resources/
        │       │       ├── application.yml
        │       │       ├── application-dev.yml
        │       │       └── application-prod.yml
        └── ydsz-module-task/
            ├── pom.xml
            └── src/
                ├── main/
                │   ├── java/
                │   │   └── cn/
                │   │       └── jggroup/
                │   │           └── task/
                │   │               ├── TaskApplication.java
                │   │               ├── controller/
                │   │               ├── service/
                │   │               └── mapper/
                │   └── resources/
                │       ├── application.yml
                │       ├── application-dev.yml
                │       └── application-prod.yml
    e.插件打包
        a.说明
            在 Maven 项目中,如果使用 POM 父子模块结构,
            打包的结果可能是多个 JAR 包,也可能是一个 JAR 包,这取决于模块的具体配置和项目的需求。
        b.父子模块结构的基础概念
            父模块:通常是一个聚合模块(packaging 类型为 pom),本身不包含代码,只是用于管理和聚合子模块。
            子模块:实际包含代码(通常 packaging 类型为 jar 或其他),可以独立打包。
        c.打包结果取决于子模块
            每个子模块根据其 packaging 类型,会单独打包成相应的构件(例如 JAR、WAR、或其他)。
            如果你有多个子模块,那么运行 mvn install 或 mvn package 时,
            每个子模块都会生成一个对应的 JAR 包(或者其他指定类型的包)。
        d.假设有如下目录结构
            parent-project (pom.xml, packaging = pom)
            │
            ├── module-a (pom.xml, packaging = jar)
            │
            ├── module-b (pom.xml, packaging = jar)
            │
            └── module-c (pom.xml, packaging = war)
            -------------------------------------------------------------------------------------------------
            执行 mvn package,结果如下:
            module-a:生成 module-a-1.0.jar。
            module-b:生成 module-b-1.0.jar。
            module-c:生成 module-c-1.0.war。
            而父模块 parent-project 本身不会生成任何打包文件,因为它的 packaging 类型为 pom。
        e.单JAR包的情况
            如果需要将所有子模块打包为一个单独的 JAR,可以通过以下方式实现:
            使用 maven-assembly-plugin 将所有子模块的构件和依赖合并为一个可执行 JAR 包。
            使用 maven-shade-plugin 合并依赖,生成一个带依赖的 JAR。
        f.总结
            默认情况下,父子模块的项目会生成多个 JAR 包(或其他类型的包),
            因为每个子模块都是独立构建的。如果需要一个单独的 JAR 包,可以通过配置 Assembly 或 Shade 插件来实现。
    f.提问
        a.提问
            common模块@pom.xml , @pom.xml 父模块, @pom.xml 系统模块(依赖common模块)。 @YdszSystemApplication.java 启动类在 系统模块(依赖common模块)。 @application-dev.yml   @application-prod.yml  配置文件在系统模块(依赖common模块)。与启动类同一个层级。
            现在,我想制作一个jar包,直接依赖找个jar包,然后继承 @pom.xml 父模块,然后就可以启动项目。
            我查到可以使用如下插件,打包我想要的内容。
            使用 maven-assembly-plugin 将所有子模块的构件和依赖合并为一个可执行 JAR 包。
            使用 maven-shade-plugin 合并依赖,生成一个带依赖的 JAR。
            先不要生成代码,先告诉我你的思路
        b.提问2
            我现在希望打包成2种方案,
            一种是,可以直接被依赖,同时可以直接启动的jar包
            一种是,可以直接被依赖,但是需要引入这个jar包,然后需要设置启动类+配置文件,才可以被启动的jar包,主要用于集成其他子模块
            先不要生成代码,先告诉我你的思路
        c.提问3
            @assembly.xml 使用 common模块、system模块的resources资源
            @pom.xml 直接指定 system的YdszSystemApplication启动类,配置也使用system的yml配置。
            @ydsz-boot-starter 这个工程,只用executable打包工程。不做任何配置和启动类引入。
            我这个思路是正确的吗?先不要生成代码,先理解以前你修改的逻辑
    g.方案
        a.方案1:assembly_全量集成包
            a.特点
                包含所有依赖
                包含配置文件
                包含启动类
                可以直接运行
                也可以被其他项目依赖
            b.打包内容
                common模块全部内容
                系统模块的核心功能
                所有必要的依赖
                配置文件
                启动类
            c.实现方式
                使用maven-assembly-plugin
                配置可执行jar
                包含所有资源文件
                设置Main Class
            d.使用场景
                快速部署
                直接运行
                不需要太多定制化
            e.会打包出3个文件:
                ydsz-boot-starter-1.0.0.jar - 原始jar包,只包含代码
                ydsz-boot-starter-1.0.0-sources.jar - 源码包,包含源代码
                ydsz-boot-starter-1.0.0-executable.jar - 可执行的完整jar包,包含:所有依赖、配置文件、启动类、完整的运行环境
                ---------------------------------------------------------------------------------------------
                使用场景:
                想直接运行时,使用executable.jar
                想作为依赖引入时,使用普通的jar
                需要查看源码时,使用sources.jar
        b.方案2:shade_核心依赖包
            a.特点
                只包含核心功能
                不包含启动类
                不包含配置文件
                需要使用方自己提供启动类和配置
                更灵活,更适合二次开发
            b.打包内容
                common模块的核心功能
                系统模块的核心功能
                必要的依赖
                不包含启动类和配置文件
            c.实现方式
                使用maven-shade-plugin
                排除启动类和配置文件
                只打包核心类和依赖
            d.使用场景
                需要深度定制
                需要整合到其他项目
                需要自定义配置和启动方式
            f.会打包出2个文件:
                ydsz-boot-core-1.0.0.jar - 核心功能jar包,包含:核心功能代码、必要的依赖、不包含启动类和配置文件
                ydsz-boot-core-1.0.0-sources.jar - 源码包
                ---------------------------------------------------------------------------------------------
                使用场景:
                作为依赖引入其他项目时使用core.jar
                需要查看源码时使用sources.jar
                使用方需要自己提供启动类和配置文件
        c.方案3:assembly+shade
            a.说明
                maven-shade-plugin 和 maven-assembly-plugin 可以一起使用,但需要注意它们的执行顺序和配置
            b.两个插件的不同作用:
                maven-shade-plugin: 主要用于处理依赖冲突,可以重命名包名(重定位),合并相同的类文件
                maven-assembly-plugin: 主要用于定制化打包,可以控制打包的内容和结构
            c.组合使用的配置方式
                <build>
                    <plugins>
                        <!-- 先使用shade插件处理依赖 -->
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-shade-plugin</artifactId>
                            <version>3.2.4</version>
                            <executions>
                                <execution>
                                    <phase>package</phase>
                                    <goals>
                                        <goal>shade</goal>
                                    </goals>
                                    <configuration>
                                        <transformers>
                                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                                <mainClass>cn.jggroup.starter.YdszBootStarterApplication</mainClass>
                                            </transformer>
                                            <!-- Spring配置文件合并 -->
                                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                                <resource>META-INF/spring.handlers</resource>
                                            </transformer>
                                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                                <resource>META-INF/spring.schemas</resource>
                                            </transformer>
                                        </transformers>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>

                        <!-- 再使用assembly插件进行最终打包 -->
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-assembly-plugin</artifactId>
                            <version>3.3.0</version>
                            <configuration>
                                <descriptors>
                                    <descriptor>src/main/assembly/assembly.xml</descriptor>
                                </descriptors>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>make-assembly</id>
                                    <phase>package</phase>
                                    <goals>
                                        <goal>single</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </build>
            d.执行顺序:
                shade插件先执行,处理和合并依赖
                assembly插件后执行,基于shade处理后的结果进行最终打包
            e.最终输出
                original-ydsz-boot-starter-1.0.0.jar - 原始jar
                ydsz-boot-starter-1.0.0.jar - shade处理后的jar
                ydsz-boot-starter-1.0.0-executable.jar - assembly最终打包的可执行jar

02.方案1:assembly_全量集成包
    a.打包
        a.首先确保在项目根目录,需要按顺序打包
            # 切换到项目根目录
            cd D:\software_yare\ydsz-boot-starter\ydsz-boot-starter_1.1.0
            # 安装父模块,这里的-N参数表示不递归构建子模块。
            mvn clean install -N -Dmaven.test.skip=true
        b.然后安装common模块
            # 切换到common模块目录
            cd ydsz-module-common
            # 安装common模块
            mvn clean install -Dmaven.test.skip=true
        c.接着安装system模块
            # 切换到system模块目录
            cd ../ydsz-module-system
            # 安装system模块
            mvn clean install -Dmaven.test.skip=true
        d.最后打包starter模块
            # 切换到starter模块目录
            cd ../ydsz-boot-starter
            # 打包starter模块
            mvn clean package -Dmaven.test.skip=true
    b.打包后
        a.在ydsz-boot-starter/target目录下会生成以下文件:
            ydsz-boot-starter-1.0.0.jar - 普通jar包(可以被其他项目依赖)
            ydsz-boot-starter-1.0.0-sources.jar - 源码包
            ydsz-boot-starter-1.0.0-executable.jar - 可执行jar包(可以直接运行)
        b.使用方式
            a.方式1:直接运行
                java -jar ydsz-boot-starter-1.0.0-executable.jar
            b.方式2:作为依赖引入其他项目
              <dependency>
                <groupId>cn.jggroup</groupId>
                <artifactId>ydsz-boot-starter</artifactId>
                <version>1.0.0</version>
              </dependency>
        c.环境切换
              默认使用dev环境
              如果要切换到生产环境,运行时添加参数:
              java -jar ydsz-boot-starter-1.0.0-executable.jar --spring.profiles.active=prod
    c.运行
        a.基本运行方式
            java -jar ydsz-boot-starter-1.0.0-executable.jar
        b.指定环境运行
            # 使用开发环境
            java -jar ydsz-boot-starter-1.0.0-executable.jar --spring.profiles.active=dev
            # 使用生产环境
            java -jar ydsz-boot-starter-1.0.0-executable.jar --spring.profiles.active=prod
        c.指定JVM参数运行
            # 指定内存大小
            java -Xms512m -Xmx1024m -jar ydsz-boot-starter-1.0.0-executable.jar
            # 指定编码
            java -Dfile.encoding=UTF-8 -jar ydsz-boot-starter-1.0.0-executable.jar
        d.组合使用
            # 组合使用多个参数
            java -Xms512m -Xmx1024m -Dfile.encoding=UTF-8 -jar ydsz-boot-starter-1.0.0-executable.jar --spring.profiles.active=prod
        e.后台运行(Linux环境)
            nohup java -jar ydsz-boot-starter-1.0.0-executable.jar --spring.profiles.active=prod > app.log 2>&1 &
    d.思路
        a.关于 assembly.xml
            您想要使用 common 模块和 system 模块的 resources 资源
            当前的 assembly.xml 配置已经通过 dependencySet 设置了 unpack=true,这意味着会解压所有依赖(包括 common 和 system)的内容
            通过 includes **/* 确保了所有文件都会被包含进来
        b.关于 pom.xml:
            您想直接使用 system 模块的 YdszSystemApplication 作为启动类
            想使用 system 模块的 yml 配置
            当前 pom.xml 中的 mainClass 配置是 cn.jggroup.starter.YdszBootStarterApplication,这需要修改
            在 pom.xml 中需要修改 mainClass 为:cn.jggroup.system.YdszSystemApplication
        c.关于 ydsz-boot-starter 工程:
            您希望它只作为一个打包工程
            不需要自己的配置文件
            不需要自己的启动类
            只负责将 common 和 system 模块打包在一起
        d.总结
            在 pom.xml 中需要修改 mainClass 为:cn.jggroup.system.YdszSystemApplication
            可以移除 starter 工程中的任何自定义配置和启动类
            assembly.xml 的配置基本符合要求,它会打包所有依赖的资源
    e.提问1
        a.问题
            Exception in thread "main" java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.
            at org.springframework.util.Assert.notEmpty(Assert.java:470)
        b.提问
            现在运行报错,无法自动装配。可是现在直接cn.jggroup.system.YdszSystemApplication作为启动类。配置也是读取 common模块、system模块的内容。包括yml等内容。
            我直接运行cn.jggroup.system.YdszSystemApplication 是可以运行的。
            但是我现在这个 @ydsz-boot-starter 这个工程,只使用assembly来打包 system模块作为启动类,可运行的,这个整体环境。
        c.错误原因:
            报错显示找不到 META-INF/spring.factories 文件
            这是 Spring Boot 自动配置的核心文件,用于加载自动配置类
            在打包过程中,这些关键的 META-INF 文件可能没有被正确地合并或包含
        d.当前情况:
            system 模块单独运行是正常的,因为它有完整的 Spring Boot 环境
            但通过 starter 工程打包后运行失败,说明打包过程中丢失了一些关键文件
        e.解决思路:
            assembly.xml 需要确保正确合并所有模块的 META-INF 目录
            特别是 Spring Boot 的自动配置文件需要被正确合并
            需要处理好依赖模块中的 META-INF/spring.factories 等配置文件
        f.具体需要注意的点:
            Spring Boot 的自动配置文件位于 META-INF 目录下
            多个依赖的 META-INF 目录需要正确合并,而不是覆盖
            需要确保 spring-boot-autoconfigure 相关的依赖被正确打包
        g.您说得对,这里有几个关键点:
            关于 Spring Boot 环境:
            system 模块是一个完整的 Spring Boot 应用
            它使用注解方式(如 @SpringBootApplication, @ComponentScan 等)来实现自动装配
            不依赖 spring.factories 机制
            -------------------------------------------------------------------------------------------------
            ydsz-boot-starter 的定位:
            它不需要是一个完整的 Spring Boot 应用
            它应该只是一个"包装器",用来打包和启动 system 模块
            不需要自己的 Spring Boot 配置
            -------------------------------------------------------------------------------------------------
            正确的方案应该是:
            ydsz-boot-starter 不需要自己的 Spring Boot 环境
            直接使用 system 模块的 YdszSystemApplication 作为入口
            确保打包时包含 system 模块的所有类和资源
            保持 system 模块的注解配置和组件扫描路径不变
            -------------------------------------------------------------------------------------------------
            修正思路:
            之前我们考虑 spring.factories 是想错了方向
            不需要考虑 spring.factories 的问题
            只需要确保 system 模块的完整性,包括:
            所有的类文件
            配置文件(application.yml 等)
            注解配置
            依赖关系
        h.ydsz-boot-starter 的正确定位应该是:
            纯粹的打包工程
            不需要自己的 Spring Boot 环境
            使用 system 模块的启动类和配置
            assembly 只负责把所有需要的内容打包在一起
        i.pom.xml 的改动:
            移除了 common 模块依赖(因为 system 模块已经依赖它)
            移除了资源文件配置(因为我们不需要自己的资源)
            移除了不必要的插件(source 插件和 resource 插件)
            简化了 spring-boot-maven-plugin 的配置
        j.assembly.xml 的改动:
            移除了所有 fileSets 配置(因为我们不需要自己的资源文件)
            保留了 dependencySet 配置,用于处理 system 模块的依赖
            简化了配置,只保留必要的部分
        k.目录结构:
            不需要自己的配置文件
            不需要自己的 resources 目录
            不需要自己的 META-INF 目录
            -------------------------------------------------------------------------------------------------
            必需的配置:
            parent 配置:必需,提供基础 Spring Boot 配置
            system 模块依赖:必需,提供启动类和业务逻辑
            spring-boot-maven-plugin:必需,用于创建可执行 jar
            maven-assembly-plugin:必需,用于打包
            -------------------------------------------------------------------------------------------------
            不需要的内容:
            任何配置文件(yml, properties 等)
            META-INF 目录
            其他资源文件
            其他插件配置

03.方案2:shade_核心依赖包
    a.目标
        制作一个可依赖的 JAR 包
        包含 system 模块的所有功能(包括 common)
        保留 system 模块的启动类和配置文件
        使用者只需引入这个 JAR 包并继承父 pom 即可
    b.最终 JAR 包结构:
        |- cn.jggroup.system (代码目录)
           |- YdszSystemApplication.java (启动类)
           |- 其他业务代码
        |- cn.jggroup.common (common模块代码)
        |- application-dev.yml
        |- application-prod.yml
        |- META-INF
           |- spring.factories
           |- spring.handlers
           |- spring.schemas
        |- 其他依赖的类库
    c.maven-shade-plugin 配置思路:
        a.主要处理三类内容:
            1. 代码合并:system + common 模块的代码
            2. 配置文件:保留并合并配置文件
            3.Spring Boot 相关:处理 spring.factories 等特殊文件
        b.关键点处理
            a.依赖处理
                common 模块会被直接合并
                第三方依赖会被打包进来
                处理可能的依赖冲突
            b.配置文件处理
                保留 application-dev.yml 和 application-prod.yml
                确保配置文件可以被使用方覆盖
            c.Spring Boot 相关
                保留启动类
                处理好 Spring Boot 的自动配置机制
                确保 Spring 的注解扫描正常工作
        c.当前思路
            a.整体目标:
                将system模块打包成一个可重用的starter
                允许其他项目引入这个starter并自定义配置
                保留独立运行的能力
            b.关键点:
                maven-shade-plugin用于打包,但配置需要正确
                spring.factories用于自动配置
                配置文件需要可覆盖
                主类需要灵活处理
            c.具体步骤
                a. 修改pom.xml
                  - 配置maven-shade-plugin
                  - 处理资源文件
                  - 管理依赖关系
                b. 配置自动装配
                  - 创建spring.factories
                  - 设置自动配置类
                c. 处理主类
                  - 支持作为starter使用
                  - 支持独立运行
                d. 处理配置文件
                  - 排除application*.yml
                  - 允许使用方覆盖
    d.配置
        a.YdszEnvironmentPostProcessor
            package cn.jggroup.system.config;

            import org.springframework.boot.SpringApplication;
            import org.springframework.boot.env.EnvironmentPostProcessor;
            import org.springframework.core.env.ConfigurableEnvironment;
            import org.springframework.core.env.PropertiesPropertySource;
            import org.springframework.core.io.ClassPathResource;
            import org.springframework.core.io.Resource;

            import java.io.IOException;
            import java.util.Properties;

            /**
             * 环境配置后处理器
             * 用于在Spring Boot启动时处理环境配置
             */
            public class YdszEnvironmentPostProcessor implements EnvironmentPostProcessor {

                @Override
                public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
                    // 添加默认配置
                    Properties defaultProps = new Properties();
                    defaultProps.setProperty("spring.main.allow-bean-definition-overriding", "true");
                    defaultProps.setProperty("spring.main.allow-circular-references", "true");

                    // 如果环境中没有设置这些属性,使用默认值
                    if (!environment.containsProperty("server.port")) {
                        defaultProps.setProperty("server.port", "9994");
                    }
                    if (!environment.containsProperty("server.servlet.context-path")) {
                        defaultProps.setProperty("server.servlet.context-path", "/ydsz-boot");
                    }

                    // 添加到环境中,优先级最低,允许被覆盖
                    PropertiesPropertySource propertySource = new PropertiesPropertySource("ydszDefaultProperties", defaultProps);
                    environment.getPropertySources().addLast(propertySource);

                    try {
                        // 尝试加载自定义配置文件
                        Resource resource = new ClassPathResource("ydsz-config.properties");
                        if (resource.exists()) {
                            Properties customProps = new Properties();
                            customProps.load(resource.getInputStream());
                            environment.getPropertySources().addLast(
                                new PropertiesPropertySource("ydszCustomProperties", customProps)
                            );
                        }
                    } catch (IOException e) {
                        // 忽略加载失败的情况
                    }
                }
            }
        b.ydsz-module-system
              <packaging>jar</packaging>
              <name>ydsz-module-system</name>
              <description>System module that can be used as a starter</description>
              -------------------------------------------------------------------------------------------------
              <build>
                <finalName>ydsz-module-system</finalName>
                <plugins>
                  <!-- Compiler Plugin -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                      <source>1.8</source>
                      <target>1.8</target>
                      <encoding>UTF-8</encoding>
                    </configuration>
                  </plugin>

                  <!-- Shade Plugin for creating uber jar -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.2.4</version>
                    <executions>
                      <execution>
                        <phase>package</phase>
                        <goals>
                          <goal>shade</goal>
                        </goals>
                        <configuration>
                          <createDependencyReducedPom>true</createDependencyReducedPom>
                          <minimizeJar>false</minimizeJar>
                          <filters>
                            <filter>
                              <artifact>*:*</artifact>
                              <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                              </excludes>
                            </filter>
                          </filters>
                          <transformers>
                            <!-- Spring配置文件合并 -->
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                              <resource>META-INF/spring.handlers</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                              <resource>META-INF/spring.schemas</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                              <resource>META-INF/spring.factories</resource>
                            </transformer>
                            <!-- 合并 Services -->
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                            <!-- 合并 spring.provides -->
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                              <resource>META-INF/spring.provides</resource>
                            </transformer>
                            <!-- 合并 spring-autoconfigure-metadata.properties -->
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                              <resource>META-INF/spring-autoconfigure-metadata.properties</resource>
                            </transformer>
                          </transformers>
                          <artifactSet>
                            <includes>
                              <include>*:*</include>
                            </includes>
                            <excludes>
                              <exclude>org.springframework.boot:spring-boot-loader</exclude>
                              <exclude>junit:junit</exclude>
                              <exclude>org.mockito:*</exclude>
                              <exclude>org.hamcrest:*</exclude>
                            </excludes>
                          </artifactSet>
                          <relocations>
                            <relocation>
                              <pattern>org.apache.commons</pattern>
                              <shadedPattern>ydsz.shaded.org.apache.commons</shadedPattern>
                            </relocation>
                          </relocations>
                        </configuration>
                      </execution>
                    </executions>
                  </plugin>

                  <!-- Source Plugin -->
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.2.1</version>
                    <executions>
                      <execution>
                        <id>attach-sources</id>
                        <goals>
                          <goal>jar-no-fork</goal>
                        </goals>
                      </execution>
                    </executions>
                  </plugin>
                </plugins>

                <resources>
                  <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                    <excludes>
                      <exclude>application*.yml</exclude>
                      <exclude>application*.properties</exclude>
                    </excludes>
                  </resource>
                  <resource>
                    <directory>src/main/java</directory>
                    <includes>
                      <include>**/*.xml</include>
                      <include>**/*.json</include>
                      <include>**/*.ftl</include>
                    </includes>
                  </resource>
                </resources>
              </build>
              -------------------------------------------------------------------------------------------------
              <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-shade-plugin</artifactId>
               <version>2.4.1</version>
               <executions>
                   <execution>
                   <!--配置goal-shade绑定到phase-package 上 会在 target 文件生成一个以 -shaded.jar 为后缀的 jar 包-->
                       <phase>package</phase>
                       <goals>
                          <goal>shade</goal>
                       </goals>
                       <configuration>
                        <artifactSet>
                          <excludes>
                          <!--配置该工程依赖的部分 Jar 包 include/exclude 掉。-->
                            <exclude>classworlds:classworlds</exclude>
                            <exclude>junit:junit</exclude>
                          </excludes>
                        </artifactSet>
                        <!--配置依赖的某个 Jar 包内部的类或者资源 include/exclude 掉。-->
                         <filters>
                          <filter>
                            <artifact>junit:junit</artifact>
                            <includes>
                              <include>junit/framework/</include>
                              <include>org/junit/</include>
                            </includes>
                            <excludes>
                              <exclude>org/junit/experimental/</exclude>
                              <exclude>org/junit/runners/</exclude>
                            </excludes>
                          </filter>
                         </filters>
                         <!--配置将所有不使用的类全部排除掉,将 jar 最小化-->
                         <minimizeJar>true</minimizeJar>
                         <!--配置 MainClass 创建一个可执行 Jar 包。-->
                          <transformers>
                              <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>org.sonatype.haven.HavenCli</mainClass>
                              </transformer>
                          </transformers>
                          <!-- 配置解决jar或类的多版本冲突 在打包的时候把类重命名-->
                          <relocations>
                              <relocation>
                                <pattern>org.codehaus.plexus.util</pattern>
                                <shadedPattern>org.shaded.plexus.util</shadedPattern>
                                <excludes>
                                  <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
                                  <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
                                </excludes>
                              </relocation>
                        </relocations>
                      </configuration>
                   </execution>
               </executions>
              </plugin>
    e.打包
        a.首先确保在项目根目录,需要按顺序打包
            # 切换到项目根目录
            cd D:\software_yare\ydsz-boot-starter\ydsz-boot-starter_1.1.0
            # 安装父模块,这里的-N参数表示不递归构建子模块。
            mvn clean install -N -Dmaven.test.skip=true
        b.然后安装common模块
            # 切换到common模块目录
            cd ydsz-module-common
            # 安装common模块
            mvn clean install -Dmaven.test.skip=true
        c.接着安装system模块
            # 切换到system模块目录
            cd ../ydsz-module-system
            # 安装system模块
            mvn clean package -Dmaven.test.skip=true
        d.打包结果
            这三个jar包的作用和运行方式如下:
            1. ydsz-module-system.jar
            这是主要的jar包,包含了所有编译后的类文件和依赖
            作为starter使用时,其他项目只需要引入这个jar包
            original-ydsz-module-system.jar
            这是原始的jar包,不包含依赖
            通常不需要使用这个文件
            ydsz-module-system-sources.jar
            这是源码jar包,包含了源代码
            用于IDE查看源码,不用于运行
        e.单独运行
            【由于ydsz-module-system是一个starter,引用它的环境必须是Spring环境,而不是简单maven环境】
            -----------------------------------------------------------------------------------------------------
            下述方式缺少基础的Spirng环境
            # 方式1:使用 --spring.profiles.active 指定配置文件
            java -cp ydsz-module-system.jar cn.jggroup.system.YdszSystemStandaloneApplication --spring.profiles.active=dev
            -------------------------------------------------------------------------------------------------
            # 方式2:同时指定配置文件路径和profile
            java -cp ydsz-module-system.jar cn.jggroup.system.YdszSystemStandaloneApplication --spring.config.location=file:./application-dev.yml --spring.profiles.active=dev
            -------------------------------------------------------------------------------------------------
            # 方式3:添加JVM参数
            java -Dspring.profiles.active=dev -cp ydsz-module-system.jar cn.jggroup.system.YdszSystemStandaloneApplication
            -------------------------------------------------------------------------------------------------
            # 完整命令(包含内存配置等)
            java -Xms512m -Xmx1024m -Dspring.profiles.active=dev -cp ydsz-module-system.jar cn.jggroup.system.YdszSystemStandaloneApplication
        f.使用
            <!-- 在其他项目的pom.xml中添加依赖 -->
            <dependency>
                <groupId>cn.jggroup</groupId>
                <artifactId>ydsz-module-system</artifactId>
                <version>1.0.0</version>
            </dependency>
            -------------------------------------------------------------------------------------------------
            <!-- 本地jar依赖 -->
            <dependency>
              <groupId>cn.jggroup</groupId>
              <artifactId>ydsz-module-system</artifactId>
              <version>1.0.0</version>
              <scope>system</scope>
              <systemPath>${project.basedir}/lib/ydsz-module-system.jar</systemPath>
            </dependency>
            -------------------------------------------------------------------------------------------------
            使用方项目需要:
            创建自己的启动类
            提供自己的配置文件(application.yml)
            可以覆盖默认的Bean配置
            -------------------------------------------------------------------------------------------------
            @SpringBootApplication
            public class YourApplication {
                public static void main(String[] args) {
                    SpringApplication.run(YourApplication.class, args);
                }
            }

04.示例:ydsz-boot-starter-demo
    a.com/example/demo/DemoApplication.java
        @SpringBootApplication
        @ComponentScan(basePackages = {"org.jeecg", "cn.jggroup"})     //必须配置,需要自动装配Bean
        public class DemoApplication {
            public static void main(String[] args) {
                SpringApplication.run(DemoApplication.class, args);
            }
        }
        -----------------------------------------------------------------------------------------------------
        @SpringBootApplication(scanBasePackages = {"cn.jggroup"})
        public class DemoApplication {
            public static void main(String[] args) {
                SpringApplication.run(DemoApplication.class, args);
            }
        }
    b.src/main/resources/application.ym
        省略
    c.pom.xml
        参考ydsz-boot-starter-demo

2.5 deploy

01.SpringBoot打包
    a.Spring Boot打成的jar和普通jar的区别
        a.内嵌服务器:
            Spring Boot:包含内嵌的Web服务器(如Tomcat),直接运行jar即可启动
            普通jar:需外部配置和启动Web服务器
        b.自包含性:
            Spring Boot:打包所有依赖,单一jar文件
            普通jar:依赖需单独提供和管理
        c.启动方式:
            Spring Boot:java -jar myapp.jar
            普通jar:java -cp myapp.jar:lib/* com.example.MainClass
        d.配置管理:
            Spring Boot:使用application.properties或application.yml,支持多环境配置
            普通jar:需自行实现配置管理
    b.运行jar包方式
        a.SpringBoot打包的jar包,内置Tomcat
            1)Main方法启动:这种方式一般在本地测试的时候用的比较多点
            2)java -jar的方式:在Linux环境下,一般是使用这种方式启动的
            3)通过spring-boot-plugin方式
        b.在Docker容器中运行
            略
        c.使用Kubernetes:将Docker镜像部署到Kubernetes集群中
            略

02.SpringBoot部署
    a.在CentOS7上部署Java的.class文件
        1.先编译成.class文件:javac YourClassName.java
        2.运行编译生成的.class文件:java YourClassName
        3.设置 CLASSPATH(可选):export CLASSPATH=.:/path/to/your/classes:/path/to/your/libs/*
        4.nohup java YourClassName &
        5.ps aux | grep java
    b.部署jar包
        kill -9 pid
        kill -s 9 pid
        ---------------------------------------------------------------------------------------------------------
        nohup java -jar $APP_NAME >$LOG_FILE 2>&1 &
        nohup java -jar -Djava.net.preferIPv4Stack=true $APP_NAME --server.port=8181 >$LOG_FILE &
        nohup java -jar -Djava.net.preferIPv4Stack=true -Dfile.encoding=utf-8 $APP_NAME --server.port=8181 >$LOG_FILE &
        nohup java -jar -Djava.net.preferIPv4Stack=true $APP_NAME --spring.config.location=/home/zdh/shanxi/oms/cloud/sxoms-dcloud/application.yml >$LOG_FILE 2>&1 &
        nohup java -jar -Djava.net.preferIPv4Stack=true $APP_NAME >$LOG_FILE 2>&1 &
        而只需要将jar包参数使用绝对路径,使用jps命令时即可显示jar包原名:java -jar /home/www/apps/netty-http-server-1.0-SNAPSHOT.jar
        ---------------------------------------------------------------------------------------------------------
        java -jar /workspace/vilgob2-1.0-SNAPSHOT.jar
        java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -jar /workspace/vilgob2-1.0-SNAPSHOT.jar
        ---------------------------------------------------------------------------------------------------------
        java -jar /workspace/vilgob2-1.0-SNAPSHOT.jar >> /workspace/vilgob2.log 2>&1 &
        java -jar /workspace/vilgob2-1.0-SNAPSHOT.jar --spring.profiles.active=test >> /workspace/vilgob2.log 2>&1 &
        ---------------------------------------------------------------------------------------------------------
        ps -ef | grep vilgob2-1.0-SNAPSHOT.jar | grep -v grep
        sh /workspace/project.sh start
        sh /workspace/project.sh stop
        sh /workspace/project.sh restart
    c.部署jar包,乱码,导致无法启动
        a.查看编码
            uname -r                                                                  --2.6.32.41-Rocky4.2-x86_64
            locale | grep LANG                                                        --查看终端编码
        b.设定cmd的编码为utf-8
            chcp 65001
        c.常见编码
            字符编码      对应字符
            GBK(默认)     936
            美国英语      437
            utf-8         65001
        d.解决1
            方式1:切换终端编码 -> GBK
            方式2:指定代码编码(生效) -> 可以试试utf-8、gbk、gb2312
                  nohup java -jar -Djava.net.preferIPv4Stack=true -Dfile.encoding=utf-8 $APP_NAME --server.port=8181 >$LOG_FILE &
    d.jar包内容更新方式
        a.方式一:jar包指定文件更新替换
            jar tvf M-v-SNAPSHOT.jar | grep log4j.properties                          --查文件位置
            jar xvf M-v-SNAPSHOT.jar log4j.properties                                 --解压
            更新解压后的文件目录内文件                                                  --文件内容更新
            jar uvf M-v-SNAPSHOT.jar log4j.properties                                 --更新jar包文件
        b.方式二:spring boot jar包重新打包
            spring boot jar包更新重新打包:
            jar -cfM0 M-v.jar BOOT-INF/ META-INF/ org/
            jar -cfM0 M-v.jar *

03.IDEA+Docker远程一键部署
    a.介绍
        使用这种方式进行好一系列配置后,每次需要重新部署项目仅需点击绿色小三角(一步)即可自动完成项目部署
        同时还可以非常便捷的查看项目实时运行日志
    b.第1步:进行ssh配置
        由于需要连接服务器进行远程部署,因此必须先进行ssh配置(File->Settings->搜索ssh)。
        为了避免不必要的麻烦,推荐在Authentication type中选择Key pair进行连接,嫌麻烦也可以直接通过Password进行连接,等后续出现连接问题再切换成key pair连接方式。
        使用Key pair进行连接过程比较繁琐,可参考博客:在IDEA中通过密钥认证的方式使用SSH连接远程Linux服务器
    c.第2步:连接Docker守护进程
        需要配置连接Docker守护进程(File->Settings->搜索docker)来操作Docker
    d.第3步:编写Dockerfile文件
        # 基础镜像
        FROM openjdk:17
        # 复制主机jar包至镜像内,复制的目录需放置在 Dockerfile 文件同级目录下
        ADD target/demo-0.0.1-SNAPSHOT.jar app.jar
        # 容器启动执行命令
        ENTRYPOINT ["java","-jar", "/app.jar" , "--spring.profiles.active=prod"]
        # 对外暴露的端口号
        EXPOSE  8080
        -----------------------------------------------------------------------------------------------------
        复制主机jar包至镜像内,复制的目录需放置在 Dockerfile 文件同级目录下
    e.第4步:配置远程部署
        1.前往创建配置
        2.创建配置
        3.根据下述步骤填写之前所进行的一系列配置即可
        4.至此,所有配置都已完成,最后尝试一下本文开始所述”点击绿色小三角(一步)即可自动完成项目部署

04.Jpackage-制作无需预装Java环境的Jar可执行程序
    a.社区
        这玩意要想编译成功比rust都困难
        体积太大了,基本可以顶半个jre了
        java就不要挣扎了,老老实实用新语言
        需要安装graalvm才能运行,并非独立运行
        在编译时需要graalvm,编译完成后就不需要了
        一方面还有大量框架没有适配graalvm,另一方面,graalvm社区版打包的native应用不支持并发的垃圾收集
    b.jar命令
        a.介绍
            Java 的 jar 命令是 Java Archive Tool,它是一个用于创建、查看和管理 jar 文件的命令行工具。
        b.目录结构
            ├── Hello.java
            └── META-INF
                └── MANIFEST.MF
        c.查看文件内容然后编译 Hello.java
            public class Hello{
                public static void main(String[] args) throws InterruptedException{
                    System.out.println("Hello");
                    // 3s 后退出
                    Thread.sleep(3 * 1000);
                }
            }
            // 编译:javac Hello.java
        d.配置 MANIFEST.MF 文件,注意,最后一定要有一个换行,否则可能在 Windows 上运行失败。
            Manifest-Version: 1.0
            Main-Class: Hello

        e.创建 jar 文件
            jar cmf META-INF/MANIFEST.MF hello.jar Hello.class
            其中 c 表示创建新的归档文件,m 指定清单文件,f 指定生成的 jar 文件的名称,最后是要添加到 jar 包中的文件列表。
        f.执行 jar 文件
            java -jar hello.jar
            Hello
        g.查看 jar 文件
            $ jar tf hello.jar
            META-INF/
            META-INF/MANIFEST.MF
            Hello.class
            -------------------------------------------------------------------------------------------------
            其中 t 为 list,列出文件。f 指定 jar 文件。
    c.jpackage命令
        a.介绍
            jpackage 工具从 Java 14 版本开始提供的,可以用来生成可执行程序。
        b.为模块化或非模块化 Java 应用程序生成指定系统平台的可执行程序,而不用预先安装 JRE 环境
            Java 程序必须在 JRE环境才能运行,
            jpackage 其实是把 JRE 和 JAR 文件以及所有必要依赖项一起打包生成指定平台的可执行程序。
            例如 Windows 上的 exe 或 macOS 上的 dmg。每种格式都必须构建在其运行的平台上,没有跨平台支持。
            工具还提供了常见的自定义操作,如应用名,应用图标等
        c.查看 jpackage 帮助
            jpackage --help
            用法:jpackage <options>
            -------------------------------------------------------------------------------------------------
            生成适合主机系统的应用程序包:
                对于模块化应用程序:
                    jpackage -n name -p modulePath -m moduleName/className
                对于非模块化应用程序:
                    jpackage -i inputDir -n name \
                        --main-class className --main-jar myJar.jar
                从预构建的应用程序映像:
                    jpackage -n name --app-image appImageDir
            生成应用程序映像:
                对于模块化应用程序:
                    jpackage --type app-image -n name -p modulePath \
                        -m moduleName/className
                对于非模块化应用程序:
                    jpackage --type app-image -i inputDir -n name \
                        --main-class className --main-jar myJar.jar
                要为 jlink 提供您自己的选项,请单独运行 jlink:
                    jlink --output appRuntimeImage -p modulePath \
                        --add-modules moduleName \
                        --no-header-files [<additional jlink options>...]
                    jpackage --type app-image -n name \
                        -m moduleName/className --runtime-image appRuntimeImage
            生成 Java 运行时程序包:
                jpackage -n name --runtime-image <runtime-image>
            对预定义应用程序映像进行签名:
                jpackage --type app-image --app-image <app-image> \
                    --mac-sign [<additional signing options>...]
                注:此模式下允许的其他选项只有:
                      一组其他 mac 签名选项和 --verbose
        d.jpackage创建可执行文件
            a.创建可执行程序命令格式
                jpackage --input . --name YouAppName --main-jar youfile.jar
                现在让我们使用上面的 hello.jar 来创建一个可执行的JAR文件。hello.jar 直接运行会输出 Hello 字符。
            b.Windows平台
                a.前提
                    对于 Windows,jpackage 需要 WiX 3.0 或更高版本。
                    https://github.com/wixtoolset/wix3/releases/tag/wix314rtm
                b.参数
                    由于 hello.jar 是一个命令行程序,没有 UI界面,
                    因此打包时使用 --win-console 参数配置以命令行方式启动。
                    -----------------------------------------------------------------------------------------
                    常见的 Windows 下 jpackage 参数还有:
                    --type : 指定打包后的格式,如 msi、exe,默认 exe。
                    --win-console:使用控制台窗口启动我们的应用程序
                    --win-shortcut : 在 Windows 开始菜单中创建快捷方式文件
                    --win-dir-chooser:让最终用户指定自定义目录来安装可执行文件
                c.打包成exe程序
                    jpackage --input . --name helloApp1 --win-console --win-shortcut --main-jar hello.jar
                    -----------------------------------------------------------------------------------------
                    打包后可以得到 helloApp1-1.0.exe 文件
                    PS C:\Users\Administrator\Desktop\test> jpackage --input . --name helloApp --win-console --win-shortcut --main-jar hello.jar
                    PS C:\Users\Administrator\Desktop\test> ls
                    Mode                 LastWriteTime         Length Name
                    ----                 -------------         ------ ----
                    -a----          2024/3/7     22:14            526 Hello.class
                    -a----          2024/3/7     22:14            802 hello.jar
                    -a----          2024/3/7     22:13            208 Hello.java
                    -a----          2024/3/7     22:17      110145536 helloApp1-1.0.exe
                    -a----          2024/3/7     21:58             42 MANIFEST.MF
                    -----------------------------------------------------------------------------------------
                    直接双击运行安装
                    安装完成后,桌面上会出现图标,双击可以运行并输出 Hello 字符串
            c.Mac平台
                a.操作
                    jpackage --input . --name hello --main-jar hello.jar
                    -----------------------------------------------------------------------------------------
                    生成 hello-1.0.dmg 文件,双击弹出安装界面。
                b.查看
                    因为测试程序 hello.jar 是一个输出 Hello 字符串的命令行程序,并没有 UI,因此测试从命令行启动查看输出。
                    ➜  ~ /Applications/hello.app/Contents/MacOS/hello
                    Hello
            d.Linux平台
                a.操作
                    jpackage --input . --name hello --main-jar hello.jar
                b.所在Linux系统为 Ubuntu22 ,所以生成安装包 hello_1.0_amd64.deb
                    $ ls -l -h
                    total 37M
                    -rw-r--r-- 1 root root  37M Mar  7 16:50 hello_1.0_amd64.deb
                    -rw-r--r-- 1 root root  401 Mar  6 11:42 Hello.class
                    -rw-r--r-- 1 root root 1.1K Mar  7 16:42 hello.jar
                    -rw-r--r-- 1 root root   96 Mar  6 11:41 Hello.java
                    -rw-r--r-- 1 root root   41 Mar  6 11:42 MANIFEST.MF
                c.安装 hello_1.0_amd64.deb
                    $ apt install hello_1.0_amd64.deb
                d.安装后命令位于 /opt 目录下,运行测试
                    $ /opt/hello/bin/hello
                    Hello

05.exe4j-集成Java应用程序到Windows操作环境的java可执行文件生成工具
    a.依赖
        <build>
          <plugins>
            <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>2.3.2</version>
              <configuration>
                <source>1.8</source>
                <target>1.8</target>
              </configuration>
            </plugin>
            <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <configuration>
                <descriptorRefs>
                  <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                  <manifest>
                    <mainClass>com.xzhk.demo.WordToExcelConverter</mainClass>
                  </manifest>
                </archive>
              </configuration>
              <executions>
                <execution>
                  <id>make-assembly</id>
                  <phase>package</phase>
                  <goals>
                    <goal>single</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </build>
    b.命令
        mvn clean install package
        打包结果:
        word2excel-0.0.1-SNAPSHOT-jar-with-dependencies.jar
    c.官网下载链接地址
        https://www.ej-technologies.com/download/exe4j/files
    d.License Key(输入任意一个可破解)
        A-XVK258563F-1p4lv7mg7sav
        A-XVK209982F-1y0i3h4ywx2h1
        A-XVK267351F-dpurrhnyarva
        A-XVK204432F-1kkoilo1jy2h3r
        A-XVK246130F-1l7msieqiwqnq
        A-XVK249554F-pllh351kcke50
    e.使用exe4j将jar打包成exe文件
        Project Type中,勾选第二个“JAR IN EXE” mode,点击Next
        Application info 中,第一个输入框中输入你的应用名称,第二个选择你生成的目录地址
        Executable info中,可以选择应用图标和应用名称
        勾选64位操作系统中运行
        Java Invocation中,添加程序生成的jar文件,选择程序入口类
        JRE中,必须填写JRE最低支持的版本
        点击JRE下的 Search sequence,点击右侧加号,选择Directory,输入.\jre(注意:必须手动输入)
        点击JRE下的Preferred sequence,选择第二项Client hotspot VM
        接下来一直next
        点击 Click Here to Start the Application,看程序能否正常运行
    f.使用Inno Setup软件将生成好的exe文件做成安装包
        使用exe4j虽然已经将jar打包成exe文件了,但仅限于本机运行,在没有Java环境的机器上是运行不了的,所以需要借助Inno Setup将JRE环境一起打包进去
        ---------------------------------------------------------------------------------------------------------
        Inno Setup官网链接地址:https://jrsoftware.org/download.php/is.exe
        打开Inno Setup,选择第二个 Create a new script file using the Script Wizard
        一直next,填写应用相关信息
        Application Files中,选择生成好的exe文件
        Application Documentation这里什么都不要填,直接下一步
        一路Next,直到Compiler Settings,选择输出的文件夹,填写安装包的名称
        一路Next,点击Finish,这里点否
        -----------------------------------------------------------------------------------------------------
        增加以下配置信息,注意:Source中要输入自己机器中安装的JRE地址(在JDK的安装目录中)
        #define MyJreName "jre"
        Source: "C:\Program Files (x86)\java-1.8.0\jre\*"; DestDir: "{app}\{#MyJreName}"; Flags: ignoreversion recursesubdirs createallsubdirs
        -----------------------------------------------------------------------------------------------------
        最后,点击运行按钮即可
        最终的安装文件

2.6 packing1

00.总结:编译、运行、构建、部署
    1.spring-boot-maven-plugin:这个插件是springboot的maven插件,能够将springboot项目打包为可执行的jar/war
    2.maven-shade-plugin:这个插件是把整个项目(包含它的依赖)都打包到一个可以执行的jar包中
    3.maven-assembly-plugin: 这个插件是maven结构定制化的打包,maven中针对打包任务而提供的标准插件
    4.maven-dependency-plugin:这个插件是用来拷贝依赖库,用于将项目依赖项复制到指定位置
    5.maven-resources-plugin:这个插件是用来处理拷贝resources下的资源文件
    6.maven-jar-plugin:这个插件是将指定包目录打成单独的jar包,可以配置需要打包进去的文件,程序的入口类等
    7.maven-compiler-plugin:这个插件是用来编译Java代码,

00.打包工具
    a.spring-boot-maven-plugin
        springboot项目默认的打包工具,默认情况下只会将项目源码编译生成的class文件和资源文件依赖jar包都打进来,
        即打包自己项目的class文件+环境变量+静态资源文件+依赖jar(不会把依赖jar反编译为class文件打入)。
        使用2.2.1.RELEASE版本需要maven版本在2.0及以上,JDK在1.8及以上。
    b.maven-shade-plugin
        它很聪明地将依赖的JAR文件全部解压后,再将得到的.class文件连同当前项目的.class文件一起合并到最终的CLI包(可以直接运行的jar包)中,
        这样,在执行CLI JAR文件的时候,所有需要的类就都在Classpath中了。
        -----------------------------------------------------------------------------------------------------
        maven-shade-plugin提供了两大基本功能:
        将依赖的jar包打包到当前jar包(常规打包是不会将所依赖jar包打进来的);
        对依赖的jar包进行重命名(用于类的隔离);
    c.maven-assembly-plugin
        功能非常强大,是maven中针对打包任务而提供的标准插件。
        它是Maven最强大的打包插件,它支持各种打包文件格式,包括zip、tar.gz、tar.bz2等等,
        通过一个打包描述文件设置(src/main/assembly.xml),它能够帮助用户选择具体打包哪些资源文件集合、依赖、模块,
        甚至本地仓库文件,每个项的具体打包路径用户也能自由控制。它不是把依赖的jar直接打进去,
        而是把依赖的jar编译成class文件打入jar中目录
    d.maven-dependency-plugin
        maven-dependency-plugin是处理与依赖相关的插件。它有很多可用的goal,大部分是和依赖构建、分析和解决相关的goal,这部分goal可以直接用maven的命令操作,
        例如:mvn dependency:tree、mvn dependency:analyze
        但是我们最常用到的是dependency:copydependency:copy-dependencies、dependency:unpack、dependency:unpack-dependencies这四个。
        maven-dependency-plugin最大的用途是帮助分析项目依赖,dependency:list能够列出项目最终解析到的依赖列表,
        dependency:tree能进一步的描绘项目依赖树,dependency:analyze可以告诉你项目依赖潜在的问题,
        如果你有直接使用到的却未声明的依赖,该目标就会发出警告。maven-dependency-plugin还有很多目标帮助你操作依赖文件,
        例如dependency:copy-dependencies能将项目依赖从本地Maven仓库复制到某个特定的文件夹下面。
    e.maven-resources-plugin
        为了使项目结构更为清晰,Maven区别对待Java代码文件和资源文件,
        maven-compiler-plugin用来编译Java代码,maven-resources-plugin则用来处理资源文件。
        默认的主资源文件目录是src/main/resources,很多用户会需要添加额外的资源文件目录,
        这个时候就可以通过配置maven-resources-plugin来实现。
        -----------------------------------------------------------------------------------------------------
        此外,资源文件过滤也是Maven的一大特性,你可以在资源文件中使用_${propertyName}_形式的Maven属性,
        然后配置maven-resources-plugin开启对资源文件的过滤,之后就可以针对不同环境通过命令行或者Profile传入属性的值,
        以实现更为灵活的构建。
    f.maven-jar-plugin
        插件:使用maven-jar-plugi插件
        默认的打包方式,用来打普通的project JAR包
    g.maven-compiler-plugin
        作用: 1. 指示maven用什么版本的jdk编译; 2. 指示IntelliJ IDEA把项目识别成什么jdk
        maven 是个管理工具,如果我们不告诉它我们的代码要使用什么样的 jdk 版本编译的话,
        它就会用 maven-compiler-plugin 默认的 jdk 版本来进行处理,这样就容易出现版本不匹配,
        以至于可能导致编译不通过的问题。
        -----------------------------------------------------------------------------------------------------
        maven-compiler-plugin插件是一个Maven插件,用来编译项目代码;
        自从3.0开始默认的编译器是javax.tools.JavaCompiler,用来编译Java源码;
        如果你想强制插件使用javac编译器,你必须配置插件的属性forceJavacCompilerUse;
        还要注意,当前默认源(source)设置为1.6,默认目标(target)设置为1.6。
        -----------------------------------------------------------------------------------------------------
        独立运行Maven和JDK,可以通过source和target选项更改他们的默认值;

01.spring-boot-maven-plugin
    a.配置
        <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
         <version>2.1.1.RELEASE</version>
         <configuration>
             <!-- 配置使devtools生效 -->
             <fork>true</fork>
             <!-- 配置为 true,打包出来的 jar/war 就是可执行的,可以配置为linux的service启动,如果使用 jar -xf 等解压命令,将此配置改为false-->
             <executable>true</executable>
             <!-- 配置在使用第三方的jar包作为依赖,打包时,指定maven把scope为system的依赖同样打到jar包中去,需要配合dependency的<scope>system</scope>和<systemPath>${project.basedir}/libs/xxx-api-sdk-1.1.0.jar</systemPath>使用-->
             <includeSystemScope>true</includeSystemScope>
         </configuration>
         <executions>
             <execution>
                 <goals>
                     <!-- 配置在 mvn package 执行之后,再次打包生成可执行的 jar包。repackage生成jar包的名称与 mvn package 生成的原始 jar/war包名称相同,而原始 jar包被重命名为 *.origin。这样生成的*.jar可直接运行,但不能被其他项目模块依赖。这是因为repackage将项目的class都放在了jar包 BOOT-INF/classes 文件夹中,导致其他模块不能加载jar包中的 class。-->
                     <goal>repackage</goal>
                 </goals>
             </execution>
         </executions>
       </plugin>
       -----------------------------------------------------------------------------------------------------
       <plugin>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-maven-plugin</artifactId>
           <configuration>
               <executable>true</executable>
               <layout>ZIP</layout>
               <!--解决windows命令行窗口中文乱码-->
               <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
               <!--这里是填写需要包含进去的jar,
                 必须项目中的某些模块,会经常变动,那么就应该将其坐标写进来
                 如果没有则nothing ,表示不打包依赖 -->
               <includes>
                   <include>
                       <groupId>nothing</groupId>
                       <artifactId>nothing</artifactId>
                   </include>
               </includes>
           </configuration>
       </plugin>
       -----------------------------------------------------------------------------------------------------
       <build>
           <finalName>${project.artifactId}</finalName>
           <plugins>
               <!-- Spring Boot Maven插件 - 核心插件 -->
               <plugin>
                   <groupId>org.springframework.boot</groupId>
                   <artifactId>spring-boot-maven-plugin</artifactId>
                   <version>2.6.6</version>
                   <configuration>
                       <includeSystemScope>true</includeSystemScope>
                       <mainClass>com.jhict.product.demo.DemoApplication</mainClass>
                   </configuration>
               </plugin>

               <!-- Java编译插件 -->
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-compiler-plugin</artifactId>
                   <version>3.8.1</version>
                   <configuration>
                       <source>1.8</source>
                       <target>1.8</target>
                       <encoding>UTF-8</encoding>
                   </configuration>
               </plugin>
           </plugins>
       </build>
    b.说明
        mvn spring-boot:build-info:生成项目的构建信息文件
        mvn spring-boot:help:展示spring-boot-maven-plugin的帮助信息
        mvn spring-boot:repackage :可生成可执行的jar包或war包。插件的核心goal。
        mvn spring-boot:run:运行 Spring Boot 应用
        mvn spring-boot:start:将SpringBoot应用程序集成到集成测试阶段,在此之前启动
        mvn spring-boot:stop:将SpringBoot应用程序集成到集成测试阶段,在此之前启动

02.maven-shade-plugin
    a.配置
        <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
         <version>2.4.1</version>
         <executions>
             <execution>
             <!--配置goal-shade绑定到phase-package 上 会在 target 文件生成一个以 -shaded.jar 为后缀的 jar 包-->
                 <phase>package</phase>
                 <goals>
                    <goal>shade</goal>
                 </goals>
                 <configuration>
                  <artifactSet>
                    <excludes>
                    <!--配置该工程依赖的部分 Jar 包 include/exclude 掉。-->
                      <exclude>classworlds:classworlds</exclude>
                      <exclude>junit:junit</exclude>
                    </excludes>
                  </artifactSet>
                  <!--配置依赖的某个 Jar 包内部的类或者资源 include/exclude 掉。-->
                   <filters>
                    <filter>
                      <artifact>junit:junit</artifact>
                      <includes>
                        <include>junit/framework/</include>
                        <include>org/junit/</include>
                      </includes>
                      <excludes>
                        <exclude>org/junit/experimental/</exclude>
                        <exclude>org/junit/runners/</exclude>
                      </excludes>
                    </filter>
                   </filters>
                   <!--配置将所有不使用的类全部排除掉,将 jar 最小化-->
                   <minimizeJar>true</minimizeJar>
                   <!--配置 MainClass 创建一个可执行 Jar 包。-->
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                          <mainClass>org.sonatype.haven.HavenCli</mainClass>
                        </transformer>
                    </transformers>
                    <!-- 配置解决jar或类的多版本冲突 在打包的时候把类重命名-->
                    <relocations>
                        <relocation>
                          <pattern>org.codehaus.plexus.util</pattern>
                          <shadedPattern>org.shaded.plexus.util</shadedPattern>
                          <excludes>
                            <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
                            <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
                          </excludes>
                        </relocation>
                  </relocations>
                </configuration>
             </execution>
         </executions>
        </plugin>
    b.说明

03.maven-assembly-plugin
    a.配置
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4<version>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <!-- 配置绑定到package生命周期 -->
                    <phase>package</phase>
                    <goals>
                        <!-- 配置只运行一次 -->
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <!-- 配置描述符文件 -->
                <descriptor>src/main/assembly/assembly.xml</descriptor>
                <!-- 配置可以使用Maven预配置的描述符
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs> -->
            </configuration>
        </plugin>
    b.说明
        自定义打包的时候,需要自己写描述符文件,格式为XML
        -----------------------------------------------------------------------------------------------------
        <assembly>
            <!--配置添加到打包文件名的标识符,用来做后缀-->
            <id>assembly</id>
            <!--配置打包文件格式,有zip、tar、tar.gz、tar.bz2、jar、war-->
            <formats>
                <format>tar.gz</format>
            </formats>
            <!---->
            <includeBaseDirectory>true</includeBaseDirectory>
            <!-- 配置一组文件在打包时的属性。-->
            <fileSets>
                <fileSet>
                    <!-- 配置源目录的路径。-->
                    <directory>src/main/bin</directory>
                    <!-- 配置包含或排除哪些文件,支持通配符-->
                    <includes>
                        <include>*.sh</include>
                    </includes>
                    <outputDirectory>bin</outputDirectory>
                    <!-- 配置该目录下的文件属性,采用Unix八进制描述法,默认值是0644-->
                    <fileMode>0755</fileMode>
                </fileSet>
                <fileSet>
                    <directory>src/main/conf</directory>
                    <!-- 配置生成目录的路径。-->
                    <outputDirectory>conf</outputDirectory>
                </fileSet>
                <fileSet>
                    <directory>src/main/sql</directory>
                    <includes>
                        <include>*.sql</include>
                    </includes>
                    <outputDirectory>sql</outputDirectory>
                </fileSet>
                <fileSet>
                    <directory>target/classes/</directory>
                    <includes>
                        <include>*.properties</include>
                        <include>*.xml</include>
                        <include>*.txt</include>
                    </includes>
                    <outputDirectory>conf</outputDirectory>
                </fileSet>
            </fileSets>
            <!-- 配置和fileSets大致相同,不过是指定单个文件,并且还可以通过destName属性来设置与源文件不同的名称。-->
            <files>
                <file>
                    <source>target/${project.artifactId}-${project.version}.jar</source>
                    <outputDirectory>.</outputDirectory>
                </file>
            </files>
            <!-- 配置工程依赖文件在打包时的属性-->
            <dependencySets>
                <dependencySet>
                <!--配置布尔值,false表示将依赖以原来的JAR形式打包,true则表示将依赖解成*.class文件的目录结构打包。-->
                <unpack>false</unpack>
                <!--配置符合哪个作用范围的依赖会被打包进去。compile与provided都不用管,一般是写runtime。 按照以上配置打包好后,将.tar.gz文件上传到服务器,解压之后就会得到bin、conf、lib等规范化的目录结构-->
                <scope>runtime</scope>
                <outputDirectory>lib</outputDirectory>
                </dependencySet>
            </dependencySets>
        </assembly>

04.maven-dependency-plugin
    a.配置1
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.8</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <!--配置copy操作可以用来将某个maven artifact(s)拷贝到某个目录下-->
                        <goal>copy</goal>
                    </goals>
                </execution>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <!--配置unpack操作可以用来将某个maven artifact(s)拷贝到某个目录下-->
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <type>jar</type>
                        <includeTypes>jar</includeTypes>
                        <outputDirectory>
                            ${project.build.directory}/lib
                        </outputDirectory>
                        <!-- 配置是否排除间接依赖 默认false 不排除 -->
                        <excludeTransitive>false</excludeTransitive>
                        <!-- 配置是否消除依赖jar包后缀的版本信息 默认是false 不取消版本信息-->
                        <stripVersion>false</stripVersion>
                    </configuration>
               </execution>
            </executions>
            <!--配置排除所有camel的依赖-->
            <configuration>
                <excludeGroupIds>org.apache.camel</excludeGroupIds>
            </configuration>
            <!--配置排除除camel-spring外的所有其他依赖-->
            <configuration>
                <includeArtifactIds>camel-spring</includeArtifactIds>
            </configuration>
        </plugin>
    b.配置2
        <!--拷贝依赖到jar外面的lib目录-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <!--指定的依赖路径-->
                        <outputDirectory>
                            ${project.build.directory}/lib
                        </outputDirectory>
                        <excludeScope>provided</excludeScope>
                    </configuration>
                </execution>
            </executions>
        </plugin>

05.maven-resources-plugin
    a.配置
         <build>
          <resources>
               <resource>
                    <!--配置从此目录下读取全部以.properties和.xml开头的文件-->
                    <directory>src/main/resources/</directory>
                    <includes>
                      <include>**/*.properties</include>
                      <include>**/*.xml</include>
                    </includes>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <!--配置过滤上面指定属性文件中的占位符,占位符是${变量名称}这样的形式,maven会自动读取includes配置文件,然后解析其中的占位符,使用上面pom文件中定义的属性进行替换-->
                    <filtering>true</filtering>
                    <includes>
                        <include>*.yml</include>
                    </includes>
                    <!--配置排除某些-->
                    <excludes>
                        <exclude>file</exclude>
                    </excludes>
               </resource>
           </resources>
           <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-resources-plugin</artifactId>
              <version>3.2.0</version>
              <executions>
                    <execution>
                        <id>copy-resources</id>
                        <!-- here the phase you need -->
                       <!-- 配置作用周期-->
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                              <outputDirectory>${basedir}/target/extraresources</outputDirectory>
                              <resources>
                                  <resource>
                                      <directory>src/non-packaged-resources</directory>
                                      <filtering>true</filtering>
                                  </resource>
                              </resources>
                        </configuration>
                  </execution>
              </executions>
            </plugin>
          </plugins>
        </build>
    b.说明

06.maven-jar-plugin
    a.配置
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <archive>
                    <!-- 配置生成的jar中,包含pom.xml和pom.properties这两个文件 -->
                    <addMavenDescriptor>true</addMavenDescriptor>
                    <!-- 生成MANIFEST.MF的设置 -->
                    <manifest>
                        <!--配置引用的包maven库多个包带时间戳的和不带时间戳的无法对应的错误 -->
                        <useUniqueVersions>false</useUniqueVersions>
                        <!-- 配置依赖包添加路径, 这些路径会写在MANIFEST文件的Class-Path下 -->
                        <addClasspath>true</addClasspath>
                        <!-- 配置jar所依赖的jar包添加classPath的时候的前缀,如果这个jar本身
                        和依赖包在同一级目录,则不需要添加 -->
                        <classpathPrefix>lib/</classpathPrefix>
                        <!-- 配置jar启动入口类 -->
                        <mainClass>com.ht.pojo.Test</mainClass>
                    </manifest>
                    <manifestEntries>
                        <!-- 配置Class-Path下添加配置文件的路径 -->
                        <Class-Path>../config/</Class-Path>
                        <!-- 配项目依赖本地的资源,打包的时候并不想把这些资源文件打进包里面,需要指定资源文件的路径
                    </manifestEntries>
                </archive>
                <!-- 配置jar包的位置 -->
                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                <includes>
                    <!-- 配置打包class文件和config目录下面的 properties文件 -->
                    <!-- 配置可能需要一些其他文件,这边可以配置,包括剔除的文件等等 -->
                    <include>**/*.class</include>
                    <include>**/*.properties</include>
                </includes>
            </configuration>
        </plugin>
    b.配置2
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>top.teainn.project.MyApplication</mainClass>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix>
                    </manifest>
                </archive>
            </configuration>
        </plugin>

07.maven-compiler-plugin
    a.配置
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <!-- 配置指定的 JDK 版本将 java 文件编译为 class 文件(针对编译运行环境) -->
                <source>1.6</source>
                <!-- 配置指定的 JDK 版本对源代码进行编译(针对编译运行环境) -->
                <target>1.6</target>
                <!-- 配置程序能在其他版本的jdk中运行(对于低版本目标jdk,源代码中需要没有使用低版本jdk中不支持的语法),会存在target不同于source的情况 -->
               <compilerArgs>
                        <!--配置javac平时用空格隔开的的每一个参数-->
                        <arg>-verbose</arg>
                        <arg>-Xlint:unchecked</arg>
                        <arg>-Xlint:deprecation</arg>
                        <arg>-bootclasspath</arg>
                        <arg>${env.JAVA_HOME}/jre/lib/rt.jar${path.separator}${env.JAVA_HOME}/lib/jce.jar</arg>
                        <arg>-extdirs</arg>
                        <arg>${project.basedir}/src/main/webapp/WEB-INF/lib</arg>
               </compilerArgs>
            </configuration>
        </plugin>
    b.说明

99.Dockerfile文件
    a.说明
        主要的是 COPY ${OUT_DIRECTORY}/lib /lib,将外部目录中的 lib 复制到容器中的 lib
    b.配置
        # 设置jdk版本
        FROM java:8

        # 设置我们的个人信息,大家根据需求随便写
        MAINTAINER daqi <[email protected]>

        # 这两行是设置我们容器内的时间以及jvm的时间(默认不是GMT)
        RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
        RUN echo "Asia/Shanghai" > /etc/timezone

        #复制依赖 jar
        COPY ${OUT_DIRECTORY}/lib /lib

        # 前面的xxxxxx是我们上传的jar包名称,后面的是我们新命名的jar包
        ADD Esurvey-backend-1.1.1.jar springboot.jar
        # 执行我们的jar包,xxx是上面刚命名的新名字
        # CMD java -jar springboot.jar

        # 镜像启动成为容器后,对外暴露的端口
        EXPOSE 9996

        # Image创建容器时的初始化内存,最大内存,及启动时使用的profile. -c为清除以前启动的数据
        # 依赖默认访问本目录下的 lib
        ENTRYPOINT ["java","-Xms256m","-Xmx256m","-jar","/springboot.jar","--spring.profiles.active=prod","-c"]

99.assmebly插件打包
    a.简介
        Maven-assembly-plugin是maven中针对打包任务而提供的标准插件,可以实现自定义打包。
        主要提供如下功能:
        提供一个把工程依赖元素、模块、网站文档等其他文件存放到单个归档文件里
        打包成指定格式分发包,支持各种主流的格式如zip、tar.gz、jar和war等,具体打包哪些文件是高度可控的
        能够自定义包含/排除指定的目录或文件
    b.自定义assmebly配置
        a.说明
            assembly 插件中,descriptors 和 descriptorRefs 是两个用于定义打包配置的不同标签。
            它们的主要作用是指定如何定义和使用 assembly 描述文件。
            -------------------------------------------------------------------------------------------------
            descriptorRefs
            功能:descriptorRefs 标签用于引用预定义的、常用的 assembly 描述符。这些预定义的描述符由 maven-assembly-plugin 提供,
                  通常用于常见的打包需求,如创建包含所有依赖的 JAR 文件、创建 ZIP 文件等。
            常用描述符:jar-with-dependencies:创建一个包含所有项目依赖的 JAR 文件。
                       bin:创建一个包含项目的二进制文件的压缩包。
                       src:创建一个包含源代码的压缩包。
            -------------------------------------------------------------------------------------------------
            descriptors
            功能:descriptors 标签用于指定自定义的 assembly 描述符文件。这些描述符文件是 XML 文件,定义了如何将项目的文件和依赖打包到最终的分发包中。
            在项目的 src/assembly 目录下创建自定义的 XML 描述符文件,来指定如何打包项目文件、依赖文件和其他资源。
        b.maven中配置
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>${maven-assembly-plugin.version}<version>
                        <configuration>
                            <!-- 打出包最终名字 -->
                            <finalName>test-${project.version}</finalName>
                            <!--用于控制在生成的归档文件(如 ZIP、JAR)中是否包含组件的构建 ID(assemblyId)-->
                            <!--如果组件构建ID是assembly那么生成的归档文件名将会是 artifactId-version-assembly.zip -->
                            <!--若为fasle则artifactId-version.zip-->
                            <appendAssemblyId>false</appendAssemblyId>
                            <!-- 配置描述符文件 指定文件位置 -->
                            <descriptors>
                                <descriptor>assembly/assembly.xml</descriptor>
                            </descriptors>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id>
                                <!-- 绑定到package生命周期 -->
                                <phase>package</phase>
                                <goals>
                                    <!-- 只运行一次 -->
                                    <goal>single</goal>
                                </goals>
                             </execution>
                         </executions>
                     </plugin>
                 </plugins>
            </build>
        c.maven标签
            a.configuration标签说明
                descriptor标签中的assembly.xml就是指定的配置文件位置
            b.assembly.xml配置
                <assembly>
                    <id>assembly</id>
                    <formats>
                        <format>tar.gz</format>
                    </formats>
                    <includeBaseDirectory>true</includeBaseDirectory>
                    <fileSets>
                        <fileSet>
                            <!--  启动信息 -->
                            <directory>src/main/bin</directory>
                            <includes>
                                <include>*.sh</include>
                            </includes>
                            <outputDirectory>bin</outputDirectory>
                            <fileMode>0755</fileMode>
                        </fileSet>
                        <fileSet>
                            <!--  配置信息 -->
                            <directory>src/main/conf</directory>
                            <outputDirectory>conf</outputDirectory>
                        </fileSet>
                        <fileSet>
                            <directory>src/main/sql</directory>
                            <includes>
                                <include>*.sql</include>
                            </includes>
                            <outputDirectory>sql</outputDirectory>
                        </fileSet>
                        <fileSet>
                            <directory>target/classes/</directory>
                            <includes>
                                <include>*.properties</include>
                                <include>*.xml</include>
                                <include>*.txt</include>
                            </includes>
                            <outputDirectory>conf</outputDirectory>
                        </fileSet>
                    </fileSets>
                    <files>
                        <file>
                            <source>target/${project.artifactId}-${project.version}.jar</source>
                            <outputDirectory>.</outputDirectory>
                        </file>
                    </files>
                    <dependencySets>
                        <!-- 打包到lib目录下 -->
                        <dependencySet>
                            <unpack>false</unpack>
                            <scope>runtime</scope>
                            <outputDirectory>/lib</outputDirectory>
                        </dependencySet>
                        <!-- 如果是需要启动jar单独和其他隔离开,可以这样指定启动jar在根目录 -->
                        <dependencySet>
                            <outputDirectory>/</outputDirectory>
                            <unpack>false</unpack>
                            <scope>runtime</scope>
                            <includes>
                                <include>cn.test:main:jar</include>
                            </includes>
                        </dependencySet>
                    </dependencySets>
                </assembly>
            c.assembly标签
                a.id标签
                    id标识符,添加到生成文件名称的后缀符。如果指定 id 的话,目标文件则是 ${artifactId}-${id}.tar.gz
                b.formats标签
                    formats是assembly插件支持的打包格式有zip、tar、tar.gz (or tgz)、tar.bz2 (or tbz2)、jar、dir、war,可以同时指定多个打包格式
                    <formats>
                         <format>tar.gz</format>
                         <format>dir</format>
                     </formats>
                c.includeBaseDirectory标签
                    includeBaseDirectory标签指定打的包是否包含打包层目录(比如finalName是terminal-dispatch,
                    当值为true,所有文件被放在包内的terminal-dispatch目录下,否则直接放在包的根目录下)
                d.dependencySets标签
                    用来定制工程依赖 jar 包的打包方式,核心元素如下表所示:
                    outputDirectory: 指定包依赖目录,该目录是相对于根目录
                    includes/include*:包含依赖
                    excludes/exclude*:排除依赖
                    useProjectArtifact:指定打包时是否包含工程自身生成的jar包
                    unpack:布尔值,false表示将依赖以原来的JAR形式打包,true则表示将依赖解成*.class文件的目录结构打包
                    scope:表示符合哪个作用范围的依赖会被打包进去。compile与provided都不用管,一般是写runtime
                e.fileSets标签
                    fileSets标签用来设置一组文件在打包时的属性:
                    directory:源目录的路径。
                    includes/excludes:设定包含或排除哪些文件,支持通配符。
                    fileMode:指定该目录下的文件权限,采用Unix八进制描述法,(User Group Other)所属属性默认值是0644,Read = 4,Write = 2和Execute = 1
                    outputDirectory:指定文件集合的输出目录,生成目录的路径,该目录是相对于根目录
                f.iles标签
                    files标签可以指定目的文件名到指定目录,其他和 fileSets 相同,核心元素如下表所示:
                    source:源文件,相对路径或绝对路径
                    outputDirectory:输出目录
                    destName: 目标文件名
                    fileMode:文件权限
    d.预定义assembly
        a.说明
            <descriptorRef> 用于引用 Maven 官方或自定义预定义的组装描述符。
            这些预定义的描述符通常已经内置在插件中,无需自己提供 assembly.xml 文件。
            -------------------------------------------------------------------------------------------------
            常用的预定义描述符包括:
            jar-with-dependencies:将所有依赖打包到一个可运行的 JAR 文件中。
            bin:构建一个二进制分发包。
            src:构建一个源码分发包。
        b.配置
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <!-- Set jar file name -->
                    <finalName>${project.artifactId}-${project.version}-all</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                    <attach>false</attach>
                    <archive>
                        <manifest>
                <mainClass>fully.qualified.MainClass</mainClass>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                     <!-- Set effect phase -->
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

99.maven-jar-plugin直接打包
    a.maven-resources-plugin 标签
        maven-resources-plugin 主要负责复制和过滤项目中的资源文件(如 .properties、.xml、.yml 等),默认处理的资源目录:src/main/resources(生产环境的资源)和src/test/resources(测试环境的资源)
        主要功能:
        将资源文件复制到构建目录,例如 target/classes。
        支持过滤操作(动态替换文件中的变量,如 ${}),此处配置是 全局过滤配置
        可以通过配置指定资源文件的目标路径。
        -----------------------------------------------------------------------------------------------------
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.0</version>
          <configuration>
            <encoding>UTF-8</encoding>
            <resources>
              <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
              </resource>
            </resources>
          </configuration>
          <executions>
              <execution>
                  <id>copy-dependencies</id>
                  <phase>package</phase>
                  <goals>
                     <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                  <!--配置文件打包成config目录下 -->
                  <outputDirectory>${project.build.directory}/twin-web/config</outputDirectory>
                 <resources>
                      <resource>
                      <directory>src/main/resources</directory>
                      </resource>
              </resources>
             </configuration>
          </execution>
        </executions>
        </plugin>
    b.resources标签
        在 Maven 项目中,<resources> 标签用于配置资源文件的处理逻辑,
        如果项目中没有显式配置 <resources>,Maven 默认会将 src/main/resources 目录下的所有文件(不进行过滤)
        复制到 target/classes 目录。这些文件在打包时会自动被包含到最终的 JAR/WAR 包中。
        -----------------------------------------------------------------------------------------------------
        <resources>
          <resource>
              <directory>src/main/resources</directory>
               <!--filerting设置为true,则打包过程中会对这些文件进行过滤处理,此处是 具体配置 -->
               <!-- 在打包时动态替换资源文件中的占位符(如 ${} 变量),就需要为true -->
               <filtering>true</filtering>
               <!--指定目标路径为config-->
              <targetPath>${project.build.directory}/config</targetPath>
              <includes>
              <!--使用通配符-->
                 <include>**/*.properties</include>
                 <include>**/*.yml</include>
                 <include>**/*.xml</include>
                 <include>mapper/*.xml</include>
                 <!-- 这里可以根据你实际想要包含的配置文件类型来添加更多的include配置 -->
           </includes>
          </resource>
        </resources>
    c.maven-surefire-plugin 标签
        maven-surefire-plugin 测试执行插件,负责运行项目中的单元测试或集成测试。
        默认执行 src/test/java 下的测试代码(基于 JUnit、TestNG 等框架)。
        测试执行命令:mvn test
        功能:
        执行测试用例并生成测试报告。
        支持配置测试框架(如 JUnit 4/5、TestNG)。
        提供参数化测试、并行测试支持。
        -----------------------------------------------------------------------------------------------------
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0</version>
          <configuration>
            <testFailureIgnore>true</testFailureIgnore>
            <includes>
              <include>**/*Test.java</include>
            </includes>
          </configuration>
        </plugin>
    d.maven-dependency-plugin 标签
        maven-dependency-plugin 依赖管理插件,主要用于处理项目的依赖,提供下载、分析、复制、解压和报告依赖的功能。
        功能:
        下载项目依赖的 JAR 包到本地仓库。
        分析项目依赖(包括依赖冲突)。
        将特定的依赖文件复制到指定目录。
        解压依赖包以供项目使用。
        常用目标(Goals):
        dependency:copy:将依赖复制到指定目录。
        dependency:unpack:解压指定的依赖文件。
        dependency:tree:显示项目的依赖树结构。
        dependency:analyze:分析未使用或缺失的依赖。
        -----------------------------------------------------------------------------------------------------
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>
                            ${project.build.directory}/lib
                        </outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    e.maven-jar-plugin 标签
        maven-jar-plugin 打包插件,主要用于将项目的编译产物打包成 JAR 文件,默认打包输出路径为 target/${project.artifactId}-${project.version}.jar。
        功能:
        自定义 JAR 文件的结构。
        支持将额外的资源文件或依赖包添加到 JAR 包中。
        可以配置主类(Main-Class),生成可执行 JAR。
        -----------------------------------------------------------------------------------------------------
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <!-- <version>2.4</version>-->
            <!-- 对要打的jar包进行配置 -->
            <configuration>
                <outputDirectory>
                      <!--输入打包可执行的jar到twin-web\libs\下-->
                      ${project.build.directory}/twin-web/
                 </outputDirectory>
                <!-- Configuration of the archiver -->
                <archive>
                    <!--生成的jar中,不要包含pom.xml和pom.properties这两个文件-->
                    <addMavenDescriptor>false</addMavenDescriptor>
                    <!-- Manifest specific configuration -->
                    <manifest>
                        <!-- 指定运行类 -->
                        <mainClass>
                            cn.test.App
                        </mainClass>
                        <!--是否要把第三方jar放到manifest的classpath中-->
                        <addClasspath>true</addClasspath>
                        <!-- 生成的manifest中classpath的前缀-->
                        <!-- 因为要把第三方jar放到lib目录下, 所以classpath的前缀是lib/ -->
                        <classpathPrefix>lib/</classpathPrefix>
                    </manifest>
                    <manifestEntries>
                        <!-- 增加配置文件的classpath-->
                        <Class-Path>./config/</Class-Path>
                    </manifestEntries>
                </archive>
                <!--过滤掉不希望包含在jar中的文件-->
                <excludes>
                    <!-- 排除不需要的文件夹(路径是jar包内部的路径) -->
                    <exclude>**/assembly/</exclude>
                </excludes>
            </configuration>
        </plugin>

99.spring-boot-maven-plugin打包
    a.说明
        spring-boot-maven-plugin是spring boot提供的 maven打包插件。可打直接可运行的 jar包或war包。
        如果使用 2.2.1.RELEASE 版本,则需要maven版本在2.0及以上,JDK在1.8及以上
        该插件是spring boot官方提供的一个打包插件,主要用来打出fat jar,并且提供了支持java -jar xxx.jar方式启动
    b.示例
        <?xml version="1.0" encoding="UTF-8"?>
        <project xmlns="http://maven.apache.org/POM/4.0.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <parent>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.6.11</version>
            </parent>
            <modelVersion>4.0.0</modelVersion>
            <packaging>jar</packaging>
            <artifactId>mine</artifactId>

            <dependencies>
                ···
            </dependencies>

            <build>
                <!-- mavne打包动态修改替换配置文件中的占位符 -->
                <resources>
                    <resource>
                        <directory>${basedir}/src/main/resources</directory>
                        <!-- 处理其中的可替换参数(@..@符合标注的变量) -->
                        <filtering>true</filtering>
                    </resource>
                    <!-- 可以配置引入哪些配置文件includes或排除哪些文件excludes -->
                </resources>

                <plugins>
                    <!-- 跳过单元测试的 插件-->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.19.1</version>
                        <configuration>
                            <!-- 默认关掉单元测试,不用手动关闭了 -->
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                    <!-- 配置文件处理插件  -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.1.0</version>
                        <configuration>
                            <encoding>utf-8</encoding>
                            <!-- 是否使用默认占位符@@ -->
                            <useDefaultDelimiters>true</useDefaultDelimiters>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <!-- 指定该 Main Class 为全局的唯一入口 -->
                            <mainClass>cn.test.App</mainClass>
                            <layout>ZIP</layout>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                <!-- 将依赖到的包都放进去 -->
                                    <goal>repackage</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </project>
    c.插件详解
        插件提供了6个maven goal:
        build-info:生成项目的构建信息文件 build-info.properties
        help:用于展示spring-boot-maven-plugin的帮助信息。使用命令行mvn spring-boot:help -Ddetail=true -Dgoal=<goal-name>可展示goal的参数描述信息。
        repackage:可生成可执行的jar包或war包。插件的核心goal。
        run:运行 Spring Boot 应用
        start:在集成测试阶段,控制生命周期
        stop:在集成测试阶段,控制生命周期
    d.打包repackage
        将 spring-boot-maven-plugin 引入pom,执行 mvn package 命令,即可打jar包(插件默认打jar包),target文件夹里的 *.jar 即为可执行jar包。
        打包主要使用的是 repackage goal,它是 spring-boot-starter-parent为插件设置的默认goal。这个 goal绑定在maven的 package 生命周期上,
        完整命令为 mvn package spring-boot:repackage。在 mvn package 执行打包之后,repackage 再次打包生成可执行的 jar包或war包。
        默认情况下,repackage生成包的名称与 mvn package 生成的原始包名称相同,而原始包被重命名为 *.origin
        -----------------------------------------------------------------------------------------------------
        repackage 命令生成的包,默认会包含项目引入的所有依赖,包括scope为provied的依赖
        若项目引入了spring-boot-devtools,默认spring-boot-devtools 会被打在包里,若想排除,应设置 repackage 的 excludeDevtools参数为true。
        在打war包时,还应将spring-boot-devtools 的optinal设置为true或将scope设置为provided。
        -----------------------------------------------------------------------------------------------------
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>repackage</id>
                            <configuration>
                                <excludeDevtools>true</excludeDevtools>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
        -----------------------------------------------------------------------------------------------------
        repackage 会在Manifest文件中写入Main-Class and Start-Class属性。
        当默认值不能使程序正常运行时,可以通过插件配置。Manifest文件位于的META-INF文件夹中
        -----------------------------------------------------------------------------------------------------
        打可执行jar包时,示例如下:
        Manifest-Version: 1.0
        Archiver-Version: Plexus Archiver
        Built-By: beauty
        Start-Class: com.demo.beauty.BeautyApplication
        Spring-Boot-Classes: BOOT-INF/classes/
        Spring-Boot-Lib: BOOT-INF/lib/
        Spring-Boot-Version: 2.2.1.RELEASE
        Created-By: Apache Maven 3.6.3
        Build-Jdk: 1.8.0_251
        Main-Class: org.springframework.boot.loader.JarLauncher
        -----------------------------------------------------------------------------------------------------
        对应的plugin
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <mainClass>com.demo.beauty.BeautyApplication</mainClass>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        -----------------------------------------------------------------------------------------------------
        打可执行jar包时,spring-boot-maven-plugin 的 mainClass 参数对应的是 Manifest 文件中的 Start-Class 属性,即项目的启动类。
    e.layout标签
        Manifest 文件中的 Main-Class 属性由插件的 layout 决定。layout 属性值默认为jar/war。layout种类有:
        JAR,即通常的可执行jar。Main-Class : org.springframework.boot.loader.JarLauncher
        WAR,即通常的可执行war。Main-Class : org.springframework.boot.loader.warLauncher。为避免将war包部署在容器中运行时可能的冲突问题,provided 类型的依赖都被放置在可执行 war 包的 WEB-INF/lib-provided 文件夹中,包括直接运行war需要的内置容器。
        ZIP,亦可作DIR,类似于JAR。Main-Class : org.springframework.boot.loader.PropertiesLauncher
        当启动时需要用 -Dloader.path=lib/指定额外的类加载路径
        -Dloader.path 是 Spring Boot 应用程序的特性,用于指定额外的类加载路径。
        在 Spring Boot 应用程序中,通常使用 -Dloader.path 来指定外部库和配置文件的路径。
        -classpath 是 Java 应用程序的标准参数,用于指定类加载器在运行时搜索类和资源文件的路径。
        在普通 Java 应用程序中,使用 -classpath 参数来指定类加载路径
        NONE,打包所有依赖库和项目资源,但是不打包任何启动器。可以看到在 layout为NONE时,打出的包中的org文件夹没有了,Manifest 文件中没有Start-Class属性,Main-Class属性值为项目的启动类。
        -----------------------------------------------------------------------------------------------------
        Manifest-Version: 1.0
        Archiver-Version: Plexus Archiver
        Built-By: beauty
        Spring-Boot-Classes: BOOT-INF/classes/
        Spring-Boot-Lib: BOOT-INF/lib/
        Spring-Boot-Version: 2.2.1.RELEASE
        Created-By: Apache Maven 3.6.3
        Build-Jdk: 1.8.0_251
        Main-Class: com.demo.beauty.BeautyApplication
    f.启动方式解析
        springboot插件打出的包是启动的入口,实际上在这个包里面springboot会自动打入一个引导类org.springframework.boot.loader.Launcher,
        它是 Spring Boot 可执行 jar 的主要入口点,它是 Spring Boot jar 文件中的实际 Main-Class,
        用于设置适当的 URLClassLoader 并最终调用 Spring Boot项目中定义的 main()方法。
        Launcher有三个子类(JarLauncher、WarLauncher 和 PropertiesLauncher),如果我们打包插件的layout配置的是ZIP的方式,它会使用PropertiesLauncher
        -----------------------------------------------------------------------------------------------------
        PropertiesLauncher机制说明:
        默认情况下,PropertiesLauncher 在 BOOT-INF/lib/ 中加载,我们可以通过设置loader.properties中的loader.path 或 LOADER_PATH 环境变量来增加其它的加载位置。
        loader.path:配置逗号分隔的 Classpath 类路径,例如 lib,${HOME}/app/lib,前面的路径优先,类似于 javac 命令中的 -classpath。
        loader.home:用于解析 loader.path 配置的相对路径,默认是${user.dir}

2.7 packing2

01.spring-boot-maven-plugin
    a.项目应用的配置文件排除,统一打包到config目录下
        利用springboot中resource插件来排除配置,并统一打包到config目录下
        -----------------------------------------------------------------------------------------------------
        <resources>
          <resource>
              <directory>src/main/resources</directory>
               <!--filerting设置为true,则打包过程中会对这些文件进行过滤处理-->
               <filtering>true</filtering>
               <!--指定目标路径为config-->
              <targetPath>${project.build.directory}/config</targetPath>
              <includes>
              <!--使用通配符-->
                 <include>**/*.properties</include>
                 <include>**/*.yml</include>
                 <include>**/*.xml</include>
             <include>mapper/*.xml</include>
              <!-- 这里可以根据你实际想要包含的配置文件类型来添加更多的include配置 -->
           </includes>
          </resource>
        </resources>
    b.把我们写代码打包可执行jar,并排除依赖jar包
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <configuration>
           <!--项目的启动类,如果有多个main就必须指定,没有可以缺失
             <mainClass>XXXXX.TwinWebApplication</mainClass>-->
            <!--解决windows命令行窗口中文乱码-->
             <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
             <layout>ZIP</layout>
             <!--配置需要打包进项目的jar-->
             <includes>
             <!--填写需要打包所需要的依赖 。没有匹配上任何jar包机排除依赖-->
                <include>
                     <groupId>no-exists-jar</groupId>
                    <artifactId>non-exists-jar</artifactId>
                 </include>
              </includes>
          </configuration>
          <executions>
            <execution>
                 <goals>
                 <!-- 表示当运行mavn package打包时,使用Springboot插件打包 -->
                   <goal>repackage</goal>
               </goals>
            </execution>
          </executions>
        </plugin>
    c.配置依赖的jar包统一打包lib目录
        <!--此插件用于将依赖包抽出-->
        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-dependency-plugin</artifactId>
           <executions>
           <execution>
              <id>copy-dependencies</id>
              <phase>package</phase>
              <goals>
                 <goal>copy-dependencies</goal>
              </goals>
             <configuration>
                  <outputDirectory>${project.build.directory}/lib</outputDirectory>
                  <excludeTransitive>false</excludeTransitive>
                  <stripVersion>false</stripVersion>
                  <includeScope>runtime</includeScope>
              </configuration>
            </execution>
          </executions>
        </plugin>
        -----------------------------------------------------------------------------------------------------
        执行命令:java -jar -Dloader.path=./lib -jar xxx.jar
        注意 springboot启动时候会优先读取config目录下配置文件,所以这里不用指定-Dspring.config.location=XX.yml文件
        注意 例如日志文件配置以及mybits等配置文件可以配成绝对路径

02.maven-jar-plugin
    a.使用插件maven-resources-plugin处理配置文件打包到config目录
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <configuration>
               <encoding>UTF-8</encoding>
            </configuration>
           <executions>
              <execution>
                  <id>copy-dependencies</id>
                  <phase>package</phase>
                  <goals>
                     <goal>copy-resources</goal>
                  </goals>
          <configuration>
              <!--配置文件打包成config目录下 -->
              <outputDirectory>${project.build.directory}/twin-web/config</outputDirectory>
              <resources>
              <resource>
              <directory>src/main/resources</directory>
              </resource>
              </resources>
             </configuration>
          </execution>
        </executions>
        </plugin>
    b.使用maven-jar-plugin打包可执行jar并排除依赖
        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-jar-plugin</artifactId>
           <configuration>
              <outputDirectory>
                  <!--输入打包可执行的jar到twin-web\libs\下-->
                  ${project.build.directory}/twin-web/
               </outputDirectory>
              <archive>
                <addMavenDescriptor>false</addMavenDescriptor>
               <manifest>
                     <addClasspath>true</addClasspath>
                 <!-- 增加执行启动jar的依赖jar包目录前缀-->
                   <classpathPrefix>./libs/</classpathPrefix>
                 <!-- 指定启动类-->
                    <mainClass>com.keqing.twinweb.TwinWebApplication</mainClass>
                </manifest>
                <manifestEntries>
                  <!-- 增加配置文件的classpath-->
                  <Class-Path>./config/</Class-Path>
              </manifestEntries>
             </archive>
             <!-- 排除配置文件-->
             <excludes>
                 <exclude>*.yml</exclude>
                 <exclude>mapper/**</exclude>
                 <exclude>*.xml</exclude>
             </excludes>
          </configuration>
        </plugin>
    c.使用maven-dependency-plugin打包libs目录下
        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-dependency-plugin</artifactId>
           <executions>
           <execution>
              <id>copy-dependencies</id>
              <phase>package</phase>
              <goals>
                 <goal>copy-dependencies</goal>
              </goals>
             <configuration>
                  <outputDirectory>${project.build.directory}/twin-web/libs</outputDirectory>
                  <excludeTransitive>false</excludeTransitive>
                  <stripVersion>false</stripVersion>
                  <includeScope>runtime</includeScope>
              </configuration>
            </execution>
          </executions>
        </plugin>
        -----------------------------------------------------------------------------------------------------
        查看自己打包后jar目录,注意这种打包方式弊端,
        按照一定约定格式规范固定了,一旦依赖jar包(包括配置文件目录等)发生变化就必须重新打包
        -----------------------------------------------------------------------------------------------------2
        启动程序java -jar xxx.jar

03.maven-assembly-plugin
    a.介绍
        maven-assembly-plugin 是 Maven 中的一个插件,它允许用户将项目的输出以及依赖、模块、站点文档和其他文件打包成一个可发布的格式,例如 zip、tar.gz、jar 等。以下是使用 maven-assembly-plugin 的一些优势:
        自定义打包格式:maven-assembly-plugin 允许你通过定义描述符文件(descriptor)来完全自定义打包的内容和格式。你可以选择包含或排除特定的文件和目录。
        一键打包:通过一个简单的 Maven 命令,你可以创建一个包含所有必需依赖的单一归档文件,这使得分发和部署变得非常简单。
        多环境支持:可以为不同的环境(开发、测试、生产)创建不同的打包配置,使得环境迁移更加容易。
        依赖管理:插件会自动处理项目依赖,将它们打包到最终的归档文件中,无需手动管理。
        模块化项目支持:对于多模块项目,maven-assembly-plugin 可以将所有模块的输出合并到一个归档文件中。
        预配置的描述符:插件提供了一些预定义的描述符,如 bin、jar-with-dependencies 等,可以直接使用,无需自定义。
        灵活性:你可以通过修改描述符文件来调整打包行为,以适应不同的需求。
        集成性:maven-assembly-plugin 与 Maven 生态系统紧密集成,可以与其他 Maven 插件协同工作。
        文档和社区支持:由于 maven-assembly-plugin 是 Maven 的一部分,因此有广泛的文档和社区支持。
    b.项目应用的配置文件排除
        <resources>
          <resource>
                 <directory>src/main/resources</directory>
                     <!--filerting设置为true,则打包过程中会对这些文件进行过滤处理-->
                  <filtering>true</filtering>
                 <includes>
                     <!--使用通配符-->
                    <include>**/*.properties</include>
                    <include>**/*.yml</include>
                    <include>**/*.xml</include>
                   <include>mapper/*.xml</include>
                <!-- 这里可以根据你实际想要包含的配置文件类型来添加更多的include配置 -->
                </includes>
           </resource>
        </resources>
    c.配置spring-boot-maven-plugin
        <plugin>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-maven-plugin</artifactId>
           <configuration>
            <!--项目的启动类,如果有多个main就必须指定,没有可以缺失
                 <mainClass>XXXXX.TwinWebApplication</mainClass>-->
                <!--解决windows命令行窗口中文乱码-->
                <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
                <layout>ZIP</layout>
                   <!--配置需要打包进项目的jar-->
               <includes>
                <!--填写需要打包所需要的依赖 。没有匹配上任何jar包机排除依赖-->
                  <include>
                  <groupId>no-exists-jar</groupId>
                  <artifactId>non-exists-jar</artifactId>
                  </include>
              </includes>
           </configuration>
           <executions>
                 <execution>
                   <goals>
                         <!-- 表示当运行mavn package打包时,使用Springboot插件打包 -->
                      <goal>repackage</goal>
                  </goals>
              </execution>
          </executions>
        </plugin>
    d.引入springboot里约定maven-assembly-plugin
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
              <!-- 打包文件名字不包含 assembly.xml 中 id -->
              <appendAssemblyId>false</appendAssemblyId>
              <descriptors>
              <!--项目所在目录配置文件的 assembly.xml文件 -->
                <descriptor>assembly.xml</descriptor>
              </descriptors>
          </configuration>
        <executions>
           <execution>
           <id>make-assembly</id>
           <phase>package</phase>
           <goals>
                  <goal>single</goal>
            </goals>
            </execution>
          </executions>
        </plugin>
        -----------------------------------------------------------------------------------------------------
        配置assembly.xml文件
        <assembly>
           <!-- 打包文件名的标识符,用来做后缀-->
            <id>make-assembly</id>
            <!-- 打包的类型,如果有N个,将会打N个类型的包 -->
           <formats>
              <format>tar.gz</format>
              <format>zip</format>
           </formats>
             <!-- 压缩包下是否生成和项目名相同的根目录 -->
           <includeBaseDirectory>true</includeBaseDirectory>
             <!-- 用来设置一组文件在打包时的属性。-->
          <fileSets>
           <!-- 0755->即用户具有读/写/执行权限,组用户和其它用户具有读写权限;-->
            <!-- 0644->即用户具有读写权限,组用户和其它用户具有只读权限;-->
            <!-- 将src/bin目录下的jar启动脚本输出到打包后的目录中 -->
            <fileSet>
             <!--lineEnding选项可用于控制给定的行结束文件 -->
               <lineEnding>unix</lineEnding>
               <directory>${basedir}/bin</directory>
               <outputDirectory>${file.separator}</outputDirectory>
               <fileMode>0755</fileMode>
               <includes>
                 <include>**.sh</include>
                 <include>**.bat</include>
              </includes>
           </fileSet>
        <!-- 把项目的配置文件,打包进压缩文件的config目录 -->
           <fileSet>
              <directory>${basedir}/src/main/resources</directory>
              <outputDirectory>config</outputDirectory>
              <fileMode>0644</fileMode>
              <includes>
                   <include>*.properties</include>
                   <include>*.yml</include>
                  <include>*.xml</include>
                 <include>mapper/*.xml</include>
              </includes>
           </fileSet>
           <!-- 把项目自己编译出来的jar文件,打包进zip文件的根目录 -->
            <fileSet>
              <directory>${project.build.directory}</directory>
              <outputDirectory>${file.separator}</outputDirectory>
              <includes>
                  <include>*.jar</include>
              </includes>
           </fileSet>
         </fileSets>
        <!-- 依赖包的拷贝-->
        <dependencySets>
           <dependencySet>
             <unpack>false</unpack>
            <useProjectArtifact>true</useProjectArtifact>
            <outputDirectory>lib</outputDirectory>
            <scope>provided</scope>
          </dependencySet>
          <dependencySet>
              <unpack>false</unpack>
              <useProjectArtifact>true</useProjectArtifact>
              <outputDirectory>lib</outputDirectory>
              <scope>system</scope>
          </dependencySet>
          <dependencySet>
             <unpack>false</unpack>
             <useProjectArtifact>true</useProjectArtifact>
             <outputDirectory>lib</outputDirectory>
             <scope>runtime</scope>
          </dependencySet>
        </dependencySets>
        </assembly>
        -----------------------------------------------------------------------------------------------------
        使用命令启动项目java -jar -Dloader.path=./lib -jar xxx.ja

04.maven-plugin-shade
    a.介绍
        https://www.cnblogs.com/lkxed/p/maven-plugin-shade.html
        -----------------------------------------------------------------------------------------------------
        maven-plugin-shade 插件提供了两个能力:
        把整个项目(包含它的依赖)都打包到一个 "uber-jar" 中
        shade - 即重命名某些依赖的包
        -----------------------------------------------------------------------------------------------------
        由此引出了两个问题:
        什么是 uber-jar ?uber-jar 也叫做 fat-jar 或者 jar-with-dependencies,意思就是包含依赖的 jar。
        什么是 shade ?shade 意为遮挡,在此处可以理解为对依赖的 jar 包的重定向(主要通过重命名的方式)
    b.基本使用
        maven-plugin-shade 必须和 Maven 构建生命周期中的 package 阶段绑定,
        也就是说,当执行 mvn package 时会自动触发 shade。
        -----------------------------------------------------------------------------------------------------
        要使用 maven-plugin-shade,只需要在 pom.xml 的 <plugins> 标签下添加它的配置即可,示例如下:
        <project>
            ...
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.2.4</version>
                        <configuration>
                            <!-- 此处按需编写更具体的配置 -->
                        </configuration>
                        <executions>
                            <execution>
                                <!-- 和 package 阶段绑定 -->
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            ...
        </project>
        默认情况下会把项目所有的依赖都包含进最终的 jar 包中。当然,我们也可以在 <configuration> 标签内配置更具体的规则。
    c.四大功能
        a.功能1:按需选择要添加到最终 jar 包中依赖
            使用 <includes> 排除不需要的依赖,示例如下:
            <configuration>
                <artifactSet>
                    <excludes>
                        <exclude>classworlds:classworlds</exclude>
                        <exclude>junit:junit</exclude>
                        <exclude>jmock:*</exclude>
                        <exclude>*:xml-apis</exclude>
                        <exclude>org.apache.maven:lib:tests</exclude>
                        <exclude>log4j:log4j:jar:</exclude>
                    </excludes>
                </artifactSet>
            </configuration>
            -------------------------------------------------------------------------------------------------
            使用 <filters> 结合 <includes> & <excludes> 标签可实现更灵活的依赖选择,示例如下:
            <configuration>
                <filters>
                    <filter>
                        <artifact>junit:junit</artifact>
                        <includes>
                            <include>junit/framework/**</include>
                            <include>org/junit/**</include>
                        </includes>
                        <excludes>
                            <exclude>org/junit/experimental/**</exclude>
                            <exclude>org/junit/runners/**</exclude>
                        </excludes>
                    </filter>
                    <filter>
                        <artifact>*:*</artifact>
                        <excludes>
                            <exclude>META-INF/*.SF</exclude>
                            <exclude>META-INF/*.DSA</exclude>
                            <exclude>META-INF/*.RSA</exclude>
                        </excludes>
                    </filter>
                </filters>
            </configuration>
            -------------------------------------------------------------------------------------------------
            除了可以通过自定义的 filters 来过滤依赖,此插件还支持自动移除项目中没有使用到的依赖,
            以此来最小化 jar 包的体积,只需要添加一项配置即可。示例如下:
            <configuration>
                <minimizeJar>true</minimizeJar>
            </configuration>
        b.功能2:重定位 class 文件
            如果最终的 jar 包被其他的项目所依赖的话,直接地引用此 jar 包中的类可能会导致类加载冲突,这是因为 classpath 中可能存在重复的 class 文件。
            为了解决这个问题,我们可以使用 shade 提供的重定位功能,把部分类移动到一个全新的包中。示例如下:
            <configuration>
                <relocations>
                    <relocation>
                        <pattern>org.codehaus.plexus.util</pattern>
                        <shadedPattern>org.shaded.plexus.util</shadedPattern>
                        <excludes>
                            <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
                            <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
                        </excludes>
                    </relocation>
                </relocations>
            </configuration>
            -------------------------------------------------------------------------------------------------
            涉及标签:
            <pattern>:原始包名
            <shadedPattern>:重命名后的包名
            <excludes>:原始包内不需要重定位的类,类名支持通配符
            -------------------------------------------------------------------------------------------------
            例如,在上述示例中,我们把 org.codehaus.plexus.util 包内的所有子包及 class 文件
            (除了 ~.xml.Xpp3Dom 和 ~.xml.pull 包下的所有 class 文件)重定位到了 org.shaded.plexus.util 包内。
            当然,如果包内的大部分类我们都不需要,一个个排除就显得很繁琐了。
            此时我们也可以使用 <includes> 标签来指定我们仅需要的类,示例如下:
            <project>
                ...
                <relocation>
                    <pattern>org.codehaus.plexus.util</pattern>
                    <shadedPattern>org.shaded.plexus.util</shadedPattern>
                    <includes>
                        <include>org.codehaud.plexus.util.io.*</include>
                    </includes>
                </relocation>
                ...
            </project>
        c.功能3:生成可执行 jar 包
            使用 maven-plugin-shade 后,最终生成的 jar 包可以包含所有项目所需要的依赖。
            我们会想,能不能直接运行这个 uber-jar 呢?答案是当然可以,并且十分简单,
            只需要指定 <mainClass> 启动类就可以了。示例如下:
            <project>
                ...
                <configuration>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <mainClass>org.sonatype.haven.HavenCli</mainClass>
                        </transformer>
                    </transformers>
                </configuration>
                ...
            </project>
            -------------------------------------------------------------------------------------------------
            熟悉 jar 包的朋友们都知道,jar 包中默认会包含一个 MANIFEST.MF 文件,里面描述了一些 jar 包的信息。
            使用 java 自带的 jar 命令打包的时候可以指定 MANIFEST.MF,其中也可以指定 Main-Class 来使得 jar 包可运行。
            那么使用 shade 来指定和直接在 MANIFEST.MF 文件中指定有什么区别呢?
            -------------------------------------------------------------------------------------------------
            答案是没有区别,细心的读者会发现 <mainClass> 标签的父标签是 <transformer> 有一个 implementation 属性,
            其值为 "~.ManifestResourceTransformer",意思是 Manifest 资源文件转换器。上述示例只自指定了启动类,
            因此 shade 会为我们自动生成一个包含 Main-Class 的 MANIFEST.MF 文件,然后在打 jar 包时指定这个文件。
            -------------------------------------------------------------------------------------------------
            那如果我们想要完全定制 MANIFEST.MF 文件内容怎么办呢?我们可以使用 <manifestEntries> 标签,示例如下:
            <project>
                ...
                <configuration>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <manifestEntries>
                                <Main-Class>org.sonatype.haven.ExodusCli</Main-Class>
                                <Build-Number>123</Build-Number>
                            </manifestEntries>
                        </transformer>
                    </transformers>
                </configuration>
                ...
            </project>
        d.功能4:生成资源文件
            项目中涉及到的依赖可能会有它们所必需的资源文件,使用 shade 可以把它们聚合在同一个 jar 包中。
            ---------------------------------------------------------------------------------------------
            默认地,shade 为我们提供了 12 个 ResourceTransformer 类:
            | 类名                               | 作用
            |------------------------------------|-------------------------------------------
            | ApacheLicenseResourceTransformer   | 防止 LICENSE 文件重复
            | ApacheNoticeResourceTransformer    | 准备合并的 NOTICE
            | AppendingTransformer               | 为某个资源文件附加内容
            | ComponentsXmlResourceTransformer   | 聚合 Plexus components.xml
            | DontIncludeResourceTransformer     | 防止包含指定的资源
            | GroovyResourceTransformer          | 合并 Apache Groovy 的扩展模块
            | IncludeResourceTransformer         | 添加项目中的文件为资源文件
            | ManifestResourceTransformer        | 自定义 MANIFEST 文件
            | PluginXmlResourceTransformer       | 聚合 Maven 的 plugin.xml 配置
            | ResourceBundleAppendingTransformer | 合并 ResourceBundles
            | ServicesResourceTransformer        | 重定位且合并 META-INF/services 资源文件中的 class 文件.
            | XmlAppendingTransformer            | 为 XML 资源文件附加内容
            -------------------------------------------------------------------------------------------------
            每种 ResourceTransformer 的具体使用可以点击对应链接查看官方示例,这里不再赘述。
            如果上述 12 个类都不能够满足我们的需求,我们可以实现 shade 提供的接口,
            按需自定义一个 ResourceTransformer,实现方法详见官网 Using your own Shader implementation。
        e.参考来源
            http://maven.apache.org/plugins/maven-shade-plugin/index.html ↩︎
            http://maven.apache.org/plugins/maven-shade-plugin/usage.html ↩︎
            http://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.htm ↩︎
            http://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html ↩︎
            http://maven.apache.org/plugins/maven-shade-plugin/examples/executable-jar.html ↩︎
            http://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html ↩︎

05.logstash-logback-encoder:logstash日志
    a.介绍
        logstash-logback-encoder是一个用于将Logback日志输出到Logstash的插件
        它可以将日志格式化为JSON格式,并通过TCP或UDP发送到Logstash,从而实现日志的集中收集和处理
    b.功能
        JSON 格式化:将日志格式化为 JSON 格式,便于结构化日志的处理和分析
        多种输出方式:支持通过 TCP、UDP 等多种方式将日志发送到 Logstash
        自定义字段:支持在日志中添加自定义字段,便于日志的分类和过滤
        高性能:优化的编码器和输出器,确保日志传输的高性能和低延迟
    c.使用
        a.添加 Maven 依赖
            <dependency>
                <groupId>net.logstash.logback</groupId>
                <artifactId>logstash-logback-encoder</artifactId>
                <version>7.4</version>
            </dependency>
        b.配置Logback
            <configuration>
                <appender name="logstash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
                    <destination>localhost:5044</destination>
                    <encoder class="net.logstash.logback.encoder.LogstashEncoder" />
                </appender>
                <root level="INFO">
                    <appender-ref ref="logstash" />
                </root>
            </configuration>
        c.运行应用
            部署并运行应用,确保日志能够正确发送到Logstash并被处理

06.docker-maven-plugin:docker管理
    a.介绍
        docker-maven-plugin是一个用于将应用打包成Docker镜像的Maven插件
        它可以在Maven构建过程中自动构建Docker镜像,并将其推送到Docker仓库
    b.功能
        自动化构建:在 Maven 构建过程中自动构建 Docker 镜像
        镜像推送:支持将构建的 Docker 镜像推送到 Docker 仓库
        多阶段构建:支持多阶段构建,优化镜像大小和构建效率
        灵活配置:支持通过 Maven 配置文件灵活配置镜像构建过程
    c.使用
        a.添加 Maven 插件
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.spotify</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <version>1.2.2</version>
                        <configuration>
                            <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
                            <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
                            <resources>
                                <resource>
                                    <targetPath>/</targetPath>
                                    <directory>${project.build.directory}</directory>
                                    <include>${project.build.finalName}.jar</include>
                                </resource>
                            </resources>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        b.创建Dockerfile,位于src/main/docker
            FROM openjdk:11-jre-slim
            VOLUME /tmp
            ARG JAR_FILE=target/*.jar
            COPY ${JAR_FILE} app.jar
            ENTRYPOINT ["java","-jar","/app.jar"]
        c.构建
            mvn clean package docker:build
        d.推送
            mvn docker:push

07.flatten-maven-plugin:统一版本号
    a.父工程
        <?xml version="1.0" encoding="UTF-8"?>
        <project xmlns="http://maven.apache.org/POM/4.0.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <parent>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-parent</artifactId>
                <version>2.7.18</version>
            </parent>
            <groupId>com.xxx.project</groupId>
            <artifactId>xxx-parent</artifactId>
            <packaging>pom</packaging>
            <version>${revision}</version>
            <modules>
                <module>module1</module>
                <module>module2</module>
                <module>module3</module>
            </modules>

            <properties>
                <!-- globe version,if you can update the version for all project -->
                <revision>1.1.1</revision>
                <maven.compiler.source>8</maven.compiler.source>
                <maven.compiler.target>8</maven.compiler.target>
            </properties>
            <build>
                <plugins>
                    <!-- 添加flatten-maven-plugin插件 -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>flatten-maven-plugin</artifactId>
                        <version>1.3.0</version>
                        <inherited>true</inherited>
                        <executions>
                            <execution>
                                <id>flatten</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>flatten</goal>
                                </goals>
                                <configuration>
                                    <updatePomFile>true</updatePomFile>
                                    <flattenMode>resolveCiFriendliesOnly</flattenMode>
                                    <pomElements>
                                        <parent>expand</parent>
                                        <distributionManagement>remove</distributionManagement>
                                        <repositories>remove</repositories>
                                    </pomElements>
                                </configuration>
                            </execution>
                            <execution>
                                <id>flatten.clean</id>
                                <phase>clean</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </project>
    b.子工程
        <?xml version="1.0" encoding="UTF-8"?>
        <project xmlns="http://maven.apache.org/POM/4.0.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <parent>
                <artifactId>xxx-parent</artifactId>
                <groupId>com.xxx.project</groupId>
                <version>${revision}</version>
            </parent>
            <modelVersion>4.0.0</modelVersion>

            <artifactId>module3</artifactId>

            <properties>
                <maven.compiler.source>8</maven.compiler.source>
                <maven.compiler.target>8</maven.compiler.target>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.xxx.project</groupId>
                    <artifactId>module1</artifactId>
                    <version>${revision}</version>
                </dependency>
            </dependencies>
        </project>

08.maven-dependency-plugin:unpack
    a.介绍
        maven-dependency-plugin:unpack 是 Maven 中用于解压指定依赖包(artifacts)内容到特定目录的插件目标
        与 copy 目标不同,unpack 会将 jar/war/zip 等压缩包的内容解压出来,而不是简单复制文件
        主要用于提取依赖包中的资源文件、配置文件、前端资源(webjars)等场景
        支持精确的文件过滤、权限控制、编码设置等高级功能
        -----------------------------------------------------------------------------------------------------
        unpack vs copy 的区别:
        copy:仅复制 jar 文件本身到目标目录,保持原有文件格式
        unpack:解压 jar 内容,提取其中的文件和目录结构,可进行文件级别的筛选和处理
        unpack-dependencies:解压项目的所有依赖(包括传递依赖)
        unpack:解压指定的特定依赖包列表
    b.基本配置与使用
        <!--解压特定依赖包-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.8.1</version>
            <executions>
                <execution>
                    <id>unpack</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.webjars</groupId>
                                <artifactId>bootstrap</artifactId>
                                <version>5.2.0</version>
                                <type>jar</type>
                                <outputDirectory>${project.build.directory}/web-resources</outputDirectory>
                                <!--包含文件模式,支持通配符-->
                                <includes>**/*.js,**/*.css</includes>
                                <!--排除文件模式,优先级高于includes-->
                                <excludes>**/*.min.js,**/*.map</excludes>
                                <!--是否覆盖已存在文件-->
                                <overWrite>true</overWrite>
                                <!--指定文件编码-->
                                <encoding>UTF-8</encoding>
                            </artifactItem>
                        </artifactItems>
                        <!--全局输出目录,artifactItem中可单独覆盖-->
                        <outputDirectory>${project.build.directory}/extracted</outputDirectory>
                        <!--全局包含模式-->
                        <includes>**/*.properties,**/*.xml</includes>
                        <!--全局排除模式-->
                        <excludes>**/*.class</excludes>
                        <!--覆盖发布版本-->
                        <overWriteReleases>false</overWriteReleases>
                        <!--覆盖快照版本-->
                        <overWriteSnapshots>true</overWriteSnapshots>
                        <!--只有更新时才覆盖-->
                        <overWriteIfNewer>true</overWriteIfNewer>
                        <!--标记文件目录-->
                        <markersDirectory>${project.build.directory}/dependency-maven-plugin-markers</markersDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    c.解压所有项目依赖(unpack-dependencies)
        <!--解压项目的所有依赖包-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.8.1</version>
            <executions>
                <execution>
                    <id>unpack-dependencies</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>unpack-dependencies</goal>
                    </goals>
                    <configuration>
                        <!--输出目录-->
                        <outputDirectory>${project.build.directory}/all-dependencies</outputDirectory>
                        <!--包含的依赖范围-->
                        <includeScope>runtime</includeScope>
                        <!--排除的依赖范围-->
                        <excludeScope>test</excludeScope>
                        <!--包含的组ID-->
                        <includeGroupIds>org.springframework,org.apache.commons</includeGroupIds>
                        <!--排除的组ID-->
                        <excludeGroupIds>junit,org.mockito</excludeGroupIds>
                        <!--包含的构件ID-->
                        <includeArtifactIds>spring-core,commons-lang3</includeArtifactIds>
                        <!--排除的构件ID-->
                        <excludeArtifactIds>spring-test</excludeArtifactIds>
                        <!--包含的分类器-->
                        <includeClassifiers>sources</includeClassifiers>
                        <!--排除的分类器-->
                        <excludeClassifiers>javadoc</excludeClassifiers>
                        <!--包含的类型-->
                        <includeTypes>jar</includeTypes>
                        <!--排除的类型-->
                        <excludeTypes>pom</excludeTypes>
                        <!--是否排除传递依赖-->
                        <excludeTransitive>false</excludeTransitive>
                        <!--文件包含模式-->
                        <includes>**/*.properties,**/*.xml,**/*.yml</includes>
                        <!--文件排除模式-->
                        <excludes>**/*.class,**/*.jar</excludes>
                        <!--文件编码-->
                        <encoding>UTF-8</encoding>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    d.前端资源处理(webjars场景)
        <!--处理前端webjars依赖,提取CSS、JS等资源-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.8.1</version>
            <executions>
                <execution>
                    <id>unpack-webjars</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>unpack-dependencies</goal>
                    </goals>
                    <configuration>
                        <!--只处理webjars组的依赖-->
                        <includeGroupIds>org.webjars</includeGroupIds>
                        <!--只提取前端资源文件-->
                        <includes>**/*.js,**/*.css,**/*.map,**/*.woff,**/*.woff2,**/*.ttf</includes>
                        <!--排除压缩文件和源映射文件-->
                        <excludes>**/*.min.js,**/*.min.css</excludes>
                        <!--输出到静态资源目录-->
                        <outputDirectory>${project.build.directory}/classes/static</outputDirectory>
                        <overWriteIfNewer>true</overWriteIfNewer>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <!--配合maven-antrun-plugin进行后处理-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
                <execution>
                    <id>flatten-webjars</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target>
                            <!--将嵌套目录结构扁平化到统一目录-->
                            <copy todir="${project.build.directory}/classes/static/js" flatten="true">
                                <fileset dir="${project.build.directory}/classes/static">
                                    <include name="**/*.js"/>
                                </fileset>
                            </copy>
                            <copy todir="${project.build.directory}/classes/static/css" flatten="true">
                                <fileset dir="${project.build.directory}/classes/static">
                                    <include name="**/*.css"/>
                                </fileset>
                            </copy>
                        </target>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    e.配置文件和模板提取
        <!--从依赖包中提取配置文件和模板-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.8.1</version>
            <executions>
                <execution>
                    <id>unpack-configs</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>com.company</groupId>
                                <artifactId>config-templates</artifactId>
                                <version>1.0.0</version>
                                <classifier>resources</classifier>
                                <type>zip</type>
                                <!--解压配置文件到config目录-->
                                <outputDirectory>${project.build.directory}/config</outputDirectory>
                                <includes>**/*.properties,**/*.yml,**/*.xml</includes>
                                <excludes>**/*test*</excludes>
                            </artifactItem>
                            <artifactItem>
                                <groupId>com.company</groupId>
                                <artifactId>script-templates</artifactId>
                                <version>2.0.0</version>
                                <type>tar.gz</type>
                                <!--解压脚本文件到scripts目录-->
                                <outputDirectory>${project.build.directory}/scripts</outputDirectory>
                                <includes>**/*.sh,**/*.bat,**/*.cmd</includes>
                            </artifactItem>
                        </artifactItems>
                        <!--使用JVM chmod提高性能-->
                        <useJvmChmod>true</useJvmChmod>
                        <!--忽略权限设置(Windows兼容)-->
                        <ignorePermissions>false</ignorePermissions>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    f.高级配置选项
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.8.1</version>
            <executions>
                <execution>
                    <id>advanced-unpack</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>com.example</groupId>
                                <artifactId>data-package</artifactId>
                                <version>1.0.0</version>
                                <outputDirectory>${project.build.directory}/data</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                        <!--文件映射器,用于重写目标路径-->
                        <fileMappers>
                            <mapper implementation="org.codehaus.plexus.components.io.filemappers.FlattenFileMapper"/>
                        </fileMappers>
                        <!--本地仓库路径覆盖-->
                        <localRepositoryDirectory>${project.build.directory}/local-repo</localRepositoryDirectory>
                        <!--输出绝对路径的构件文件名-->
                        <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
                        <!--静默模式,减少日志输出-->
                        <silent>false</silent>
                        <!--跳过执行-->
                        <skip>false</skip>
                        <!--使用JVM chmod(Unix/Linux性能优化)-->
                        <useJvmChmod>true</useJvmChmod>
                        <!--忽略文件权限(跨平台兼容性)-->
                        <ignorePermissions>false</ignorePermissions>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    g.Spring Boot应用场景
        <!--在Spring Boot项目中解压依赖资源-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.8.1</version>
            <executions>
                <execution>
                    <id>unpack-spring-resources</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>unpack-dependencies</goal>
                    </goals>
                    <configuration>
                        <!--解压到Spring Boot的资源目录-->
                        <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        <!--包含特定组的依赖-->
                        <includeGroupIds>org.springframework</includeGroupIds>
                        <!--只提取配置和资源文件-->
                        <includes>**/*.properties,**/*.yml,**/*.xml,**/*.factories</includes>
                        <!--排除Java类文件-->
                        <excludes>**/*.class</excludes>
                        <!--包含运行时范围-->
                        <includeScope>runtime</includeScope>
                        <!--排除测试依赖-->
                        <excludeScope>test</excludeScope>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <!--结合Spring Boot Maven插件-->
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <!--配置需要在运行时解压的库-->
                <requiresUnpack>
                    <dependency>
                        <groupId>org.jruby</groupId>
                        <artifactId>jruby-complete</artifactId>
                    </dependency>
                </requiresUnpack>
            </configuration>
        </plugin>
    h.命令行使用
        从命令行直接执行unpack目标:
        mvn dependency:unpack -Dartifact=groupId:artifactId:version:packaging:classifier -DoutputDirectory=target/extracted
        示例:
        mvn dependency:unpack -Dartifact=org.apache.commons:commons-lang3:3.12.0:jar -DoutputDirectory=target/commons-lang3
        -----------------------------------------------------------------------------------------------------
        解压所有依赖:
        mvn dependency:unpack-dependencies -DoutputDirectory=target/all-deps -Dincludes=**/*.properties
        注意:命令行使用时不能与<executions>配置同时使用,需要将配置放在<configuration>标签直接下级
    i.常见问题与解决方案
        问题1:Eclipse/IDE中执行失败,提示"The source must not be a directory"
        解决:这是因为IDE的工作空间依赖解析导致的,可以:
        - 使用命令行执行maven构建
        - 在IDE中禁用工作空间依赖解析
        - 将插件执行phase设置为package之后
        -----------------------------------------------------------------------------------------------------
        问题2:文件权限问题,特别是在Windows/Cygwin环境下
        解决:配置以下参数:
        <useJvmChmod>true</useJvmChmod>
        <ignorePermissions>true</ignorePermissions>

        或使用maven-antrun-plugin进行后处理:
        <target>
            <chmod perm="755" type="file">
                <fileset dir="${project.build.directory}/extracted"/>
            </chmod>
        </target>
        -----------------------------------------------------------------------------------------------------
        问题3:插件配置不生效,仍使用默认行为
        解决:确保配置不在<pluginManagement>中,而是在<plugins>中:
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <!-- 配置放在这里 -->
                </plugin>
            </plugins>
        </build>
        -----------------------------------------------------------------------------------------------------
        问题4:Spring Boot应用无法加载解压的依赖
        解决:确保解压的类文件路径正确,或使用spring-boot-maven-plugin的requiresUnpack配置
        -----------------------------------------------------------------------------------------------------
        问题5:性能问题,解压大量文件时速度慢
        解决:启用JVM chmod,减少fork进程调用:
        <useJvmChmod>true</useJvmChmod>
        或者使用并行构建:mvn -T 4 package
    j.最佳实践
        1.选择合适的phase:
        - generate-resources:生成资源文件阶段,适合大多数解压需求
        - process-resources:处理资源文件阶段,适合需要后续处理的场景
        - prepare-package:打包准备阶段,适合打包前的最终处理
        -----------------------------------------------------------------------------------------------------
        2.合理使用includes/excludes:
        - excludes优先级高于includes
        - 使用通配符提高灵活性:**/*.js, **/*.css
        - 考虑性能,避免解压不需要的文件
        -----------------------------------------------------------------------------------------------------
        3.目录结构规划:
        - 将解压内容放在${project.build.directory}下避免污染源码
        - 为不同类型资源创建不同子目录
        - 考虑与其他插件的协作
        -----------------------------------------------------------------------------------------------------
        4.跨平台兼容:
        - 启用useJvmChmod提高性能
        - 根据需要设置ignorePermissions
        - 注意文件编码设置
        -----------------------------------------------------------------------------------------------------
        5.与其他插件协作:
        - maven-resources-plugin:处理资源复制
        - maven-antrun-plugin:进行复杂的文件操作
        - spring-boot-maven-plugin:Spring Boot应用打包
        -----------------------------------------------------------------------------------------------------
        6.版本管理:
        - 使用最新稳定版本的插件
        - 在dependencyManagement中统一管理版本
        - 注意向后兼容性
        -----------------------------------------------------------------------------------------------------
        执行命令:mvn clean package
        执行特定目标:mvn dependency:unpack
        跳过执行:mvn package -Ddependency.skip=true
        调试模式:mvn dependency:unpack -X

2.8 packing3

00.工作准备
    a.文件
        jeecg文件夹
        jeecg_origin文件夹
        jeecg_v1文件夹
        static文件夹
        templates文件夹
        rbanner.txt
        logback-spring.xml
        logback-spring-bak.xml
        application.yml
        application-dev.yml
        application-prod.yml
    b.提问
        打算使用maven-shade-plugin来制作jar包。
        我希望,
        第1点:排除掉resources的如下文件:
        application.yml
        application-dev.yml
        application-prod.yml
        第2点:保留resources的如下文件:
        jeecg文件夹
        jeecg_origin文件夹
        jeecg_v1文件夹
        static文件夹
        templates文件夹
        rbanner.txt
        logback-spring.xml
        logback-spring-bak.xml
        第3点:可以独立启动
        同时可以使用application.yml来覆盖文件
    b.配置
        将ydsz-module-system安装到本地仓库:
        mvn install:install-file \
        -Dfile=lib/ydsz-module-system-1.0.0.jar \
        -DgroupId=cn.jggroup \
        -DartifactId=ydsz-module-system \
        -Dversion=1.0.0 \
        -Dpackaging=jar
        -----------------------------------------------------------------------------------------------------
        根项目 pom.xml:
        移除了错误的parent配置
        将system scope的依赖移到dependencies中
        保留了原有的构建配置
        -----------------------------------------------------------------------------------------------------
        ydsz-module-app/pom.xml:
        配置为最终的可执行jar
        添加了spring-boot-maven-plugin配置
        依赖了demo和demo2模块
        -----------------------------------------------------------------------------------------------------
        ydsz-module-demo/pom.xml:
        简化为普通依赖jar
        只保留source插件用于生成源码jar
        移除了不必要的打包配置
        -----------------------------------------------------------------------------------------------------
        ydsz-module-demo2/pom.xml:
        同样简化为普通依赖jar
        保留了资源文件配置
        移除了多余的插件配置
    c.报错
        这部分的作用是:
        显式声明对ydsz-module-system的依赖
        确保编译时能找到ydsz-module-system的类
        确保运行时能加载ydsz-module-system的类
        Maven也会从本地仓库(.m2)中查找这个依赖jar
        -----------------------------------------------------------------------------------------------------
        当前存在的问题:
        重复引用:同一个jar既作为parent又作为dependency
        parent要求是pom类型,但当前是jar类型
        这种配置可能导致类加载和依赖管理的混乱
        -----------------------------------------------------------------------------------------------------
        建议的解决方案:
        如果ydsz-module-system主要是提供类库,应该只作为dependency
        如果ydsz-module-system主要是提供配置,应该打包成pom类型,只作为parent
        如果两者都需要,应该将其拆分为两个模块:
        ydsz-boot-parent (pom类型),根目录的pom
        ydsz-module-system(jar类型)
        ydsz-module-code(jar类型)
    c.报错
        [INFO] Scanning for projects...
        [ERROR] [ERROR] Some problems were encountered while processing the POMs:
        [ERROR] Invalid packaging for parent POM cn.jggroup:ydsz-module-system:1.0.0, must be "pom" but is "jar" @ cn.jggroup:ydsz-module-system:1.0.0
         @
        [ERROR] The build could not read 1 project -> [Help 1]
        [ERROR]
        [ERROR]   The project cn.jggroup:ydsz-boot-example:1.0.0 (D:\software_ware\99.Directory99\vilgoboot\ydsz-boot-example\pom.xml) has 1 error
        [ERROR]     Invalid packaging for parent POM cn.jggroup:ydsz-module-system:1.0.0, must be "pom" but is "jar" @ cn.jggroup:ydsz-module-system:1.0.0
        [ERROR]
        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
        [ERROR]
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
        -----------------------------------------------------------------------------------------------------
        错误信息解读:
        Invalid packaging for parent POM cn.jggroup:ydsz-module-system:1.0.0, must be "pom" but is "jar"
        Maven要求parent必须是pom类型
        但我们的ydsz-module-system是jar类型
        这是因为我们之前用mvn install:install-file安装时,使用的是jar包
        -----------------------------------------------------------------------------------------------------
        之前的操作回顾:
        # 我们之前可能是这样安装的
        mvn install:install-file -Dfile=ydsz-module-system.jar -DgroupId=cn.jggroup -DartifactId=ydsz-module-system -Dversion=1.0.0 -Dpackaging=jar
        这个命令将jar包安装到了本地仓库
        -----------------------------------------------------------------------------------------------------
        解决思路:
        需要创建一个pom文件,包含所有配置信息
        将这个pom文件安装到本地仓库
        jar包改为普通依赖引入
        -----------------------------------------------------------------------------------------------------
        具体步骤应该是:
        a.从原jar中提取配置信息,创建parent pom
        mvn install:install-file -Dfile=ydsz-module-system-parent.pom -DgroupId=cn.jggroup -DartifactId=ydsz-module-system-parent -Dversion=1.0.0 -Dpackaging=pom
        b.安装parent pom到本地仓库:
        mvn install:install-file -Dfile=ydsz-module-system-parent.pom -DgroupId=cn.jggroup -DartifactId=ydsz-module-system-parent -Dversion=1.0.0 -Dpackaging=pom
        c.安装core jar到本地仓库:
        mvn install:install-file -Dfile=ydsz-module-system.jar -DgroupId=cn.jggroup -DartifactId=ydsz-module-system-core -Dversion=1.0.0 -Dpackaging=jar
        -----------------------------------------------------------------------------------------------------
        修改项目pom文件,使用正确的parent和dependency
        你觉得这个分析和解决思路合理吗?需要我详细说明哪部分?

01.springboot项目打jar包,并排除相关配置文件
    a.方案1
        spring-boot-maven-plugin可以打包,服务也可以正常启动,但是无法排除相应的配置文件;
        maven-jar-plugin也可以的打包,但是排除文件后层级目录不对,jar包无法启动,因此需要两者结合使用
        -----------------------------------------------------------------------------------------------------
        <build>
          <resources>
                <resource>
                    <filtering>true</filtering>
                    <directory>src/main/resources</directory>
                    <excludes>
                        <exclude>**/application*.yml</exclude>
                        <exclude>**/application*.yaml</exclude>
                        <exclude>**/application*.properties</exclude>
                    </excludes>
                </resource>
                <resource>
                    <filtering>true</filtering>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>**/application.properties</include>
                        <include>**/application-${profiles.active}.properties</include>
                        <include>**/application.yml</include>
                        <include>**/application-${profiles.active}.yml</include>
                    </includes>
                </resource>
            </resources>

            <plugins>
               <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
               <plugin>
                    <!-- spingboot自带打包插件 -->
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>2.1.2.RELEASE</version>
                </plugin>
                <plugin>
                    <!-- maven打包插件 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                    <!-- 排除配置文件,排除的文件放在服务器和jar包同级目录的config目录下,服务启动会自带加载-->
                    <configuration>
                        <excludes>
                            <exclude>*.yml</exclude>
                            <exclude>*.properties</exclude>
                        </excludes>
                    </configuration>
                </plugin>

                <!-- 打包时不包含测试文件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.4.2</version>
                    <configuration>
                        <skipTests>true</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
            </plugins>
        </build>
    b.方案2
        <build>
            <finalName>${project.artifactId}</finalName>
            <plugins>
                <!--打包跳过测试类-->
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <skipTests>true</skipTests>
                    </configuration>
                </plugin>
                <!--<plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <includeSystemScope>true</includeSystemScope>
                        <mainClass>com.irobot.robotdev.RobotDevApplication</mainClass>
                        <includes>
                            <!– 设置没有jar包–>
                            <include>
                                <groupId>nothing</groupId>
                                <artifactId>nothing</artifactId>
                            </include>
                        </includes>
                    </configuration>
                </plugin>-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                                <!--MANIFEST.MF 中 Class-Path 加入前缀!
                                用命令java -jar运行jar时就不用-Dloader.path指定外部资源路径了-->
                                <classpathPrefix>lib/</classpathPrefix>
                                <!--jar包名字是否包含唯一版本标识-->
                                <useUniqueVersions>false</useUniqueVersions>
                                <!--指定含main方法的主类入口-->
                                <mainClass>com.irobot.robotdev.RobotDevApplication</mainClass>
                            </manifest>
                            <manifestEntries>
                                <!--MANIFEST.MF 中 Class-Path 加入资源文件目录!
                                用命令java -jar时就不用-Dloader.path指定外部资源路径了 -->
                                <Class-Path>resources/</Class-Path>
                            </manifestEntries>
                        </archive>
                        <!-- 打包时从jar包里排除资源文件 -->
                        <excludes>
                            <exclude>*.yml</exclude>
                            <exclude>*.properties</exclude>
                            <exclude>mapper/*.xml</exclude>
                        </excludes>
                        <!-- 指定项目打成jar包输出位置 -->
                        <outputDirectory>${project.build.directory}/</outputDirectory>
                    </configuration>
                </plugin>
                <!-- 将三方库jar单独拷贝至lib目录 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>copy-lib</id>
                            <phase>package</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>target/lib</outputDirectory>
                                <excludeTransitive>false</excludeTransitive>
                                <stripVersion>false</stripVersion>
                                <includeScope>runtime</includeScope>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>

            <!-- 资源配置 -->
            <resources>
                <resource>
                    <directory>src/main/java</directory>
                    <includes>
                        <include>**/*.properties</include>
                        <include>**/*.xml</include>
                    </includes>
                    <filtering>true</filtering>
                </resource>
                <!-- 剔除项目中的配置文件 -->
                <resource>
                    <directory>src/main/resources</directory>
                    <excludes>
                        <exclude>**/*.xml</exclude>
                        <exclude>**/*.yml</exclude>
                        <exclude>**/*.properties</exclude>
                        <exclude>**/*.sh</exclude>
                        <!--<exclude>**/*.sql</exclude>-->
                        <exclude>**/*.txt</exclude>
                    </excludes>
                    <filtering>true</filtering>
                </resource>
            </resources>
        </build>

02.插件:maven-shade-plugin
    a.YdszEnvironmentPostProcessor
        package cn.jggroup.system.config;

        import org.springframework.boot.SpringApplication;
        import org.springframework.boot.env.EnvironmentPostProcessor;
        import org.springframework.core.env.ConfigurableEnvironment;
        import org.springframework.core.env.PropertiesPropertySource;
        import org.springframework.core.io.ClassPathResource;
        import org.springframework.core.io.Resource;

        import java.io.IOException;
        import java.util.Properties;

        /**
         * 环境配置后处理器
         * 用于在Spring Boot启动时处理环境配置
         */
        public class YdszEnvironmentPostProcessor implements EnvironmentPostProcessor {

            @Override
            public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
                // 添加默认配置
                Properties defaultProps = new Properties();
                defaultProps.setProperty("spring.main.allow-bean-definition-overriding", "true");
                defaultProps.setProperty("spring.main.allow-circular-references", "true");

                // 如果环境中没有设置这些属性,使用默认值
                if (!environment.containsProperty("server.port")) {
                    defaultProps.setProperty("server.port", "9994");
                }
                if (!environment.containsProperty("server.servlet.context-path")) {
                    defaultProps.setProperty("server.servlet.context-path", "/ydsz-boot");
                }

                // 添加到环境中,优先级最低,允许被覆盖
                PropertiesPropertySource propertySource = new PropertiesPropertySource("ydszDefaultProperties", defaultProps);
                environment.getPropertySources().addLast(propertySource);

                try {
                    // 尝试加载自定义配置文件
                    Resource resource = new ClassPathResource("ydsz-config.properties");
                    if (resource.exists()) {
                        Properties customProps = new Properties();
                        customProps.load(resource.getInputStream());
                        environment.getPropertySources().addLast(
                            new PropertiesPropertySource("ydszCustomProperties", customProps)
                        );
                    }
                } catch (IOException e) {
                    // 忽略加载失败的情况
                }
            }
        }
    b.方案1:ydsz-module-system(废弃)
          <packaging>jar</packaging>
          <name>ydsz-module-system</name>
          <description>System module that can be used as a starter</description>
          -----------------------------------------------------------------------------------------------------
          <build>
            <finalName>ydsz-module-system</finalName>
            <plugins>
              <!-- Compiler Plugin -->
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
                  <encoding>UTF-8</encoding>
                </configuration>
              </plugin>

              <!-- Shade Plugin for creating uber jar -->
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                  <execution>
                    <phase>package</phase>
                    <goals>
                      <goal>shade</goal>
                    </goals>
                    <configuration>
                      <createDependencyReducedPom>true</createDependencyReducedPom>
                      <minimizeJar>false</minimizeJar>
                      <filters>
                        <filter>
                          <artifact>*:*</artifact>
                          <excludes>
                            <exclude>META-INF/*.SF</exclude>
                            <exclude>META-INF/*.DSA</exclude>
                            <exclude>META-INF/*.RSA</exclude>
                          </excludes>
                        </filter>
                      </filters>
                      <transformers>
                        <!-- Spring配置文件合并 -->
                        <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                          <resource>META-INF/spring.handlers</resource>
                        </transformer>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                          <resource>META-INF/spring.schemas</resource>
                        </transformer>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                          <resource>META-INF/spring.factories</resource>
                        </transformer>
                        <!-- 合并 Services -->
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                        <!-- 合并 spring.provides -->
                        <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                          <resource>META-INF/spring.provides</resource>
                        </transformer>
                        <!-- 合并 spring-autoconfigure-metadata.properties -->
                        <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                          <resource>META-INF/spring-autoconfigure-metadata.properties</resource>
                        </transformer>
                      </transformers>
                      <artifactSet>
                        <includes>
                          <include>*:*</include>
                        </includes>
                        <excludes>
                          <exclude>org.springframework.boot:spring-boot-loader</exclude>
                          <exclude>junit:junit</exclude>
                          <exclude>org.mockito:*</exclude>
                          <exclude>org.hamcrest:*</exclude>
                        </excludes>
                      </artifactSet>
                      <relocations>
                        <relocation>
                          <pattern>org.apache.commons</pattern>
                          <shadedPattern>ydsz.shaded.org.apache.commons</shadedPattern>
                        </relocation>
                      </relocations>
                    </configuration>
                  </execution>
                </executions>
              </plugin>

              <!-- Source Plugin -->
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                  <execution>
                    <id>attach-sources</id>
                    <goals>
                      <goal>jar-no-fork</goal>
                    </goals>
                  </execution>
                </executions>
              </plugin>
            </plugins>

            <resources>
              <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <excludes>
                  <exclude>application*.yml</exclude>
                  <exclude>application*.properties</exclude>
                </excludes>
              </resource>
              <resource>
                <directory>src/main/java</directory>
                <includes>
                  <include>**/*.xml</include>
                  <include>**/*.json</include>
                  <include>**/*.ftl</include>
                </includes>
              </resource>
            </resources>
          </build>
          -------------------------------------------------------------------------------------------------
          <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-shade-plugin</artifactId>
           <version>2.4.1</version>
           <executions>
               <execution>
               <!--配置goal-shade绑定到phase-package 上 会在 target 文件生成一个以 -shaded.jar 为后缀的 jar 包-->
                   <phase>package</phase>
                   <goals>
                      <goal>shade</goal>
                   </goals>
                   <configuration>
                    <artifactSet>
                      <excludes>
                      <!--配置该工程依赖的部分 Jar 包 include/exclude 掉。-->
                        <exclude>classworlds:classworlds</exclude>
                        <exclude>junit:junit</exclude>
                      </excludes>
                    </artifactSet>
                    <!--配置依赖的某个 Jar 包内部的类或者资源 include/exclude 掉。-->
                     <filters>
                      <filter>
                        <artifact>junit:junit</artifact>
                        <includes>
                          <include>junit/framework/</include>
                          <include>org/junit/</include>
                        </includes>
                        <excludes>
                          <exclude>org/junit/experimental/</exclude>
                          <exclude>org/junit/runners/</exclude>
                        </excludes>
                      </filter>
                     </filters>
                     <!--配置将所有不使用的类全部排除掉,将 jar 最小化-->
                     <minimizeJar>true</minimizeJar>
                     <!--配置 MainClass 创建一个可执行 Jar 包。-->
                      <transformers>
                          <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <mainClass>org.sonatype.haven.HavenCli</mainClass>
                          </transformer>
                      </transformers>
                      <!-- 配置解决jar或类的多版本冲突 在打包的时候把类重命名-->
                      <relocations>
                          <relocation>
                            <pattern>org.codehaus.plexus.util</pattern>
                            <shadedPattern>org.shaded.plexus.util</shadedPattern>
                            <excludes>
                              <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
                              <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
                            </excludes>
                          </relocation>
                    </relocations>
                  </configuration>
               </execution>
           </executions>
          </plugin>
    c.方案2:ydsz-module-system(废弃)
        <build>
        <finalName>ydsz-module-system</finalName>
        <plugins>
          <!-- Compiler Plugin -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <encoding>UTF-8</encoding>
            </configuration>
          </plugin>

          <!-- Shade Plugin for creating uber jar -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <createDependencyReducedPom>true</createDependencyReducedPom>
                  <filters>
                    <filter>
                      <artifact>*:*</artifact>
                      <excludes>
                        <exclude>META-INF/*.SF</exclude>
                        <exclude>META-INF/*.DSA</exclude>
                        <exclude>META-INF/*.RSA</exclude>
                      </excludes>
                    </filter>
                  </filters>
                  <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                      <mainClass>cn.jggroup.YdszSystemApplication</mainClass>
                    </transformer>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
                      <resource>.SF</resource>
                      <resource>.DSA</resource>
                      <resource>.RSA</resource>
                    </transformer>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                      <resource>META-INF/spring.handlers</resource>
                    </transformer>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                      <resource>META-INF/spring.schemas</resource>
                    </transformer>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                      <resource>META-INF/spring.factories</resource>
                    </transformer>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                  </transformers>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.6.6</version>
              </dependency>
            </dependencies>
          </plugin>

          <!-- Source Plugin -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Spring Boot Maven Plugin -->
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.6.6</version>
            <executions>
              <execution>
                <goals>
                  <goal>repackage</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>

        <resources>
          <!-- 处理需要过滤的资源文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <excludes>
              <!-- 排除配置文件 -->
              <exclude>application*.yml</exclude>
              <!-- 排除二进制文件 -->
              <exclude>**/*.ttf</exclude>
              <exclude>**/*.woff</exclude>
              <exclude>**/*.woff2</exclude>
              <!-- 排除不需要过滤的目录和文件 -->
              <exclude>jeecg/**</exclude>
              <exclude>jeecg_origin/**</exclude>
              <exclude>jeecg_v1/**</exclude>
              <exclude>static/**</exclude>
              <exclude>templates/**</exclude>
              <exclude>banner.txt</exclude>
              <exclude>logback-spring*.xml</exclude>
            </excludes>
          </resource>

          <!-- 处理不需要过滤的资源文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <filtering>false</filtering>
            <includes>
              <!-- 包含二进制文件 -->
              <include>**/*.ttf</include>
              <include>**/*.woff</include>
              <include>**/*.woff2</include>
              <!-- 包含特定目录和文件 -->
              <include>jeecg/**</include>
              <include>jeecg_origin/**</include>
              <include>jeecg_v1/**</include>
              <include>static/**</include>
              <include>templates/**</include>
              <include>banner.txt</include>
              <include>logback-spring*.xml</include>
              <!-- 包含配置文件 -->
              <include>application*.yml</include>
            </includes>
          </resource>

          <!-- 处理 Java 源码目录下的资源文件 -->
          <resource>
            <directory>src/main/java</directory>
            <includes>
              <include>**/*.xml</include>
              <include>**/*.json</include>
              <include>**/*.ftl</include>
            </includes>
          </resource>
        </resources>
        </build>
    d.方案3:ydsz-module-system(废弃)
        <build>
        <!-- 指定构建的最终文件名,使用项目版本号 -->
        <finalName>${project.artifactId}-${project.version}</finalName>
        <!-- 资源文件配置 -->
        <resources>
          <!-- 1.Java目录下的资源文件 -->
          <resource>
            <directory>src/main/java</directory>
            <filtering>false</filtering>
            <includes>
              <include>**/*.xml</include>
              <include>**/*.json</include>
              <include>**/*.ftl</include>
            </includes>
          </resource>
          <!-- 2.resources目录下的资源文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
          </resource>
        </resources>
        <plugins>
          <!-- maven-shade-plugin:生成可依赖的独立jar包 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.5.1</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <createDependencyReducedPom>true</createDependencyReducedPom>
                  <!-- 生成带所有依赖的jar包 -->
                  <shadedArtifactAttached>true</shadedArtifactAttached>
                  <shadedClassifierName>original</shadedClassifierName>
                  <!-- 包含 optional 和 provided 依赖 -->
                  <includeScope>runtime</includeScope>
                  <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
                  <!-- 排除签名相关文件 -->
                  <filters>
                    <filter>
                      <artifact>*:*</artifact>
                      <excludes>
                        <exclude>META-INF/*.SF</exclude>
                        <exclude>META-INF/*.DSA</exclude>
                        <exclude>META-INF/*.RSA</exclude>
                      </excludes>
                    </filter>
                  </filters>
                  <!-- 处理资源文件 -->
                  <transformers>
                    <!-- 处理 spring.factories -->
                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                      <resource>META-INF/spring.factories</resource>
                    </transformer>
                    <!-- 处理 spring.handlers -->
                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                      <resource>META-INF/spring.handlers</resource>
                    </transformer>
                    <!-- 处理 spring.schemas -->
                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                      <resource>META-INF/spring.schemas</resource>
                    </transformer>
                    <!-- 处理 META-INF/services -->
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                  </transformers>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- maven-compiler-plugin:可以被依赖的jar包,如xxx-module-xxx-1.0.0.jar -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <encoding>UTF-8</encoding>
            </configuration>
          </plugin>
          <!-- maven-source-plugin:用于生成源码的jar包,如xxx-module-xxx-1.0.0-sources.jar -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <!-- 创建源码 jar -->
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- maven-surefire-plugin:打包跳过测试 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.2</version>
            <configuration>
              <skipTests>true</skipTests>
            </configuration>
          </plugin>
          <!-- maven-resources-plugin:资源文件配置 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
              <encoding>UTF-8</encoding>
              <useDefaultDelimiters>true</useDefaultDelimiters>
              <!-- 字体文件不过滤 -->
              <nonFilteredFileExtensions>
                <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                <nonFilteredFileExtension>svg</nonFilteredFileExtension>
              </nonFilteredFileExtensions>
            </configuration>
          </plugin>
        </plugins>
        </build>
        -----------------------------------------------------------------------------------------------------
        <?xml version="1.0" encoding="UTF-8"?>
        <project xmlns="http://maven.apache.org/POM/4.0.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>

            <!-- 你的项目坐标 -->
            <groupId>com.your.group</groupId>
            <artifactId>your-project</artifactId>
            <version>1.0.0</version>

            <properties>
                <maven.compiler.source>8</maven.compiler.source>
                <maven.compiler.target>8</maven.compiler.target>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            </properties>

            <dependencies>
                <!-- 引入二次开发包 -->
                <dependency>
                    <groupId>cn.jggroup</groupId>
                    <artifactId>ydsz-module-system-depend</artifactId>
                    <version>1.0.0</version>
                    <classifier>original</classifier>
                    <scope>system</scope>
                    <systemPath>${project.basedir}/lib/ydsz-module-system-depend-1.0.0-original.jar</systemPath>
                </dependency>

                <!-- 你的项目其他依赖 -->
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                    <version>2.6.6</version>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <!-- 编译插件 -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.8.1</version>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                            <encoding>UTF-8</encoding>
                        </configuration>
                    </plugin>

                    <!-- 打包时包含系统范围的依赖 -->
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <version>2.6.6</version>
                        <configuration>
                            <includeSystemScope>true</includeSystemScope>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </project>
        -----------------------------------------------------------------------------------------------------
        DruidConfig#removeDruidAdFilter:
           Did not match:
              - @ConditionalOnProperty (spring.datasource.druid.stat-view-servlet.enabled=true) did not find property 'spring.datasource.druid.stat-view-servlet.enabled' (OnPropertyCondition)
           Matched:
              - @ConditionalOnWebApplication (required) found 'session' scope (OnWebApplicationCondition)
        Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1799)
        我查阅了相关资料,这个问题主要是 Shade Plugin 打包后,Spring Boot 的自动配置和条件注解无法正常工作。
        从以下资源收集的信息:
        Maven Shade Plugin 文档:https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html
        Spring Boot Issue:https://github.com/spring-projects/spring-boot/issues/1828
        Shiro Redis Issue:https://github.com/alexxiyang/shiro-redis/issues/113
        主要问题:
        Spring Boot 的条件注解(@ConditionalOnXXX)依赖于特定的资源文件
        Shiro Redis 需要 LettuceConnectionFactory,但自动配置未生效
        一些第三方依赖的类加载问题(如 freemarker, jaxen 等)
        -----------------------------------------------------------------------------------------------------
    e.方案4:ydsz-module-system(废弃)
        版本分析:
        3.5.1 (最新版,2023-09)
        有一些配置格式变更
        存在一些兼容性问题
        对 Spring Boot 支持不够稳定
        3.2.4 (稳定版,2020-01)
        广泛使用的稳定版本
        与 Spring Boot 2.x 配合良好
        配置格式更宽松
        许多开源项目在用这个版本
        3.3.0 (2021-03)
        引入了一些新特性
        修复了一些 bug
        但也引入了一些新问题
        建议:使用 3.2.4 版本,原因:
        稳定性已经得到验证
        与 Spring Boot 2.6.x 兼容性好
        社区反馈问题较少
        -----------------------------------------------------------------------------------------------------
        <!-- maven-shade-plugin:生成可依赖的独立jar包 -->
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>true</createDependencyReducedPom>
              <!-- 生成带所有依赖的jar包 -->
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>original</shadedClassifierName>
              <!-- 包含所有依赖 -->
              <createSourcesJar>true</createSourcesJar>
              <!-- 资源文件过滤 -->
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
              <!-- 资源转换器 -->
              <transformers>
                <!-- Spring 配置文件 -->
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/spring.handlers</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/spring.schemas</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>META-INF/spring.factories</resource>
                </transformer>
                <!-- 服务发现 -->
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                <!-- 主清单 -->
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <manifestEntries>
                    <Main-Class>cn.jggroup.SystemDependApplication</Main-Class>
                    <Build-Number>${project.version}</Build-Number>
                  </manifestEntries>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
        </plugin>
    f.方案5:ydsz-module-system(启用,最简单配置方案)
        版本分析:
        3.5.1 (最新版,2023-09)
        有一些配置格式变更
        存在一些兼容性问题
        对 Spring Boot 支持不够稳定
        3.2.4 (稳定版,2020-01)
        广泛使用的稳定版本
        与 Spring Boot 2.x 配合良好
        配置格式更宽松
        许多开源项目在用这个版本
        3.3.0 (2021-03)
        引入了一些新特性
        修复了一些 bug
        但也引入了一些新问题
        建议:使用 3.2.4 版本,原因:
        稳定性已经得到验证
        与 Spring Boot 2.6.x 兼容性好
        社区反馈问题较少
        -----------------------------------------------------------------------------------------------------
        <project>
            ...
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.2.4</version>
                        <configuration>
                            <!-- 此处按需编写更具体的配置 -->
                        </configuration>
                        <executions>
                            <execution>
                                <!-- 和 package 阶段绑定 -->
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            ...
        </project>

03.插件:spring-boot-maven-plugin
    a.介绍
        是的,spring-boot-maven-plugin 完全可以满足打包全量 jar 的需求。我的思路是:
        -----------------------------------------------------------------------------------------------------
        对于 Spring Boot 项目,spring-boot-maven-plugin 是最佳选择,因为:
        它会自动处理所有依赖
        会正确处理 Spring Boot 的特殊文件(如 spring.factories)
        会自动配置 manifest 文件
        支持可执行 jar 包的生成
        -----------------------------------------------------------------------------------------------------
        当前配置中同时使用了 maven-shade-plugin 和 spring-boot-maven-plugin,这是重复的:
        两个插件都在尝试创建可执行 jar
        可能会导致冲突或覆盖问题
        -----------------------------------------------------------------------------------------------------
        建议的修改方案:
        移除 maven-shade-plugin 配置
        保留并优化 spring-boot-maven-plugin 配置
        确保正确配置 mainClass
    b.配置1:普通的jar包
        <build>
        <plugins>
          <!-- spring-boot-maven-plugin:能够将springboot项目打包为可执行的jar/war -->
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.6.6</version>
            <configuration>
              <includeSystemScope>true</includeSystemScope>
            </configuration>
          </plugin>
          <!-- maven-compiler-plugin:指定JDK编译版本 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <encoding>UTF-8</encoding>
            </configuration>
          </plugin>
          <!-- maven-surefire-plugin:打包跳过测试 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.2</version>
            <configuration>
              <skipTests>true</skipTests>
            </configuration>
          </plugin>
          <!-- maven-resources-plugin:避免font文件的二进制文件格式压缩破坏 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
              <encoding>UTF-8</encoding>
              <useDefaultDelimiters>true</useDefaultDelimiters>
              <nonFilteredFileExtensions>
                <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                <nonFilteredFileExtension>svg</nonFilteredFileExtension>
              </nonFilteredFileExtensions>
            </configuration>
          </plugin>
        </plugins>
        <!-- 全局资源配置 -->
        <resources>
          <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
          </resource>
          <resource>
            <directory>src/main/java</directory>
            <includes>
              <include>**/*.xml</include>
              <include>**/*.json</include>
              <include>**/*.ftl</include>
            </includes>
          </resource>
        </resources>
        </build>
    c.配置2:可运行jar包(带lib)
        <build>
        <!-- 指定构建的最终文件名,使用项目版本号 -->
        <finalName>${project.artifactId}-${project.version}</finalName>
        <plugins>
          <!-- Java 编译器插件:用于编译 Java 源代码 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
              <!-- 源代码使用的 JDK 版本 -->
              <source>1.8</source>
              <!-- 生成的字节码的版本 -->
              <target>1.8</target>
              <!-- 源文件编码 -->
              <encoding>UTF-8</encoding>
            </configuration>
          </plugin>

          <!-- Spring Boot 打包插件:用于创建可执行的 jar 包 -->
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.6.6</version>
            <configuration>
              <!--允许本地的lib的jar包-->
              <includeSystemScope>true</includeSystemScope>
              <!-- 指定主类 -->
              <mainClass>cn.jggroup.YdszSystemApplication</mainClass>
              <!-- 指定打包方式为 JAR -->
              <layout>JAR</layout>
              <!-- 包含系统范围的依赖 -->
              <includeSystemScope>true</includeSystemScope>
              <!-- 生成的 jar 可直接执行 -->
              <executable>true</executable>
              <!-- 排除开发工具依赖 -->
              <excludeDevtools>true</excludeDevtools>
              <!-- 指定需要解压的依赖,通常用于加密的 jar -->
              <requiresUnpack>
                <dependency>
                  <groupId>org.jeecgframework.boot</groupId>
                  <artifactId>codegenerate</artifactId>
                </dependency>
                <dependency>
                  <groupId>org.jeecgframework.jimureport</groupId>
                  <artifactId>jimureport-spring-boot-starter</artifactId>
                </dependency>
              </requiresUnpack>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <!-- 重新打包,将依赖打入 jar 包 -->
                  <goal>repackage</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- 源码插件:用于生成源码 jar 包 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <!-- 创建源码 jar -->
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>

        <!-- 资源文件配置 -->
        <resources>
          <!-- 需要进行变量替换的资源文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <!-- 启用变量替换 -->
            <filtering>true</filtering>
            <excludes>
              <!-- 排除所有环境的配置文件 -->
              <exclude>application*.yml</exclude>
              <!-- 排除二进制文件,避免过滤损坏文件 -->
              <exclude>**/*.ttf</exclude>
              <exclude>**/*.woff</exclude>
              <exclude>**/*.woff2</exclude>
              <!-- 排除静态资源和模板文件 -->
              <exclude>jeecg/**</exclude>
              <exclude>jeecg_origin/**</exclude>
              <exclude>jeecg_v1/**</exclude>
              <exclude>static/**</exclude>
              <exclude>templates/**</exclude>
              <exclude>banner.txt</exclude>
              <exclude>logback-spring*.xml</exclude>
            </excludes>
          </resource>

          <!-- 不需要进行变量替换的资源文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <!-- 禁用变量替换 -->
            <filtering>false</filtering>
            <includes>
              <!-- 包含二进制文件 -->
              <include>**/*.ttf</include>
              <include>**/*.woff</include>
              <include>**/*.woff2</include>
              <!-- 包含静态资源和配置文件 -->
              <include>jeecg/**</include>
              <include>jeecg_origin/**</include>
              <include>jeecg_v1/**</include>
              <include>static/**</include>
              <include>templates/**</include>
              <include>banner.txt</include>
              <include>logback-spring*.xml</include>
              <include>application*.yml</include>
            </includes>
          </resource>

          <!-- Java 源码目录下的资源文件 -->
          <resource>
            <directory>src/main/java</directory>
            <includes>
              <!-- MyBatis 映射文件 -->
              <!-- JSON 配置文件 -->
              <!-- Freemarker 模板文件 -->
              <include>**/*.xml</include>
              <include>**/*.json</include>
              <include>**/*.ftl</include>
            </includes>
          </resource>
        </resources>
        </build>
    d.配置3:可运行jar包(带lib)、可依赖jar包(不带lib,必须带pom)
        <build>
        <!-- 指定构建的最终文件名,使用项目版本号 -->
        <finalName>${project.artifactId}-${project.version}</finalName>
        <plugins>
          <!-- Java 编译器插件:用于编译 Java 源代码 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
              <!-- 源代码使用的 JDK 版本 -->
              <source>1.8</source>
              <!-- 生成的字节码的版本 -->
              <target>1.8</target>
              <!-- 源文件编码 -->
              <encoding>UTF-8</encoding>
            </configuration>
          </plugin>

          <!-- Spring Boot 打包插件:用于创建可执行的 jar 包 -->
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.6.6</version>
            <configuration>
              <!--允许本地的lib的jar包-->
              <includeSystemScope>true</includeSystemScope>
              <!-- 指定主类 -->
              <mainClass>cn.jggroup.YdszSystemApplication</mainClass>
              <!-- 指定打包方式为 JAR -->
              <layout>JAR</layout>
              <!-- 包含系统范围的依赖 -->
              <includeSystemScope>true</includeSystemScope>
              <!-- 生成的 jar 可直接执行 -->
              <executable>true</executable>
              <!-- 排除开发工具依赖 -->
              <excludeDevtools>true</excludeDevtools>
              <!-- 添加classifier:生成可执行jar包、可依赖jar包 -->
              <classifier>exec</classifier>
              <!-- 指定需要解压的依赖,通常用于加密的 jar -->
              <requiresUnpack>
                <dependency>
                  <groupId>org.jeecgframework.boot</groupId>
                  <artifactId>codegenerate</artifactId>
                </dependency>
                <dependency>
                  <groupId>org.jeecgframework.jimureport</groupId>
                  <artifactId>jimureport-spring-boot-starter</artifactId>
                </dependency>
              </requiresUnpack>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <!-- 重新打包,将依赖打入 jar 包 -->
                  <goal>repackage</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- 源码插件:用于生成源码 jar 包 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <!-- 创建源码 jar -->
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>

        <!-- 资源文件配置 -->
        <resources>
          <!-- 需要进行变量替换的资源文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <!-- 启用变量替换 -->
            <filtering>true</filtering>
            <excludes>
              <!-- 排除所有环境的配置文件 -->
              <exclude>application*.yml</exclude>
              <!-- 排除二进制文件,避免过滤损坏文件 -->
              <exclude>**/*.ttf</exclude>
              <exclude>**/*.woff</exclude>
              <exclude>**/*.woff2</exclude>
              <!-- 排除静态资源和模板文件 -->
              <exclude>jeecg/**</exclude>
              <exclude>jeecg_origin/**</exclude>
              <exclude>jeecg_v1/**</exclude>
              <exclude>static/**</exclude>
              <exclude>templates/**</exclude>
              <exclude>banner.txt</exclude>
              <exclude>logback-spring*.xml</exclude>
            </excludes>
          </resource>

          <!-- 不需要进行变量替换的资源文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <!-- 禁用变量替换 -->
            <filtering>false</filtering>
            <includes>
              <!-- 包含二进制文件 -->
              <include>**/*.ttf</include>
              <include>**/*.woff</include>
              <include>**/*.woff2</include>
              <!-- 包含静态资源和配置文件 -->
              <include>jeecg/**</include>
              <include>jeecg_origin/**</include>
              <include>jeecg_v1/**</include>
              <include>static/**</include>
              <include>templates/**</include>
              <include>banner.txt</include>
              <include>logback-spring*.xml</include>
              <include>application*.yml</include>
            </includes>
          </resource>

          <!-- Java 源码目录下的资源文件 -->
          <resource>
            <directory>src/main/java</directory>
            <includes>
              <!-- MyBatis 映射文件 -->
              <!-- JSON 配置文件 -->
              <!-- Freemarker 模板文件 -->
              <include>**/*.xml</include>
              <include>**/*.json</include>
              <include>**/*.ftl</include>
            </includes>
          </resource>
        </resources>
        </build>
    e.配置4:可运行jar包(带lib)、可依赖jar包(不带lib,必须带pom),排除项目的yml配置
        <build>
        <!-- 指定构建的最终文件名,使用项目版本号 -->
        <finalName>${project.artifactId}-${project.version}</finalName>
        <plugins>
          <!-- Java 编译器插件:用于编译 Java 源代码 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
              <!-- 源代码使用的 JDK 版本 -->
              <source>1.8</source>
              <!-- 生成的字节码的版本 -->
              <target>1.8</target>
              <!-- 源文件编码 -->
              <encoding>UTF-8</encoding>
            </configuration>
          </plugin>

          <!-- Spring Boot 打包插件:用于创建可执行的 jar 包 -->
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.6.6</version>
            <configuration>
              <!--允许本地的lib的jar包-->
              <includeSystemScope>true</includeSystemScope>
              <!-- 指定主类 -->
              <mainClass>cn.jggroup.SystemApplication</mainClass>
              <!-- 指定打包方式为 JAR -->
              <layout>JAR</layout>
              <!-- 包含系统范围的依赖 -->
              <includeSystemScope>true</includeSystemScope>
              <!-- 生成的 jar 可直接执行 -->
              <executable>true</executable>
              <!-- 排除开发工具依赖 -->
              <excludeDevtools>true</excludeDevtools>
              <!-- 添加classifier:生成可执行jar包、可依赖jar包 -->
              <classifier>exec</classifier>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <!-- 重新打包,将依赖打入 jar 包 -->
                  <goal>repackage</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- 源码插件:用于生成源码 jar 包 -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <!-- 创建源码 jar -->
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>

        <!-- 资源文件配置 -->
        <resources>
          <!-- 需要进行变量替换的资源文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <!-- 启用变量替换 -->
            <filtering>true</filtering>
            <excludes>
              <!-- 排除所有环境的配置文件 -->
              <exclude>application*.yml</exclude>
              <!-- 排除二进制文件,避免过滤损坏文件 -->
              <exclude>**/*.ttf</exclude>
              <exclude>**/*.woff</exclude>
              <exclude>**/*.woff2</exclude>
              <!-- 排除静态资源和模板文件 -->
              <exclude>static/**</exclude>
              <exclude>templates/**</exclude>
              <exclude>banner.txt</exclude>
              <exclude>logback-spring*.xml</exclude>
            </excludes>
          </resource>

          <!-- 不需要进行变量替换的资源文件,但需要打包的文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <!-- 禁用变量替换 -->
            <filtering>false</filtering>
            <includes>
              <!-- 包含二进制文件 -->
              <include>**/*.ttf</include>
              <include>**/*.woff</include>
              <include>**/*.woff2</include>
              <!-- 包含静态资源和配置文件 -->
              <include>static/**</include>
              <include>templates/**</include>
              <include>banner.txt</include>
              <include>logback-spring*.xml</include>
            </includes>
            <!--排除项目的yml配置-->
            <excludes>
              <exclude>**/*.yml</exclude>
              <exclude>**/*.yaml</exclude>
            </excludes>
          </resource>

          <!-- Java 源码目录下的资源文件 -->
          <resource>
            <directory>src/main/java</directory>
            <includes>
              <include>**/*.xml</include>
              <include>**/*.json</include>
              <include>**/*.ftl</include>
            </includes>
          </resource>
        </resources>
        </build>
    f.配置5:
        参考ydsz-boot-parent
    g.配置说明
        a.spring-boot-maven-plugin:可执行jar/war,如xxx-module-xxx-1.0.0-exec.jar
            <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
              <version>2.6.6</version>
              <configuration>
                <!--允许本地的lib的jar包-->
                <includeSystemScope>true</includeSystemScope>
                <!-- 指定主类 -->
                <mainClass>cn.jggroup.SystemApplication</mainClass>
                <!-- 指定打包方式为 JAR -->
                <layout>JAR</layout>
                <!-- 生成的 jar 可直接执行 -->
                <executable>true</executable>
                <!-- 排除开发工具依赖 -->
                <excludeDevtools>true</excludeDevtools>
                <!-- 添加classifier:生成可执行jar包、可依赖jar包 -->
                <classifier>exec</classifier>
              </configuration>
              <executions>
                <execution>
                  <goals>
                    <!-- 重新打包,将依赖打入 jar 包 -->
                    <goal>repackage</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            这个配置 哪行可以将 全部依赖打入这个jar包
            -------------------------------------------------------------------------------------------------
            <goal>repackage</goal> - 这是最关键的配置,它会:
            重新打包原始的 jar 文件
            将所有依赖项添加到 jar 包中
            创建一个可执行的 jar 文件
            -------------------------------------------------------------------------------------------------
            <layout>JAR</layout> - 指定打包方式为 JAR,确保生成标准的 jar 包格式
            但是,我注意到一个重要的问题:
            <classifier>exec</classifier> 这个配置会生成一个带有 -exec 后缀的 jar 包
            这意味着会生成两个 jar 包:
            一个普通的 jar(不包含依赖)
            一个带 -exec 后缀的可执行 jar(包含所有依赖)
            -------------------------------------------------------------------------------------------------
            如果你想要只生成一个包含所有依赖的 jar 包,可以移除 <classifier>exec</classifier> 配置行。
            这样 repackage 就会直接覆盖原始的 jar 包,而不是生成额外的文件。
        b.maven-source-plugin:用于生成源码的jar包,如xxx-module-xxx-1.0.0-sources.jar
            <!-- maven-source-plugin:用于生成源码的jar包,如xxx-module-xxx-1.0.0-sources.jar -->
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-source-plugin</artifactId>
              <version>3.2.1</version>
              <executions>
                <execution>
                  <id>attach-sources</id>
                  <goals>
                    <!-- 创建源码 jar -->
                    <goal>jar-no-fork</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            -------------------------------------------------------------------------------------------------
            <execution>定义了一个插件执行任务,可以在 Maven 生命周期的不同阶段执行
            <id>attach-sources</id>:给这个执行任务一个唯一的标识符,"attach-sources" 表示这个任务是用来附加源码的,这个 ID 让 Maven 能够识别并管理这个特定的执行任务
            <goals>:定义这个执行任务要完成的目标,一个执行任务可以有多个目标
            <goal>jar-no-fork</goal>:指定具体的目标是 "jar-no-fork","jar-no-fork" 表示直接打包源码,不创建新的构建过程,与 "jar" 目标相比,"jar-no-fork" 更高效,因为它不会创建新的构建分支
        c.resources:配置资源
            <!-- 1.Java源码目录下的资源文件 -->
            <resource>
              <directory>src/main/java</directory>
              <filtering>false</filtering>
              <includes>
                <include>**/*.xml</include>
                <include>**/*.json</include>
                <include>**/*.ftl</include>
              </includes>
            </resource>
            -------------------------------------------------------------------------------------------------
            filtering=false:
            直接复制文件,不进行任何变量替换
            文件会原样保留,适用于:
            二进制文件(如图片、字体)
            不需要变量替换的模板文件
            固定的配置文件
            性能更好,因为不需要解析文件内容
            -------------------------------------------------------------------------------------------------
            filtering=true:
            会处理文件中的变量表达式,如:
            ${project.version}
            ${project.name}
            ${profile.active}
            -------------------------------------------------------------------------------------------------
            默认情况下,Maven 中 <resource> 的 filtering 默认值是 false
        d.在父模块的 build 标签中,子模块继承行为如下:
            a.<pluginManagement> 部分:
                不会被直接继承,而是作为插件的默认配置
                子模块需要在自己的 pom 中声明插件(不需要版本和配置)才会使用这些配置
                子模块可以覆盖这些配置
            b.<resources>部分:
                会被子模块完全继承
                包括所有的资源处理配置:
                 <!-- 需要进行变量替换的资源文件 -->
                 <resource>
                   <directory>src/main/resources</directory>
                   <filtering>true</filtering>
                   <excludes>...</excludes>
                 </resource>
                 <!-- 不需要变量替换的资源文件 -->
                 <resource>
                   <directory>src/main/resources</directory>
                   <filtering>false</filtering>
                   <includes>...</includes>
                   <excludes>...</excludes>
                 </resource>
                 <!-- Java 源码目录下的资源文件 -->
                 <resource>
                   <directory>src/main/java</directory>
                   <includes>...</includes>
                 </resource>
            c.如果子模块需要:
                使用父模块定义的插件:需要在子模块中声明插件(不需要版本号和配置)
                <plugin>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                ---------------------------------------------------------------------------------------------
                覆盖资源配置:在子模块中定义自己的 <resources> 配置
                <build>
                  <resources>
                    <!-- 子模块自己的资源配置 -->
                  </resources>
                </build>
            d.总结
                <pluginManagement> 是插件的默认配置,需要子模块声明才会使用
                <resources> 会被自动继承,除非子模块覆盖

04.ydsz-boot-starter-final
    a.项目结构
        ydsz-boot-starter-final (项目根目录)
        ├── pom.xml (ydsz-boot-parent, packaging: pom)
        │   - groupId: cn.jggroup
        │   - artifactId: ydsz-boot-parent
        │   - version: 1.0.0
        │   - packaging: pom
        │
        ├── ydsz-module-system (jar类型)
        │   └── pom.xml
        │       - parent: ydsz-boot-parent
        │       - packaging: jar
        │
        └── ydsz-module-code (jar类型)
            └── pom.xml
                - parent: ydsz-boot-parent
                - packaging: jar
    b.打包整个项目
        a.安装父POM到本地仓库
            # 在项目根目录执行,-N 参数表示不递归构建子模块,只安装父POM。
            mvn clean install -N
        b.安装整个项目(包括父POM和所有子模块)
            # 在项目根目录执行
            # 若始终不生效配置,比如排除yml配置文件。IDEA -> 文件 -> 使缓存失效
            mvn clean install
            -------------------------------------------------------------------------------------------------
            [INFO] ydsz-module-code                                                   [jar]
            [INFO] ydsz-boot-parent                                                   [pom]
            [INFO] ydsz-module-jimu                                                   [jar]
            [INFO] ydsz-module-autopoi                                                [jar]
            [INFO] ydsz-module-jeewx                                                  [jar]
            [INFO] ydsz-module-common                                                 [jar]
            [INFO] ydsz-module-ejia                                                   [jar]
            [INFO] ydsz-module-system                                                 [jar]
            -------------------------------------------------------------------------------------------------
            这会安装:
            ydsz-boot-parent (pom)
            ydsz-module-code (jar)
            ydsz-module-jimu (jar)
            ydsz-module-system (jar)
            -------------------------------------------------------------------------------------------------
            或者手动安装,顺序如下:
            ydsz-module-jeewx
            ydsz-module-autopoi
            ydsz-module-common
            ydsz-module-ejia
            ydsz-module-system
            ydsz-module-code
            ydsz-module-jimu
        c.其他项目如何使用
            a.使用父POM
                <parent>
                    <groupId>cn.jggroup</groupId>
                    <artifactId>ydsz-boot-parent</artifactId>
                    <version>1.0.0</version>
                </parent>
            b.使用jar包
                <dependency>
                    <groupId>cn.jggroup</groupId>
                    <artifactId>ydsz-module-system</artifactId>
                    <version>1.0.0</version>
                </dependency>
                <dependency>
                    <groupId>cn.jggroup</groupId>
                    <artifactId>ydsz-module-code</artifactId>
                    <version>1.0.0</version>
                </dependency>
            c.查看安装结果
                安装后,文件会出现在本地Maven仓库中:
                {USER_HOME}/.m2/repository/cn/jggroup/
                ├── ydsz-boot-parent/1.0.0/
                │   └── ydsz-boot-parent-1.0.0.pom
                ├── ydsz-module-system/1.0.0/
                │   ├── ydsz-module-system-1.0.0.jar
                │   └── ydsz-module-system-1.0.0.pom
                └── ydsz-module-code/1.0.0/
                    ├── ydsz-module-code-1.0.0.jar
                    └── ydsz-module-code-1.0.0.pom
    c.打包某个模块(废弃)
        a.首先确保在项目根目录,需要按顺序打包
            # 切换到项目根目录
            cd D:\software_yare\ydsz-boot-starter\ydsz-boot-starter_1.1.0
            # 安装父模块,这里的-N参数表示不递归构建子模块。
            mvn clean install -N -Dmaven.test.skip=true
        b.然后安装common模块
            # 切换到common模块目录
            cd ydsz-module-common
            # 安装common模块
            mvn clean install -Dmaven.test.skip=true
        c.接着安装system模块
            # 切换到system模块目录
            cd ydsz-module-system
            # 安装system模块
            mvn clean package -Dmaven.test.skip=true
        d.打包结果
            这三个jar包的作用和运行方式如下:
            1. ydsz-module-system.jar
            这是主要的jar包,包含了所有编译后的类文件和依赖
            作为starter使用时,其他项目只需要引入这个jar包
            original-ydsz-module-system.jar
            这是原始的jar包,不包含依赖
            通常不需要使用这个文件
            ydsz-module-system-sources.jar
            这是源码jar包,包含了源代码
            用于IDE查看源码,不用于运行
    d.对于Vite打包的前端项目集成到SpringBoot
        a.路由问题
            Vite 项目通常使用前端路由(Vue Router/React Router)
            需要配置后端将所有前端路由请求都转发到 index.html
            简单的静态资源映射无法处理这种情况
        b.资源路径问题
            Vite 打包后的资源使用绝对路径或相对路径
            需要确保资源路径与 Spring Boot 的 context-path 匹配
            静态资源的访问需要特殊处理
        c.代理和跨域问题
            前端 API 请求需要正确代理到后端服务
            开发环境和生产环境的配置可能不同
        d.比较好的解决方案是:
            使用 Nginx 方案(推荐):
            前端项目单独部署
            通过 Nginx 进行反向代理和路由控制
            更清晰的职责分离,更好的可维护性
            -------------------------------------------------------------------------------------------------
            如果一定要集成到 Spring Boot:
            需要自定义 WebMvcConfigurer
            配置特殊的资源处理器
            添加路由转发规则
        e.配置拦截器
            @Configuration
            public class WebConfig implements WebMvcConfigurer {
                @Resource
                private TokenInterceptor tokenInterceptor ;
                public void addInterceptors(InterceptorRegistry registry) {
                    registry.addInterceptor(tokenInterceptor).addPathPatterns("/**");
                }
                @Override
                public void addViewControllers(ViewControllerRegistry registry) {
                    // 将根路径 "/" 的请求重定向到 "/index.html"
                    registry.addViewController("/").setViewName("forward:/index.html");
                    WebMvcConfigurer.super.addViewControllers(registry);
                }

                @Override
                public void addResourceHandlers(ResourceHandlerRegistry registry) {
                    // 添加资源处理器,用于映射静态资源路径
                    registry.addResourceHandler("/**").addResourceLocations("classpath:/dist/");
                    WebMvcConfigurer.super.addResourceHandlers(registry);
                }
            }
        f.配置拦截器
            @Configuration
            public class WebMvcConfig implements WebMvcConfigurer {

                @Override
                public void addResourceHandlers(ResourceHandlerRegistry registry) {
                    // 处理静态资源,按优先级顺序配置
                    registry.addResourceHandler("/**")
                            .addResourceLocations("classpath:/dist/")  // Vite构建产物优先
                            .addResourceLocations("classpath:/static/")
                            .addResourceLocations("classpath:/public/");

                    WebMvcConfigurer.super.addResourceHandlers(registry);
                }

                @Override
                public void addViewControllers(ViewControllerRegistry registry) {
                    // 根路径转发到index.html
                    registry.addViewController("/").setViewName("forward:/index.html");
                    // 除了api和静态资源外的所有请求都转发到index.html
                    registry.addViewController("/{x:^(?!api|static|public|dist|ydszboot).*}/**").setViewName("forward:/index.html");

                    WebMvcConfigurer.super.addViewControllers(registry);
                }
            }
    e.生成jar包
        a.区别
            a.ydsz-module-system-1.0.0.jar
                <!-- maven-compiler-plugin:指定JDK编译版本 -->
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>3.8.1</version>
                  <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                  </configuration>
                </plugin>
                ---------------------------------------------------------------------------------------------
                生成 ydsz-module-system-1.0.0.jar
                这个插件负责编译 Java 源代码
                生成标准的项目 jar 包
                设置了 Java 编译版本和编码
                ---------------------------------------------------------------------------------------------
                这是标准的项目 jar 包
                包含编译后的 class 文件
                包含项目的资源文件(除了 yml 配置文件)
                可以被其他项目作为依赖引用
                不包含第三方依赖库
                不可以直接运行
            b.ydsz-module-system-1.0.0-exec.jar
                <!-- spring-boot-maven-plugin:能够将springboot项目打包为可执行的jar/war -->
                <plugin>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-maven-plugin</artifactId>
                  <version>2.6.6</version>
                  <configuration>
                    <includeSystemScope>true</includeSystemScope>
                  </configuration>
                </plugin>
                ---------------------------------------------------------------------------------------------
                生成 ydsz-module-system-1.0.0-exec.jar
                这个插件会重新打包 Spring Boot 应用,创建一个可执行的 jar
                包含所有依赖和 Spring Boot Loader 类
                通过 repackage 目标将原始 jar 重新打包成可执行格式
                ---------------------------------------------------------------------------------------------
                这是可执行的 jar 包(由 spring-boot-maven-plugin 的 repackage 目标生成)
                包含所有运行时需要的依赖
                包含 Spring Boot Loader 相关的类
                可以直接通过 java -jar 命令运行
                体积较大,因为包含了所有依赖
                不适合被其他项目依赖使用
                配置文件(yml)需要外部提供
            c.ydsz-module-system-1.0.0-sources.jar
                <!-- 源码插件:用于生成源码 jar 包 -->
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-source-plugin</artifactId>
                  <version>3.2.1</version>
                  <executions>
                    <execution>
                      <id>attach-sources</id>
                      <goals>
                        <!-- 创建源码 jar -->
                        <goal>jar-no-fork</goal>
                      </goals>
                    </execution>
                  </executions>
                </plugin>
                ---------------------------------------------------------------------------------------------
                生成 ydsz-module-system-1.0.0-sources.jar
                这个插件专门用于打包源代码
                通过 jar-no-fork 目标创建源码 jar
                包含所有的 Java 源文件
                ---------------------------------------------------------------------------------------------
                这是源码 jar 包(由 maven-source-plugin 生成)
                包含项目的所有源代码(.java 文件)
                主要用于开发时查看依赖库的源码
                IDE 可以自动下载和关联这个源码包
                不包含编译后的文件
                不可以直接运行
                主要用于开发调试和文档目的
            d.使用场景
                如果您要将这个模块作为依赖给其他项目使用,使用 ydsz-module-system-1.0.0.jar
                如果您要部署运行这个应用,使用 ydsz-module-system-1.0.0-exec.jar
                如果您需要查看源码或调试,使用 ydsz-module-system-1.0.0-sources.jar
        b.ydsz-module-system-1.0.0-exec.jar 是一个独立的可执行 jar 包
            a.jar包外部的配置文件:
                ./config/application.yml (当前目录的 config 子目录)
                ./application.yml (当前目录)
            b.jar包内部的配置文件:
                classpath:/config/application.yml
                classpath:/application.yml
            c.当前
                方式1:在 jar 包同级目录下放置 application.ym
                方式2:在 jar 包同级目录的 config 子目录下放置 application.yml
                方式3:java -jar ydsz-module-system-1.0.0-exec.jar --spring.config.location=file:./custom-config.yml

95.安装本地jar包
    a.语法
        mvn install:install-file -DgroupId=<groupId> -DartifactId=<artifactId> -Dversion=<version> -Dpackaging=jar -Dfile=<jar文件的路径>
    b.示例
        mvn install:install-file -DgroupId=com.shr -DartifactId=osfws -Dversion=0.1.0 -Dpackaging=jar -Dfile=D:\shr-osfws-0.1.0.jar
        -----------------------------------------------------------------------------------------------------
        C:\Users\mysla>mvn install:install-file -DgroupId=com.shr -DartifactId=osfws -Dversion=0.1.0 -Dpackaging=jar -Dfile=D:\shr-osfws-0.1.0.jar
        [INFO] Scanning for projects...
        [INFO]
        [INFO] ------------------< org.apache.maven:standalone-pom >-------------------
        [INFO] Building Maven Stub Project (No POM) 1
        [INFO] --------------------------------[ pom ]---------------------------------
        [INFO]
        [INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
        [INFO] Installing D:\shr-osfws-0.1.0.jar to C:\Users\mysla\.m2\repository\com\shr\osfws\0.1.0\osfws-0.1.0.jar
        [INFO] Installing C:\Windows\TEMP\mvninstall990315928206513900.pom to C:\Users\mysla\.m2\repository\com\shr\osfws\0.1.0\osfws-0.1.0.pom
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD SUCCESS
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time:  1.365 s
        [INFO] Finished at: 2025-01-28T08:53:42+08:00
        [INFO] ------------------------------------------------------------------------
    c.安装后在 pom.xml 中使用:
        <dependency>
            <groupId>com.shr</groupId>
            <artifactId>osfws</artifactId>
            <version>0.1.0</version>
        </dependency>
    d.打包后jar包不生效
        ydsz-module-system-depend-1.0.0.jar -> 右键 -> 从磁盘重新加载

96.profiles资源
    a.说明
        在Maven中,<profiles>标签用于定义构建配置的不同环境或场景。通过使用profiles,
        您可以在同一个项目中为不同的环境(如开发、测试、生产等)配置不同的依赖、插件、属性等。
        这样可以使得构建过程更加灵活和可定制。
    b.定义和激活
        <profiles>标签包含一个或多个<profile>子标签,每个<profile>定义了一组特定的配置。
        可以通过命令行参数、环境变量或POM文件中的特定条件来激活某个profile。
    c.示例结构
        <profiles>
            <profile>
                <id>development</id>
                <properties>
                    <env>dev</env>
                </properties>
                <dependencies>
                    <dependency>
                        <groupId>com.example</groupId>
                        <artifactId>dev-library</artifactId>
                        <version>1.0</version>
                    </dependency>
                </dependencies>
            </profile>
            <profile>
                <id>production</id>
                <properties>
                    <env>prod</env>
                </properties>
                <dependencies>
                    <dependency>
                        <groupId>com.example</groupId>
                        <artifactId>prod-library</artifactId>
                        <version>1.0</version>
                    </dependency>
                </dependencies>
            </profile>
        </profiles>
    d.激活方式
        通过命令行:使用-P参数激活特定的profile。例如:mvn clean install -Pdevelopment。
        通过环境变量:可以在<activation>部分定义环境变量的条件。
        通过系统属性:可以根据系统属性的值来激活profile。
        通过文件存在性:可以根据某个文件是否存在来激活profile。
    e.应用场景:
        在开发和生产环境中使用不同的依赖。
        根据不同的构建目标配置不同的插件。
        设置不同的属性或配置文件。
    f.配置文件
        <profiles>
        <profile>
          <id>ydsz</id>
          <build>
            <plugins>
              <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
                  <encoding>UTF-8</encoding>
                </configuration>
              </plugin>
              <!-- Source -->
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                  <execution>
                    <phase>package</phase>
                    <goals>
                      <goal>jar-no-fork</goal>
                    </goals>
                  </execution>
                </executions>
              </plugin>
            </plugins>
          </build>
        </profile>
        <profile>
          <id>release</id>
          <build>
            <plugins>
              <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
                  <encoding>UTF-8</encoding>
                </configuration>
              </plugin>
              <!-- Source -->
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                  <execution>
                    <phase>package</phase>
                    <goals>
                      <goal>jar-no-fork</goal>
                    </goals>
                  </execution>
                </executions>
              </plugin>
              <!-- Javadoc -->
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <executions>
                  <execution>
                    <phase>package</phase>
                    <goals>
                      <goal>jar</goal>
                    </goals>
                    <configuration>
                      <encoding>UTF-8</encoding>
                      <additionalparam>-Xdoclint:none</additionalparam>
                    </configuration>
                  </execution>
                </executions>
              </plugin>
              <!--Maven GPG插件用于使用以下配置对组件进行签名-->
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <executions>
                  <execution>
                    <id>sign-artifacts</id>
                    <phase>verify</phase>
                    <goals>
                      <goal>sign</goal>
                    </goals>
                  </execution>
                </executions>
              </plugin>
              <!--Nexus Staging Maven插件是将组件部署到OSS并将其发布到Central Repository的推荐方法-->
              <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.7</version>
                <extensions>true</extensions>
                <configuration>
                  <serverId>oss</serverId>
                  <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                  <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
              </plugin>
            </plugins>
          </build>
          <distributionManagement>
            <snapshotRepository>
              <id>oss</id>
              <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            </snapshotRepository>
            <repository>
              <id>oss</id>
              <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
            </repository>
          </distributionManagement>
        </profile>
        </profiles>

97.resources资源
    a.说明
        踩坑:20250122,必须先exclude,再include,因为**/这样的配置会影响,所以得优先配置
    b.配置
        <!-- 资源文件配置 -->
        <resources>
          <!-- 1.Java目录下的资源文件 -->
          <resource>
            <directory>src/main/java</directory>
            <filtering>false</filtering>
            <includes>
              <include>**/*.xml</include>
              <include>**/*.json</include>
              <include>**/*.ftl</include>
            </includes>
          </resource>
          <!-- 2.resources目录下的资源文件 -->
          <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <excludes>
              <exclude>application.yml</exclude>
              <exclude>application-dev.yml</exclude>
              <exclude>application-prod.yml</exclude>
            </excludes>
            <includes>
              <include>**/*.properties</include>
              <include>**/*.xml</include>
              <include>**/*.ttf</include>
              <include>**/*.woff</include>
              <include>**/*.woff2</include>
              <include>static/**</include>
              <include>templates/**</include>
              <include>banner.txt</include>
              <include>logback-spring*.xml</include>
            </includes>
          </resource>
        </resources>
        -----------------------------------------------------------------------------------------------------
        filtering=true 虽然对所有匹配的文件生效,但:
        如果文件中没有需要替换的变量,不会有任何影响
        Maven 只会替换 ${...} 格式的变量占位符
        不会对普通文本内容造成任何改变
        -----------------------------------------------------------------------------------------------------
        经过查阅 Maven 官方文档和相关资料,我发现了问题所在:
        当前配置不生效的原因:
        Maven 资源处理是按顺序执行的
        只使用 <excludes> 而没有对应的 <includes> 是一个不完整的排除规则
        Maven 会使用默认的包含规则(包含所有文件),然后再应用排除规则
        这可能导致其他 resource 配置或默认行为覆盖了排除规则
    c.打包顺序
        Maven 的标准构建生命周期顺序是:
        resources:resources (处理资源)
        compiler:compile (编译)
        resources:testResources (处理测试资源)
        compiler:testCompile (编译测试)
        surefire:test (运行测试)
        jar:jar (打包)
        spring-boot:repackage (Spring Boot 重新打包)
        -----------------------------------------------------------------------------------------------------
        所以虽然在 pom.xml 中 resources 和 plugins 的顺序可以调换,但不会影响实际的执行顺序。
        Maven 会按照其生命周期的固定顺序来执行。
        不过,按照 Maven 的最佳实践,推荐的顺序是:
        <build>
            <finalName>...</finalName>
            <plugins>...</plugins>
            <resources>...</resources>
        </build>
        -----------------------------------------------------------------------------------------------------
        因为 plugins 是构建过程的主要控制者,
        而 resources 是被控制的对象,把 plugins 放在前面更符合逻辑顺序,也更容易阅读和维护。
    d.打包失败原因
        a.关键1
            所有模块都继承自 spring-boot-starter-parent,这意味着它们都会继承 Spring Boot 的默认资源处理机制。
        b.关键2
            Spring Boot 的资源处理机制有以下特点:
            默认会将 src/main/resources 下的所有文件打包到 jar 中
            使用 spring-boot-maven-plugin 的 repackage 目标重新打包时,会重新处理资源文件
        c.关键3
            目前的排除配置:
            <resource>
              <directory>src/main/resources</directory>
              <filtering>false</filtering>
              <excludes>
                <exclude>application*.yml</exclude>
              </excludes>
            </resource>
            这个配置只在 Maven 的资源复制阶段生效,但在 Spring Boot 重新打包时可能被覆盖
        d.解决方案1
            在 spring-boot-maven-plugin 中添加明确的排除配置:
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>*</groupId>
                            <artifactId>*</artifactId>
                            <classifier>*</classifier>
                        </exclude>
                    </excludes>
                    <excludeDevtools>true</excludeDevtools>
                    <layout>ZIP</layout>
                    <includes>
                        <include>
                            <groupId>nothing</groupId>
                            <artifactId>nothing</artifactId>
                        </include>
                    </includes>
                </configuration>
            </plugin>
        e.解决方案2
            尝试使用 Spring Boot 的配置方式:
            <build>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <excludes>
                            <exclude>**/application*.yml</exclude>
                        </excludes>
                        <filtering>false</filtering>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <configuration>
                            <environmentVariables>
                                <SPRING_CONFIG_LOCATION>file:./config/</SPRING_CONFIG_LOCATION>
                            </environmentVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        f.解决方案3
            最后一个方案是使用 Maven 的 assembly 插件来完全控制打包过程:
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>src/assembly/assembly.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>
        g.问题关键
            Maven 的资源处理和 Spring Boot 的打包是两个独立的过程
            Spring Boot 的 repackage 目标会重新处理资源,可能覆盖 Maven 的资源处理结果
            需要同时在这两个层面上配置排除规则
    e.打包过程
        a.安装父POM到本地仓库
            # 在项目根目录执行,-N 参数表示不递归构建子模块,只安装父POM。
            mvn clean install -N
        b.安装整个项目(包括父POM和所有子模块)
            # 在项目根目录执行
            # 若始终不生效配置,比如排除yml配置文件。IDEA -> 文件 -> 使缓存失效
            mvn clean install

98.maven运行jar包
    a.方案1 - 分离配置
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>3.1.0</version>
            <!-- 用于 mvn exec:exec 的配置 -->
            <configuration>
                <executable>java</executable>
                <arguments>
                    <argument>-Djeecg.path=${project.basedir}/lib/ydsz-module-code-standalone/config/jeecg</argument>
                    <argument>-Dspring.config.location=file:${project.basedir}/lib/ydsz-module-code-standalone/ydsz-module-code-standalone.yml</argument>
                    <argument>-jar</argument>
                    <argument>${project.basedir}/lib/ydsz-module-code-standalone/ydsz-module-code-standalone.jar</argument>
                </arguments>
            </configuration>
            <!-- 用于清理端口的配置 -->
            <executions>
                <execution>
                    <id>kill-port</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>cmd</executable>
                        <arguments>
                            <argument>/c</argument>
                            <argument>for /f "tokens=5" %a in ('netstat -aon ^| find ":9984"') do taskkill /F /PID %a</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    b.方案2 - 使用独立插件
        <!-- 用于端口清理 -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
                <execution>
                    <id>kill-port</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>cmd</executable>
                        <arguments>
                            <argument>/c</argument>
                            <argument>for /f "tokens=5" %a in ('netstat -aon ^| find ":9984"') do taskkill /F /PID %a</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <!-- 用于启动生成器 -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
                <executable>java</executable>
                <arguments>
                    <argument>-Djeecg.path=${project.basedir}/lib/ydsz-module-code-standalone/config/jeecg</argument>
                    <argument>-Dspring.config.location=file:${project.basedir}/lib/ydsz-module-code-standalone/ydsz-module-code-standalone.yml</argument>
                    <argument>-jar</argument>
                    <argument>${project.basedir}/lib/ydsz-module-code-standalone/ydsz-module-code-standalone.jar</argument>
                </arguments>
            </configuration>
        </plugin>
    c.方式3-使用cmd
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>3.1.0</version>
          <configuration>
            <executable>cmd</executable>
            <arguments>
              <argument>/c</argument>
              <argument>for /f "tokens=5" %a in ('netstat -aon ^| find ":9984"') do taskkill /F /PID %a 2>nul & java -Djeecg.path=${project.basedir}/lib/ydsz-module-code-standalone/config/jeecg -Dspring.config.location=file:${project.basedir}/lib/ydsz-module-code-standalone/ydsz-module-code-standalone.yml -jar ${project.basedir}/lib/ydsz-module-code-standalone/ydsz-module-code-standalone.jar</argument>
            </arguments>
          </configuration>
        </plugin>
    d.运行
        命令行:mvn exec:exec
        Maven 工具窗口:Plugins -> exec -> exec:exec

99.单独运行
    a.配置
        java -jar ydsz-module-system-depend-1.0.0.jar
        java -cp ydsz-module-system-depend-1.0.0.jar cn.jggroup.SystemDependApplication
        -----------------------------------------------------------------------------------------------------
        java -jar ydsz-module-start-app-1.0.0.jar
        java -jar ydsz-module-start-code-1.0.0.jar
        -----------------------------------------------------------------------------------------------------
        java -jar ydsz-module-code-1.0.0.jar
        java -jar ydsz-module-code-standalone-1.0.0.jar
        java -jar ydsz-module-jimu-1.0.0.jar
        java -jar ydsz-module-jimu-standalone-1.0.0.jar
        java -jar ydsz-module-system-1.0.0.jar
        -----------------------------------------------------------------------------------------------------
        java -jar ydsz-module-code-1.0.0-exec.jar
        java -jar ydsz-module-code-standalone-1.0.0-exec.jar
        java -jar ydsz-module-jimu-1.0.0-exec.jar
        java -jar ydsz-module-jimu-standalone-1.0.0-exec.jar
        java -jar ydsz-module-system-1.0.0-exec.jar
        -----------------------------------------------------------------------------------------------------
        【由于ydsz-module-system是一个starter,引用它的环境必须是Spring环境,而不是简单maven环境】
        -----------------------------------------------------------------------------------------------------
        下述方式缺少基础的Spirng环境
        # 方式1:使用 --spring.profiles.active 指定配置文件
        java -cp ydsz-module-system.jar cn.jggroup.system.YdszSystemStandaloneApplication --spring.profiles.active=dev
        -------------------------------------------------------------------------------------------------
        # 方式2:同时指定配置文件路径和profile
        java -cp ydsz-module-system.jar cn.jggroup.system.YdszSystemStandaloneApplication --spring.config.location=file:./application-dev.yml --spring.profiles.active=dev
        -------------------------------------------------------------------------------------------------
        # 方式3:添加JVM参数
        java -Dspring.profiles.active=dev -cp ydsz-module-system.jar cn.jggroup.system.YdszSystemStandaloneApplication
        -------------------------------------------------------------------------------------------------
        # 完整命令(包含内存配置等)
        java -Xms512m -Xmx1024m -Dspring.profiles.active=dev -cp ydsz-module-system.jar cn.jggroup.system.YdszSystemStandaloneApplication
    b.使用
        <!-- 在其他项目的pom.xml中添加依赖 -->
        <dependency>
            <groupId>cn.jggroup</groupId>
            <artifactId>ydsz-module-system</artifactId>
            <version>1.0.0</version>
        </dependency>
        -------------------------------------------------------------------------------------------------
        <!-- 本地jar依赖 -->
        <dependency>
          <groupId>cn.jggroup</groupId>
          <artifactId>ydsz-module-system</artifactId>
          <version>1.0.0</version>
          <scope>system</scope>
          <systemPath>${project.basedir}/lib/ydsz-module-system.jar</systemPath>
        </dependency>
        -------------------------------------------------------------------------------------------------
        使用方项目需要:
        创建自己的启动类
        提供自己的配置文件(application.yml)
        可以覆盖默认的Bean配置
        -------------------------------------------------------------------------------------------------
        @SpringBootApplication
        public class YourApplication {
            public static void main(String[] args) {
                SpringApplication.run(YourApplication.class, args);
            }
        }

2.9 classfinal、Jasypt

01.工具
    a.解密
        fernflower
        Java Decompiler(JD-GUI)
    b.加密
        ClassFinal
        Jasypt

02.ClassFinal
    a.简介
        ClassFinal是一款java class文件安全加密工具,支持直接加密jar包或war包,无需修改任何项目代码,
        兼容spring-framework;可避免源码泄漏或字节码被反编译。
    b.功能特性
        无需修改原项目代码,只要把编译好的jar/war包用本工具加密即可。
        运行加密项目时,无需求修改tomcat,spring等源代码。
        支持普通jar包、springboot jar包以及普通java web项目编译的war包。
        支持spring framework、swagger等需要在启动过程中扫描注解或生成字节码的框架。
        支持maven插件,添加插件后在打包过程中自动加密。
        支持加密WEB-INF/lib或BOOT-INF/lib下的依赖jar包
    c.使用步骤
        a.加密命令
            java -jar classfinal-fatjar.jar \n
            -file yourpaoject.jar \n
            -libjars a.jar,b.jar
            -packages com.yourpackage,com.yourpackage2 \n
            -exclude com.yourpackage.Main \n
            -pwd 123456 -Y
        b.参数说明
            -file           加密的jar/war完整路径
            -packages       加密的包名(可为空,多个用","分割)
            -libjars        jar/war包lib下要加密jar文件名(可为空,多个用","分割)
            -cfgfiles       需要加密的配置文件,一般是classes目录下的yml或properties文件(可为空,多个用","分割)
            -exclude        排除的类名(可为空,多个用","分割)
            -classpath      外部依赖的jar目录,例如/tomcat/lib(可为空,多个用","分割)
            -pwd            加密密码,如果是#号,则使用无密码模式加密
            -code           机器码,在绑定的机器生成,加密后只可在此机器上运行
            -Y              无需确认,不加此参数会提示确认以上信息
        c.插件方式
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <!-- https://gitee.com/roseboy/classfinal -->
                        <groupId>net.roseboy</groupId>
                        <artifactId>classfinal-maven-plugin</artifactId>
                        <version>1.2.1</version>
                        <configuration>
                            <!--加密打包之后pom.xml会被删除,不用担心在jar包里找到此密码-->
                            <password>123456</password>
                            <packages>com.whty.tec</packages>
                            <!-- 需要加密的配置文件多个以 , 分割 -->
                            <cfgfiles>application.yml</cfgfiles>
                            <libjars>tylicense-spring-boot-starter-0.0.1-SNAPSHOT.jar</libjars>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>classFinal</goal>
                                </goals
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        d.启动加密后的jar
            加密后的项目需要设置javaagent来启动项目,项目在启动过程中解密class,完全内存解密,不留下任何解密后的文件。
            解密功能已经自动加入到 yourpaoject-encrypted.jar中,所以启动时-javaagent与-jar相同,不需要额外的jar包。
            启动jar项目执行以下命令:java -javaagent:yourpaoject-encrypted.jar -jar yourpaoject-encrypted.jar
        e.注意事项
            本工具使用AES算法加密class文件,密码是保证不被破解的关键,请保存好密码,请勿泄漏。
            密码一旦忘记,项目不可启动且无法恢复,请牢记密码。
            本工具加密后,原始的class文件并不会完全被加密,只是方法体被清空,保留方法参数、注解等信息,这是为了兼容spring,swagger等扫描注解的框架;
            方法体被清空后,反编译者只能看到方法名和注解,看不到方法的具体内容;当class被classloader加载时,真正的方法体会被解密注入。

03.Jasypt
    a.介绍
        Jasypt(Java Simplified Encryption)是一个Java库,它允许开发人员以最小的努力为项目添加基本的加密功能,而无需深入了解密码学的工作原理。
        基于标准的高安全性加密技术,适用于单向和双向加密。加密密码,文本,数字,二进制文件
        与 Hibernate 的透明集成。
        适合集成到基于 Spring 的应用程序中,也可以透明地与 Spring 安全性集成。
        用于加密应用程序(即数据源)配置的集成功能。
        多处理器/多核系统中高性能加密的特定功能。
        开放 API 以与任何 JCE 提供程序一起使用。
    b.加密
        a.支持的加密功能
            Jasypt 基于 Java Cryptography Extension (JCE),支持以下加密功能:
            对称加密:数据加密和解密使用同一个密钥(如 AES、DES)。
            单向加密:如哈希算法(SHA-256),适合存储密码等不可逆信息。
            文件加密:支持二进制文件的加解密。
            配置加密:特别适用于对敏感配置(如数据库密码、API 密钥)的保护。
        b.Jasypt加密场景
            System Property 系统变量
            Envirnment Property 环境变量
            Command Line argument 命令行参数
            Application.properties 应用配置文件
            Yaml properties 应用配置文件
            other custom property sources 其它配置文件
        c.Jasypt 提供了多种加密算法,常见的包括以下几种
            PBEWithMD5AndDES                  对称加密     默认算法,使用 MD5 和 DES 结合,适合基础加密需求。
            PBEWithHMACSHA512AndAES_256       对称加密     高级加密算法,支持更高安全性,需 JDK 1.9 或添加 JCE 支持。
            PBEWithSHA1AndDESede              对称加密     使用 SHA1 和 DESede(Triple DES)结合,适合需要更强加密的场景。
            PBEWithMD5AndTripleDES            对称加密     提供更高的安全性,推荐在对性能要求较低的场景使用。
            PBEWithSHA256And128BitAES-CBC-BC  对称加密     支持 AES-128 位加密,适合现代化安全需求。
        d.各算法的特点和适用场景
            PBEWithMD5AndDES
            特点:性能较好,适合普通加密需求。
            适用场景:配置文件加密、敏感信息保护。
            -------------------------------------------------------------------------------------------------
            PBEWithHMACSHA512AndAES_256
            特点:更高强度的加密算法,适合对安全性要求高的场景。
            适用场景:企业级应用的关键数据加密,如 API 密钥、数据库配置。
            -------------------------------------------------------------------------------------------------
            PBEWithSHA1AndDESede
            特点:加密强度中等,兼顾性能和安全性。
            适用场景:中小型项目的敏感信息加密。
            -------------------------------------------------------------------------------------------------
            PBEWithMD5AndTripleDES
            特点:高安全性,性能稍低。
            适用场景:需要持久性存储的重要数据加密。
            -------------------------------------------------------------------------------------------------
            PBEWithSHA256And128BitAES-CBC-BC
            特点:AES 加密提供更现代化的安全性,适合对性能有较高要求的场景。
            适用场景:移动端和分布式系统中的配置加密。
        e.Jasypt 使用注意事项
            a.密钥安全管理
                a.避免硬编码密码
                    密钥不应直接写在代码或配置文件中,推荐通过系统环境变量或启动参数传递。
                b.限制密钥权限
                    密钥文件或环境变量的访问权限应严格控制,仅允许授权用户和进程访问。
                c.定期更换密钥:
                    为提高安全性,应定期更换加密密钥并重新加密存储的数据。
            b.异常处理和日志记录
                a.加解密异常捕获
                    在加解密过程中,可能出现密钥错误、算法不支持等异常,需捕获并记录日志。
                    try {
                        String encrypted = encryptor.encrypt("plaintext");
                    } catch (Exception e) {
                        log.error("Encryption failed: ", e);
                    }
                b.敏感数据保护
                    避免在日志中记录明文数据或加密密钥,以防泄露敏感信息。
            c.性能优化建议
                a.使用池化加密器
                    配置 PooledPBEStringEncryptor 的 poolSize 参数,根据系统并发需求合理设置线程池大小。
                    config.setPoolSize("5");
                b.减少解密操作
                    对需要频繁访问的解密数据,推荐缓存解密后的内容,避免重复解密带来的性能开销。
                c.选择适合的算法
                    根据实际需求选择加密算法,简单配置可选择 PBEWithMD5AndDES,复杂场景可选更高级的算法。
    c.SpringBoot项目中集成jasypt
        a.添加依赖jar
            <dependency>
               <groupId>com.github.ulisesbocchio</groupId>
               <artifactId>jasypt-spring-boot-starter</artifactId>
               <version>3.0.5</version>
            </dependency>
        b.配置application.yml配置文件
            jasypt:
              encryptor:
                # 指定解密算法,需要和加密时使用的算法一致
                algorithm: PBEWithMD5AndDES
                keyObtentionIterations: 1000
                # 指定加密密钥,生产环境请放到启动参数里面
                password: G0CvDz7oJn6
                poolSize: 1
                saltGeneratorClassname: org.jasypt.salt.RandomSaltGenerator
                stringOutputType: base64
            -------------------------------------------------------------------------------------------------
            jasypt3.0后,默认支持的算法为 PBEWITHHMACSHA512ANDAES_256 ,该算法需要JDK1.9 以上支持或者添加JCE
            (Java Cryptography Extension 无限强度权限策略文件)支持
        c.使用工具类加解密
            public class JasyptUtils {
                private static final PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
                private static final String PASSWORD = System.getProperty("jasypt.encryptor.password", "defaultPassword");

                static {
                    SimpleStringPBEConfig config = new SimpleStringPBEConfig();
                    config.setAlgorithm("PBEWithMD5AndDES");
                    config.setPassword(PASSWORD);
                    config.setKeyObtentionIterations("1000");
                    config.setPoolSize("1");
                    config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
                    config.setStringOutputType("base64");
                    encryptor.setConfig(config);
                }

                public static String encrypt(String plaintext) {
                    try {
                        return encryptor.encrypt(plaintext);
                    } catch (Exception e) {
                        throw new RuntimeException("加密失败", e);
                    }
                }

                public static String decrypt(String encryptedText) {
                    try {
                        return encryptor.decrypt(encryptedText);
                    } catch (Exception e) {
                        throw new RuntimeException("解密失败", e);
                    }
                }
            }
        d.配置文件密钥安全性处理
            datasource:
                # driver-class-name: com.mysql.cj.jdbc.Driver
                url: jdbc:mysql://127.0.0.1:13306/oauth?characterEncoding=utf-8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=false&useUnicode=true&rewriteBatchedStatements=true
                username: root
                password: ENC(Ifn6fVWW1eA/jVy9fkLhI3pONN/wuCVsm3bfSEzNE10=)
    d.真实场景应用
        a.数据库配置加密
            将数据库的用户名和密码加密存储,防止配置文件泄露时敏感信息暴露:
            datasource:
              url: jdbc:mysql://localhost:3306/mydb
              username: ENC(encryptedUsername)
              password: ENC(encryptedPassword)
        b.敏感信息保护(如 API Key)
            在项目中加密存储第三方服务的 API Key:
            api:
              key: ENC(encryptedApiKey)
        c.与 Spring Security 集成
            通过 Jasypt 加密用户认证信息或加密存储会话令牌,提升应用的安全性。
        d.秘钥处理
            将加密密码以明文形式写在配置文件中并不安全,实际开发中也不推荐这样使用。
            打包后部署项目,可以使用如下命令在启动项目时指定秘钥:
            #方式1:
            java -jar xxx.jar -Djasypt.encryptor.password=加密数据的秘钥
            #方式2:
            java -jar xxx.jar --jasypt.encryptor.password=加密数据的秘钥
        e.SpringBoot何时解密?
            jasypt-spring-boot-starter在服务运行(启动)时会自动对密文进行解密处理
    e.测试方法
        a.测试方式一
            # maven依赖:org.jasypt:jasypt
            java -cp jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI password=xxxyyyzzz algorithm=PBEWithMD5AndDES input="明文"
            java -cp jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI password=xxxyyyzzz algorithm=PBEWithMD5AndDES input=密文
            # 好像是必须带上ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator
            java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI password=xxxyyyzzz algorithm=PBEWithMD5AndDES ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator input="明文"
            java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI password=xxxyyyzzz algorithm=PBEWithMD5AndDES ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator input=密文
            # maven依赖:com.melloware:jasypt
            # com.melloware:jasypt:1.9.4报错:Bad argument: ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator,需要去掉ivGeneratorClassName参数
            java -cp jasypt-1.9.4.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI password=password algorithm=PBEWithMD5AndDES input="XXX"
            java -cp jasypt-1.9.4.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI password=password algorithm=PBEWithMD5AndDES input="XXX"
        b.测试方式二
            PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
            SimpleStringPBEConfig config = new SimpleStringPBEConfig();
            config.setPassword("jaspyt_password");
            config.setAlgorithm("PBEWITHHMACSHA512ANDAES_256");
            config.setKeyObtentionIterations("1000");
            config.setPoolSize("1");
            config.setProviderName("SunJCE");
            config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
            //config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
            config.setStringOutputType("base64");
            encryptor.setConfig(config);
            System.out.println(encryptor.encrypt("root"));
        c.测试方式三
            import org.jasypt.encryption.StringEncryptor;
            import org.junit.jupiter.api.Test;
            import org.springframework.boot.test.context.SpringBootTest;
            @SpringBootTest
            public class TestAppTest {
                @Resource
                private StringEncryptor stringEncryptor;
                @Test
                public void testEncrypt() {
                    // 加密
                    System.out.println(stringEncryptor.encrypt("100"));

                    // 解密
                    System.out.println(stringEncryptor.decrypt("9eO11FBv04dwRC3KUJjpXx0XpfA/nlhWy0ee91bpAlbLJZAlMtlh+pRFnL9HsX8o0do26JwkwnAuqk/RVuwa5FRtAdzwsL2B6ce1vQ43z2hXmbuiUBoDyh0UCbnVHqNX"));
                }
            }

2.10 mybatisconfig

01.常见信息
    a.问题
        MybatisPlusSaasConfig 和 mybatis.mapper-locations 重复扫描,报错 Bean already defined 警告
    b.原因
        a.@MapperScan的作用
            @MapperScan 注解用于指定 Mapper 接口的包路径,并自动扫描这些接口以进行注册。
        b.mybatis.mapper-locations的作用
            mapper-locations 是 MyBatis XML 文件的路径配置,用于指定 Mapper XML 文件的位置。
        c.重复扫描的可能性
            如果 @MapperScan 和 mapper-locations 配置的扫描路径存在交集,MyBatis 会尝试重复注册 Mapper 接口,导致日志中出现的 Bean already defined 警告。
            尤其是 @MapperScan 的路径包含所有 Mapper 的包路径,同时 mapper-locations 也指向这些 Mapper 的 XML 文件路径时,这种冲突就会出现。
    c.解决方案
        a.方法1: 去掉 @MapperScan 注解
            如果所有 Mapper 的扫描均已通过 mapper-locations 解决,可以移除 @MapperScan,避免重复加载:
            @Configuration
            public class MybatisPlusSaasConfig {
                // 不需要额外配置 @MapperScan
            }
        b.方法2: 调整 @MapperScan 的路径范围
            如果你需要保留 @MapperScan,则需确保 mapper-locations 和 @MapperScan 配置的范围互补且不重叠:
            @Configuration
            @MapperScan(value = {"cn.jggroup.modules.someSpecificPackage.mapper"})
            public class MybatisPlusSaasConfig {
                // 仅扫描特定的 Mapper 接口
            }
        c.方法3: 移除 mapper-locations 配置
            如果项目中所有的 Mapper 都采用注解方式定义(即不需要 XML 文件),可以移除 mapper-locations 配置:
            # application.yml
            # 删除 mybatis.mapper-locations 配置
        d.方法4: 保留 mapper-locations,避免 @MapperScan 全局扫描
            通过配置 XML 文件的路径来管理 Mapper,避免全局使用 @MapperScan 扫描。

02.常见信息
    a.问题
        a.@Resource(JDK 提供的):
            默认按 名称(name) 注入,如果名称匹配不上,则回退到按类型(type)注入。
            因此,SysUserMapper 必须被正确注册为 Spring Bean,且名字或类型匹配。
        b.@Autowired(Spring 提供的):
            默认按 类型(type) 注入,如果有多个同类型的 Bean,则需要结合 @Qualifier 指定名称。
    b.为什么需要@MapperScan?
        a.@MapperScan 的作用:
            这是 MyBatis 提供的注解,用于指定 Mapper 接口所在的包路径,从而让 Spring 自动扫描并将其注册为 Spring Bean。
            如果没有使用 @MapperScan 或者等效的 XML 配置,MyBatis 无法将 SysUserMapper 注册到 Spring 容器中,即使 mapper-locations 指定了 XML 的位置。
        b.mapper-locations 的作用:
            它仅用于配置 MyBatis 的 XML 映射文件的位置,解决的是 SQL 映射问题。
            但它不会自动将 Mapper 接口(如 SysUserMapper)注册为 Spring Bean。
            因此,仅使用 mapper-locations 是不够的,还需要使用 @MapperScan 或等效的扫描配置。
    c.如何正确配置Mapper?
        a.推荐使用 @MapperScan: 在主启动类(@SpringBootApplication 标注的类)中添加:
            @SpringBootApplication
            @MapperScan("cn.jggroup.modules.system.mapper")
            public class Application {
                public static void main(String[] args) {
                    SpringApplication.run(Application.class, args);
                }
            }
        b.确保 Mapper 接口上有 @Mapper 注解:
            @Mapper
            public interface SysUserMapper {
                // 数据库操作方法
            }
        c.配置 mapper-locations(用于 XML 映射文件): 在 application.yml 中确保正确配置了 XML 文件的路径:
            mybatis:
              mapper-locations: classpath*:cn/jggroup/**/mapper/xml/*.xml
    d.总结
        @MapperScan 是必须的,用于扫描并注册 Mapper 接口。
        mapper-locations 是辅助的,用于加载对应的 XML 文件。
        两者配合才能使 Mapper 正常工作。
        如果没有 @MapperScan,即使配置了 mapper-locations,Mapper 接口也不会被注册为 Spring Bean,从而导致 @Resource 或 @Autowired 注入失败。

03.生产使用
    a.启动类
        @SpringBootApplication
        @MapperScan("cn.jggroup.modules.system.mapper")
        public class Application {
            public static void main(String[] args) {
                SpringApplication.run(Application.class, args);
            }
        }
    b.Mapper接口
        @Mapper
        public interface SysUserMapper {
            // 方法定义
        }
    c.Service层注入
        @Service
        public class SomeService {
            @Resource
            private SysUserMapper userMapper; // 注入成功
        }
    d.配置文件
        mybatis:
          mapper-locations: classpath*:cn/jggroup/**/mapper/xml/*.xml
    e.总结
          @MapperScan 是必须的,用于扫描并注册 Mapper 接口。
          mapper-locations 是辅助的,用于加载对应的 XML 文件。
          两者配合才能使 Mapper 正常工作。
          如果没有 @MapperScan,即使配置了 mapper-locations,Mapper 接口也不会被注册为 Spring Bean,从而导致 @Resource 或 @Autowired 注入失败。

04.报错
    a.问题
        org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): org.jeecg.modules.system.mapper.SysDepartMapper.queryUserDeparts
            at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235)
            at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.<init>(MybatisMapperMethod.java:50)
            at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.lambda$cachedInvoker$0(MybatisMapperProxy.java:111)
            at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
            at com.baomidou.mybatisplus.core.toolkit.CollectionUtils.computeIfAbsent(CollectionUtils.java:115)
            at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.cachedInvoker(MybatisMapperProxy.java:98)
            at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
            at com.sun.proxy.$Proxy149.queryUserDeparts(Unknown Source)
            at org.jeecg.modules.system.service.impl.SysDepartServiceImpl.queryUserDeparts(SysDepartServiceImpl.java:412)
            at org.jeecg.modules.system.service.impl.SysDepartServiceImpl$$FastClassBySpringCGLIB$$6f2aae1b.invoke(<generated>)
    b.MyBatis找到XML映射文件
        a.Maven 资源处理的特点
            Maven 默认只处理 src/main/resources 目录下的资源
            要处理 src/main/java 下的文件,需要明确配置
            <resources>
              <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
              </resource>
              <resource>
                <directory>src/main/java</directory>
                <includes>
                  <include>**/*.xml</include>
                  <include>**/*.json</include>
                  <include>**/*.ftl</include>
                </includes>
              </resource>
            </resources>
        b.第1种:resources目录方式(标准推荐方式)
            将XML文件放在src/main/resources目录下
            配置mapper-locations: classpath*:cn/jggroup/**/mapper/xml/*.xml
        c.第2种Java源码目录方式(你当前使用的方式)
            将XML文件放在src/main/java目录下
            需要在pom.xml中添加资源配置:
            <resources>
              <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
              </resource>
              <resource>
                <directory>src/main/java</directory>
                <includes>
                  <include>**/*.xml</include>
                  <include>**/*.json</include>
                  <include>**/*.ftl</include>
                </includes>
              </resource>
            </resources>
    c.查看配置
        a.配置
            @Configuration
            @MapperScan(value={"cn.jggroup.**.mapper*"})
            public class MybatisPlusSaasConfig {
            }
            -------------------------------------------------------------------------------------------------
            mybatis-plus:
              # mapper-locations:SQL映射文件的加载问题
              # cn.jggroup.config.mybatis.MybatisPlusSaasConfig:Mapper接口的注册问题
              mapper-locations: classpath*:cn/jggroup/**/mapper/xml/*.xml                --注意是classpath*,不是classpath:*
        b.排查步骤
            a.Mapper接口和XML文件的namespace不匹配:
                确保SysDepartMapper接口的namespace与XML文件中的namespace完全一致。你已经确认过这一点,所以这个问题可以排除。
            b.Mapper接口未被正确扫描:
                确保@MapperScan注解的配置正确,且能够扫描到SysDepartMapper接口。你在MybatisPlusSaasConfig中使用了@MapperScan(value={"org.jeecg.**.mapper*"}),这应该是正确的。
            c.XML文件的SQL语句未被加载:
                确保SysDepartMapper.xml文件在运行时能够被MyBatis加载。你可以在application-dev.yml中添加MyBatis的日志配置,以便查看加载的SQL语句:
            d.【重点】检查target
                jeecg-module-common\target\classes\org\jeecg\modules\system\mapper\SysAnnouncementMapper.class
                对应
                jeecg-module-common\target\classes\org\jeecg\modules\system\mapper\xml\SysAnnouncementMapper.xml
            e.【20250109】解决方案
                确定为【build】配置有误,参考【Packing4,父子模块】
                确定为【redis】缓存信息有问题,操作【redis -> 6349 -> DB2 -> 清空】
                确定为【JeecgSystemApplication】编译的内容没有mapper,清除IDE缓存,使用【右侧菜单 -> maven -> 生命周期:clean + compile】

3 java3

3.1 rust

01.环境变量
    +代表添加,*代表追加
    [+] CARGO_HOME => C:\software\rust\.cargo                                             --存储cargo的缓存
    [+] RUSTUP_HOME => C:\software\rust\.rustup                                           --存储工具链和配置文件
    [*] Path => %CARGO_HOME%\bin

02.安装
    先设置环境变量位置,然后双击安装rustup-init.exe

03.命令
    rustup update                                                                         --更新
    rustup self uninstall                                                                 --卸载rust、rustup
    ---------------------------------------------------------------------------------------------------------
    cargo new 项目名称                                                                     --创建新项目
    cargo build                                                                           --编译
    cargo run                                                                             --编译并运行
    cargo clean                                                                           --清理临时文件

04.测试
    rustup update                                                                         --升级
    rustup self uninstall                                                                 --卸载
    rustc --version                                                                       --Rust编译器的版本号
    cargo --version                                                                       --Cargo工具的版本号

3.2 ruby

01.环境变量
    +代表添加,*代表追加
    [*] Path => C:\software\Ruby33-x64\bin

02.安装
    rubyinstaller-devkit-3.3.4-1-x64.exe

03.命令
    ruby -v
    gem -v

3.3 csharp

01.下载
    https://dotnet.microsoft.com/zh-cn/download/dotnet
    选择.NET 8.0

02.环境变量
    C:\Program Files\dotnet\

03.验证
    dotnet --info

04.命令交互
    a.创建的工程名为HelloCsharp
        d:
        cd D:\software_xare\workspace_sharp
        dotnet new console -n HelloCsharp
    b.打开项目
        cd HelloCsharp
        vi Program.cs
        -----------------------------------------------------------------------------------------------------
        Console.WriteLine("Hello, World!");
    c.构建运行
        dotnet build
        dotnet run
    d.输出
        Hello, World!

3.4 golang

01.基础安装
    a.环境变量
        C:\software\golang\bin
    b.测试
        go env
    c.插件
        golangci-lint       检测语法
        gofumpt             格式代码
        json to go          chrome插件
    d.版本
        go version
        go mod tidy / go generate -x                                                       --使用 go mod 并安装go依赖包
        go build -o server.exe main.go                                                     --指定server.exe
        ---------------------------------------------------------------------------------------------------------
        go build main.go && main.exe                                                       --运行main.exe
        go run main.go                                                                     --运行main.go
    e.Create Go App CLI
        mkdir web && cd web                                                                --创建一个项目的目录
        cgapp create                                                                       --创建项目
        ---------------------------------------------------------------------------------------------------------
        Create Go App CLI 提供了三种 Golang 后端框架的支持:
        chi: 支持几乎所有的 Web 开发需求,是一个功能全面的 Go Web 框架
        fiber: 功能更为强大的框架,支持 CRUD、JWT 身份验证、令牌刷新、数据库和缓存操作等复杂功能
        net/http: 使用 Golang 内置的 net/http 包创建的后端模板,适合简单的 REST API 项目,支持 CRUD 和 JWT 身份验证
    f.加快win编译速度
        关闭【MSPCManagerService.exe】进程

02.使用g安装
    a.地址
        https://gitee.com/voidint/gvm
        https://github.com/voidint/g/releases/tag/v1.7.0(推荐g)
        gvm是一个Linux、macOS、Windows下的命令行工具,可以提供一个便捷的多版本go环境的管理和切换。
        gvm与g有什么区别?同一个项目。只不过因为gitee要求仓库名字符数必须>=2,因此将项目重命名为gvm
    b.环境变量
        +代表添加,*代表追加
        [+] G_MIRROR => https://golang.google.cn/dl/
        [+] G_EXPERIMENTAL => true
        [+] G_HOME => C:\software\g-1.7.0
        [+] GOROOT => C:\software\g-1.7.0\go
        [+] GOPATH => C:\Users\mysla\go                                                    --默认依赖module位置
        [*] Path => %G_HOME%
        [*] Path => %GOROOT%\bin
        ---------------------------------------------------------------------------------------------------------
        g --version
    c.命令
        a.查询可供安装的所有go版本
            $ g ls-remote
              1
              1.2.2
              1.3
              1.3.1
              ...    // 省略若干版本
              1.19.10
              1.20rc1
              1.20rc2
              1.20rc3
              1.20
              1.20.1
              1.20.2
              1.20.3
              1.20.4
            * 1.20.5
        b.查询当前可供安装的stable状态的go版本
            $ g ls-remote stable
              1.19.10
              1.20.5
        c.安装目标 go 版本1.22.5(必须以管理员身份运行命令行工具)(下载失败,原因:这个是下载链接不稳定造成的问题,解决:多试几次)
            $ g install 1.22.5
            Downloading 100% [===============] (92/92 MB, 12 MB/s)
            Computing checksum with SHA256
            Checksums matched
            Now using go1.22.5
        d.查询已安装的 go 版本
            $ g ls
            * 1.21.12
              1.22.5
            -----------------------------------------------------------------------------------------------------
            $ go version
            go version go1.22.5 windows/amd64
        e.切换到另一个已安装的 go 版本
            $ g use 1.21.12
            $ g use 1.22.5
            go version go1.22.5 windows/amd64
        f.卸载一个已安装的 go 版本
            $ g uninstall 1.21.12
            Uninstalled go1.21.12

03.部署代码
    a.说明
        在Linux服务器上部署Golang程序时,通常不需要安装Golang环境
        Golang程序可以编译成静态的可执行文件,这意味着所有的依赖库都被打包在可执行文件中
    b.本地操作
        a.环境
            go env -w GOOS=linux
        b.打包
            go build -o myapp
    c.远程操作
        a.上传
            scp myapp user@centos-server:/opt/myapp/
        b.权限
            cd /opt/myapp
            chmod +x myapp
        c.控制台运行
            ./myapp
        d.后台运行
            nohup ./myapp  > start.log 2>&1 &
    d.监测
        a.进程
            ps -ef | grep main
        b.日志
            tail -f start.log
    e.开机自启
        a./etc/systemd/system/myapp.service
            [Unit]
            Description=My Go Application

            [Service]
            ExecStart=/opt/myapp/myapp
            Restart=always
            User=nobody
            Group=nobody
            Environment=PATH=/usr/bin:/usr/local/bin
            Environment=GO_ENV=production
            WorkingDirectory=/opt/myapp

            [Install]
            WantedBy=multi-user.target
        b.重新加载systemd配置
            sudo systemctl daemon-reload
        c.启动并启用服务
            sudo systemctl start myapp
            sudo systemctl enable myapp
        d.检查程序是否正常运行
            sudo systemctl status myapp
        e.查看程序日志以确保没有错误
            journalctl -u myapp -f

3.5 nssm

01.环境变量
    C:\software\Nssm

02.测试
    nssm install <servicename>                                                  --注册
    nssm remove <servicename>                                                   --删除
    nssm start <servicename>                                                    --启动
    nssm stop <servicename>                                                     --停止
    nssm restart <servicename>                                                  --重启
    net start XXX                                                               --启动

3.6 minio+mc

01.Minio
    a.环境变量
        C:\software\Minio
    b.测试
        minio.exe server C:\software\Minio_ext                                  --启动
        http://127.0.0.1:9000                                                   --访问
        minioadmin / minioadmin                                                 --登陆

02.MC
    a.环境变量
        C:\software\Minio
    b.测试
        mc.exe alias set myminio http://127.0.0.1:9000 minioadmin minioadmin    --启动
        mc.exe admin user add myminio myslayers 12345678                        --添加用户
        mc.exe admin policy set myminio readwrite user=myslayers                --赋予权限
        ------------------------------------------------------------------------------------
        http://127.0.0.1:9000                                                   --访问
        myslayers / 12345678                                                    --登陆
        mc.exe ls myminio/picture                                               --查询bucket

03.注册服务
    nssm install minio                                                          --注册服务
    net start minio                                                             --启动服务

3.7 elasticsearch-7.6.2

01.Elasticsearch
    a.环境变量
        C:\software\Elastic\elasticsearch-7.6.2\bin
    b.安装中文分词插件
        elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.6.2/elasticsearch-analysis-ik-7.6.2.zip
    c.配置(Elasticsearch),config/elasticsearch.yml
        cluster.name: my-application
        node.name: node-1
        network.host: 0.0.0.0
        http.port: 9200
        cluster.initial_master_nodes: ["node-1"]
    d.配置(elasticsearch-head),config/elasticsearch.yml
        http.cors.enabled: true
        http.cors.allow-origin: "*"
        node.master: true
        node.data: true
    e.测试
        elasticsearch-service.bat install                                       --NSSM注册服务
        net start elasticsearch-service-x64                                     --NSSM启动服务
        sc delete elasticsearch-service-x64                                     --删除服务
        elasticsearch-service.bat install|remove|start|stop|manager             --启动
        http://127.0.0.1:9200                                                   --访问
        http://localhost:9200/_cat/nodes                                        --本机已运行的节点
        http://localhost:9200/_cat/plugins                                      --本机已安装的插件
    f.在开发机上运行多个实例(-d 是linux下的守护模式参数,win10 下无法启动第三个节点)
        bin\elasticsearch.bat -E node.name=node1 -E cluster.name=cluster1 -E path.data=data_node1 -d
        bin\elasticsearch.bat -E node.name=node2 -E cluster.name=cluster1 -E path.data=data_node2 -d
        bin\elasticsearch.bat -E node.name=node3 -E cluster.name=cluster1 -E path.data=data_node3 -d
    g.elasticsearch.bat
        c:
        cd C:\software\Elastic\elasticsearch-7.6.2\bin
        elasticsearch.bat
    h.注册服务
        nssm install elasticsearch                                              --NSSM注册服务
        net start elasticsearch                                                 --NSSM启动服务

02.Kibana:访问 Elasticsearch 的客户端
    a.环境变量
        C:\software\Elastic\kibana-7.6.2\bin
    b.配置(Kibana),config/kibana.yml
        server.port: 5601
        server.host: "0.0.0.0"
        i18n.locale: "zh-CN"
    c.测试
        nssm install kibana                                                     --NSSM注册服务
        net start kibana                                                        --NSSM启动服务
        kibana.bat                                                              --启动
        http://127.0.0.1:5601                                                   --访问
    d.kibana.bat
        c:
        cd C:\software\Elastic\kibana-7.6.2\bin
        kibana.bat
    e.注册服务
        nssm install kibana                                                     --NSSM注册服务
        net start kibana                                                        --NSSM启动服务

03.Logstash:用于收集日志
    a.环境变量
        D:\software\Linux\Window\Source\Elastic\logstash-7.6.2\bin
    b.安装json_lines插件
        logstash-plugin install logstash-codec-json_lines
    c.测试
        logstash -f logstash.conf                                               --启动
    d.logstash.bat
        c:
        cd C:\software\Elastic\logstash-7.6.2\bin\
        logstash -f logstash.conf\
    e.注册服务
        nssm install logstash                                                   --NSSM注册服务
        net start logstash                                                      --NSSM启动服务

04.elasticsearch-head:可视化界面 ES head 插件
    a.下载
        git clone git://github.com/mobz/elasticsearch-head.git
    b.测试
        grunt server                                                            --启动
        http://127.0.0.1:9100                                                   --访问
    c.elasticsearch-head.bat
        c:
        cd C:\software\Elastic\elasticsearch-head
        npm run start 或 grunt server
    d.注册服务
        nssm install logstash                                                   --NSSM注册服务
        net start logstash                                                      --NSSM启动服务

05.版本对应关系
    http://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/asciidoc/preface.adoc
    Spring Data Release Train  Spring Data Elasticsearch  Elasticsearch  Spring Framework  Spring Boot
    2021.0 (Pascal)                     4.2.x               7.10.2          5.3.x           2.4.x
    2020.0 (Ockham)                     4.1.x               7.9.3           5.3.2           2.4.x
    Neumann                             4.0.x               7.6.2           5.2.12          2.3.x
    Moore                               3.2.x               6.8.12          5.2.12          2.2.x
    Lovelace                            3.1.x               6.2.2           5.1.19          2.1.x
    Kay                                 3.0.x               5.5.0           5.0.13          2.0.x
    Ingalls                             2.1.x               2.4.0           4.3.25          1.5.x

06.Postman测试
    127.0.0.1:9200/_analyze
    ---------------------------------------------------------------------------------------------------------
    {
        "analyzer": "ik_max_word",
        "text": "欢迎来到黑马"
    }
    ---------------------------------------------------------------------------------------------------------
    {
        "tokens": [
            {
                "token": "欢迎",
                "start_offset": 0,
                "end_offset": 2,
                "type": "CN_WORD",
                "position": 0
            },
            {
                "token": "迎来",
                "start_offset": 1,
                "end_offset": 3,
                "type": "CN_WORD",
                "position": 1
            },
            {
                "token": "来到",
                "start_offset": 2,
                "end_offset": 4,
                "type": "CN_WORD",
                "position": 2
            },
            {
                "token": "黑马",
                "start_offset": 4,
                "end_offset": 6,
                "type": "CN_WORD",
                "position": 3
            }
        ]
    }

07.ehd7服务
    c:
    cd C:\software\ElasticHD\
    ElasticHD.exe
    ---------------------------------------------------------------------------------------------------------
    c: && cd C:\software\ElasticHD
    nssm install ehd7 && net start ehd7
    ---------------------------------------------------------------------------------------------------------
    127.0.0.1:9800

3.8 elasticsearch-6.4.3

01.Elasticsearch
    a.环境变量
        C:\software\Elastic-6.4.3\elasticsearch-6.4.3\bin
    b.安装中文分词插件
        elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.4.3/elasticsearch-analysis-ik-6.4.3.zip
    c.配置(Elasticsearch),config/elasticsearch.yml
        cluster.name: my-application
        node.name: node-1
        network.host: 0.0.0.0
        http.port: 9200
        cluster.initial_master_nodes: ["node-1"]
    d.配置(elasticsearch-head),config/elasticsearch.yml
        http.cors.enabled: true
        http.cors.allow-origin: "*"
        node.master: true
        node.data: true
    e.测试
        elasticsearch-service.bat install                                       --NSSM注册服务
        net start elasticsearch-service-x64                                     --NSSM启动服务
        sc delete elasticsearch-service-x64                                     --删除服务
        elasticsearch-service.bat install|remove|start|stop|manager             --启动
        http://127.0.0.1:9200                                                   --访问
        http://localhost:9200/_cat/nodes                                        --本机已运行的节点
        http://localhost:9200/_cat/plugins                                      --本机已安装的插件
    f.在开发机上运行多个实例(-d 是linux下的守护模式参数,win10 下无法启动第三个节点)
        bin\elasticsearch.bat -E node.name=node1 -E cluster.name=cluster1 -E path.data=data_node1 -d
        bin\elasticsearch.bat -E node.name=node2 -E cluster.name=cluster1 -E path.data=data_node2 -d
        bin\elasticsearch.bat -E node.name=node3 -E cluster.name=cluster1 -E path.data=data_node3 -d
    g.elasticsearch.bat
        c:
        cd C:\software\Elastic-6.4.3\elasticsearch-6.4.3\bin
        elasticsearch.bat
    h.注册服务
        nssm install elasticsearch                                              --NSSM注册服务
        net start elasticsearch                                                 --NSSM启动服务

02.Kibana:访问 Elasticsearch 的客户端
    a.环境变量
        D:\software\Linux\Window\Source\Elastic-6.4.3\kibana-7.6.2\bin
    b.配置(Kibana),config/kibana.yml
        server.port: 5601
        server.host: "0.0.0.0"
        i18n.locale: "zh-CN"
    c.测试
        nssm install kibana                                                     --NSSM注册服务
        net start kibana                                                        --NSSM启动服务
        kibana.bat                                                              --启动
        http://127.0.0.1:5601                                                   --访问
    d.kibana.bat
        c:
        cd C:\software\Elastic-6.4.3\kibana-6.4.3\bin
        kibana.bat
    e.注册服务
        nssm install logstash                                                   --NSSM注册服务
        net start logstash                                                      --NSSM启动服务

03.Logstash:用于收集日志
    a.环境变量
        D:\software\Linux\Window\Source\Elastic-6.4.3\logstash-6.4.3\bin
    b.安装json_lines插件
        logstash-plugin install logstash-codec-json_lines
    c.测试
        logstash -f logstash.conf                                               --启动
    d.logstash.bat
        c:
        cd C:\software\Elastic-6.4.3\logstash-6.4.3\bin\
        logstash -f logstash.conf\
    e.注册服务
        nssm install logstash                                                   --NSSM注册服务
        net start logstash                                                      --NSSM启动服务

04.elasticsearch-head:可视化界面 ES head 插件
    a.下载
        git clone git://github.com/mobz/elasticsearch-head.git
    b.测试
        grunt server                                                            --启动
        http://127.0.0.1:9100                                                   --访问
    c.elasticsearch-head.bat
        c:
        cd C:\software\Elastic-6.4.3\elasticsearch-head
        npm run start 或 grunt server
    d.注册服务
        nssm install logstash                                                   --NSSM注册服务
        net start logstash                                                      --NSSM启动服务

05.版本对应关系
    http://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/main/asciidoc/preface.adoc
    Spring Data Release Train  Spring Data Elasticsearch  Elasticsearch  Spring Framework  Spring Boot
    2021.0 (Pascal)                     4.2.x               7.10.2          5.3.x           2.4.x
    2020.0 (Ockham)                     4.1.x               7.9.3           5.3.2           2.4.x
    Neumann                             4.0.x               7.6.2           5.2.12          2.3.x
    Moore                               3.2.x               6.8.12          5.2.12          2.2.x
    Lovelace                            3.1.x               6.2.2           5.1.19          2.1.x
    Kay                                 3.0.x               5.5.0           5.0.13          2.0.x
    Ingalls                             2.1.x               2.4.0           4.3.25          1.5.x

06.Postman测试
    127.0.0.1:9200/_analyze
    ---------------------------------------------------------------------------------------------------------
    {
        "analyzer": "ik_max_word",
        "text": "欢迎来到黑马"
    }
    ---------------------------------------------------------------------------------------------------------
    {
        "tokens": [
            {
                "token": "欢迎",
                "start_offset": 0,
                "end_offset": 2,
                "type": "CN_WORD",
                "position": 0
            },
            {
                "token": "迎来",
                "start_offset": 1,
                "end_offset": 3,
                "type": "CN_WORD",
                "position": 1
            },
            {
                "token": "来到",
                "start_offset": 2,
                "end_offset": 4,
                "type": "CN_WORD",
                "position": 2
            },
            {
                "token": "黑马",
                "start_offset": 4,
                "end_offset": 6,
                "type": "CN_WORD",
                "position": 3
            }
        ]
    }

07.ehd7服务
    c:
    cd C:\software\ElasticHD\
    ElasticHD.exe
    ---------------------------------------------------------------------------------------------------------
    c: && cd C:\software\ElasticHD
    nssm install ehd7 && net start ehd7
    ---------------------------------------------------------------------------------------------------------
    127.0.0.1:9800

3.9 elasticsearch-client

01.ES-King
    节点名称:127.0.0.1
    协议://主机:端口:http://127.0.0.1:9200
    用户名:troyekk
    密码:ixI3hn8g8xqD2X

02.elasticsearch-head
    网址:http://127.0.0.1:9200/
    用户:troyekk
    密码:ixI3hn8g8xqD2X

03.Kibana
    网址:http://127.0.0.1:5601/
    用户:troyekk
    密码:ixI3hn8g8xqD2X

3.10 erlang+rabbitmq

01.Erlang
    a.环境变量
        ERLANG_HOME:C:\software\Erlang
        path:C:\software\Erlang\bin
    b.测试
        erl
        erl -version

02.RabbitMQ
    a.环境变量
        RABBITMQ_SERVER:C:\software\RabbitMQ
        path:C:\software\RabbitMQ\sbin
    b.安装
        rabbitmq-plugins enable rabbitmq_management                             --开启WEB插件
        rabbitmq-service install                                                --安装RabbitMQ服务
    c.运行
        rabbitmq-service start                                                  --启动
        rabbitmq-service stop                                                   --停止
        rabbitmq-service remove                                                 --卸载
        rabbitmqctl.bat add_user  sxl  sxlpwd                                   --创建管理用户
        rabbitmqctl.bat set_user_tags sxl administrator                         --设置管理员
        http://127.0.0.1:15672/                                                 --访问
        guest / guest                                                           --登陆1
        admin / 123456                                                          --登陆2
        ------------------------------------------------------------------------
        5672                                                                    --RabbitMQ通信端口
        15672                                                                   --Web管理页面端口
        25672                                                                   --集群通信端口
    d.报错
        RabbitMQ service is already present - only updating service parameters
        -----------------------------------------------------------------------------------------------------
        C:\Users\mysla\AppData\Roaming\RabbitMQ -> 删除RabbitMQ
        cmd -> regedit -> 计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Ericsson\Erlang\ErlSrv\1.1 -> 删除RabbitMQ
    e.报错
        java.net.SocketException: socket closed
        2021-01-15 10:25:22.519  INFO 7324 --- [           main] o.s.a.r.c.CachingConnectionFactory       : Attempting to connect to: [192.168.0.58:5672]
        2021-01-15 10:25:22.635 ERROR 7324 --- [2.168.0.58:5672] c.r.c.impl.ForgivingExceptionHandler     : An unexpected connection driver error occured
        -----------------------------------------------------------------------------------------------------
        使用远程连接rabbitmq需要注意不要使用默认的guset账户,guest只能进行本地登录即(localhost),应新建用户配置权限进行远程访问

3.11 jdk+zookeeper+kafka

01.Jdk
    a.环境变量
        JAVA_HOME:C:\software\jdk-1.8.0_231
        JRE_HOME:%JAVA_HOME%\jre
        CLASS_PATH:.%JAVA_HOME%\lib
        path:%JAVA_HOME%\bin
    b.测试
        java -version

02.Zookeeper
    a.环境变量
        path:C:\software\apache-zookeeper-3.5.8\bin
    b.zoo.cfg
        dataDir=C:\\software\\apache-zookeeper-3.5.8\\conf\\data
    c.测试,默认端口2181
        zkserver                                                                --启动
    d.端口说明
        a.zookeeper有三个端口
            2181
            3888
            2888
        b.3个端口的作用
            2181:对cline端提供服务
            3888:选举leader使用
            2888:集群内机器通讯使用(Leader监听此端口)
        c.部署时注意
            1、单机单实例,只要端口不被占用即可
            2、单机伪集群(单机,部署多个实例),三个端口必须修改为组组不一样
                如:myid1 : 2181,3888,2888
                myid2 : 2182,3788,2788
                myid3 : 2183,3688,2688
            3、集群(一台机器部署一个实例)

03.Kafka
    a.环境变量
        path:C:\software\kafka-2.12\bin
    b.server.properties
        log.dirs=C:\\software\\kafka-2.12\\logs
        zookeeper.connect=localhost:2181
    c.测试,默认端口9092
        .\bin\windows\kafka-server-start.bat .\config\server.properties          --启动
    d.kafka.bat
        c:
        cd C:\software\apache-zookeeper-3.5.8\bin\
        zkserver
        timeout /t 20
        cd C:\software\kafka-2.12\
        .\bin\windows\kafka-server-start.bat .\config\server.properties
    e.闪退
        a.报错
            [2021-11-24 14:19:31,577] INFO [ZooKeeperClient Kafka server] Connected. (kafka.zookeeper.ZooKeeperClient)
            [2021-11-24 14:19:31,850] INFO Cluster ID = F5_E0Y5hRaaG9s_xgm5qpg (kafka.server.KafkaServer)
            [2021-11-24 14:19:31,874] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
            kafka.common.InconsistentClusterIdException: The Cluster ID F5_E0Y5hRaaG9s_xgm5qpg doesn't match stored clusterId Some(i6qZt03xSSy1SyP0jGCYDw) in meta.properties. The broker is trying to join the wrong cluster. Configured zookeeper.connect may be wrong.
                    at kafka.server.KafkaServer.startup(KafkaServer.scala:220)
                    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
                    at kafka.Kafka$.main(Kafka.scala:84)
                    at kafka.Kafka.main(Kafka.scala)
            [2021-11-24 14:19:31,876] INFO shutting down (kafka.server.KafkaServer)
            [2021-11-24 14:19:31,879] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
            [2021-11-24 14:19:31,985] INFO Session: 0x10000024a760003 closed (org.apache.zookeeper.ZooKeeper)
            [2021-11-24 14:19:31,985] INFO EventThread shut down for session: 0x10000024a760003 (org.apache.zookeeper.ClientCnxn)
            [2021-11-24 14:19:31,987] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
            [2021-11-24 14:19:31,990] INFO shut down completed (kafka.server.KafkaServer)
            [2021-11-24 14:19:31,990] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
            [2021-11-24 14:19:31,994] INFO shutting down (kafka.server.KafkaServer)
        b.解决1
            cd /export/servers/kafka_2.12-2.4.1/config
            cat server.properties 找到 log.dirs的配置项,小编的是 log.dirs=C:\software\kafka-2.12\logs
            进入 data,修改 meta.properties 文件
            把 cluster.id= 改成 Cluster ID的值,小编的是: F5_E0Y5hRaaG9s_xgm5qpg
        c.解决2
            根据 log.dirs=C:\software\kafka-2.12\logs 这个配置项,
            进入data文件夹下 cd C:\software\kafka-2.12\logs 删除所有的文件和文件夹,
            重新执行: nohup bin/kafka-server-start.sh config/server.properties &

04.注册服务
    nssm install kafka                                                          --NSSM注册服务
    net start kafka                                                             --NSSM启动服务

4 javascript

4.1 bio

00.node_modules
    a.npm
        a.安装
            npm install -g rimraf
            rimraf node_modules                                                     --执行命令删除
            echo %path%                                                             --刷新环境变量
        b.集成到npm脚本:在package.json中添加脚本,直接运行npm run clean
            {
              "scripts": {
                "clean": "rimraf node_modules"
              }
            }
    b.平台
        a.cmd
            rmdir /s /q node_modules                                                --/s表示递归删除,/q表示静默执行(不弹窗确认)
        b.powershell
            Remove-Item -Force -Recurse node_modules
        c.linux、macos
            rm -rf ./node_modules
    c.删不干净怎么办?
        a.清除npm缓存
            npm cache clean --force
        b.删除锁文件
            手动移除package-lock.json或yarn.lock
        c.重启IDE
            确保没有进程占用文件

01.node 14.16.1
    a.安装
        npm install -g cnpm --registry=https://registry.npm.taobao.org              --cnpm已无法下载
        npm install -g hexo
        npm install -g textlint
        npm install -g grunt
        -----------------------------------------------------------------------------------------------------
        npm uninstall -g cnpm
        npm uninstall -g hexo
        npm uninstall -g textlint
        npm uninstall -g grunt
    b.列表
        cnpm
        hexo
        textlint
        grunt
    c.版本
        cnpm --version
        hexo --version
        textlint --version
        grunt --version

02.node 20.10.0
    a.安装
        npm install -g vite                                                         --Node.js版本18+,只能通过npm安装,yarn安装报错
        npm install -g express express-generator
        npm install -g @nestjs/cli
        npm install -g koa-generator
        npm install -g typescript ts-node
        npm install -g create-react-app
        npm install -g create-next-app
        npm install -g @angular/cli
        npm install -g @tauri-apps/cli
        -----------------------------------------------------------------------------------------------------
        npm install -g pnpm
        npm install -g yarn
    b.列表
        pnpm(未安装)                                                               --Node.js版本18+
        vite
    c.版本
        pnpm --version
        vite -v
        express --version
        nest --version
        koa --version
        tsc --version
        rimraf --version
        create-react-app -V
        create-next-app -V
        ng v
        tauri -V

03.yarn
    a.安装
        yarn global add/remove vue/cli                                              --第2版,2.9.6
        yarn global add/remove @vue/[email protected]                                      --第3版,3.11.0
        yarn global add/remove @vue/cli                                             --第4版,4.5.12
        yarn global upgrade --latest @vue/cli                                       --升级版本
        -----------------------------------------------------------------------------------------------------
        vue -V && webpack -v                                                        --查看版本
        @vue/cli 5.0.8、webpack 5.36.2、webpack-cli 4.6.0
        -----------------------------------------------------------------------------------------------------
        yarn global add @vue/[email protected] webpack webpack-cli
        yarn global add @vue/cli webpack webpack-cli
    b.列表
        yarn
        vue-cli
        vuepress
        webpack

04.pnpm
    a.安装
        无
    b.列表
        pnpm
    c.版本
        pnpm store prune
        pnpm --version

05.桌面端
    a.electron
        electron支持Windows、macOS和Linux
        electron主要依赖HTML、CSS和JavaScript
        electron内置了Chromium渲染引擎和Node.js,确保了跨平台样式和API的一致性,尽管其体积较大
    b.tauri
        tauri还支持Android和iOS,但Linux兼容性较差
        tauri使用原生WebView,体积较小,但在不同操作系统上可能面临兼容性问题
        tauri支持多种编程语言开发,如JavaScript、TypeScript、Swift和Rust
        tauri的构建和打包过程相对简单,适合小型应用开发,但依赖安装体积较大。

4.2 bun

01.安装
    a.curl
        curl -fsSL <https://bun.sh/install> | bash
    b.node
        npm install -g bun
    c.powershell
        powershell -c "irm bun.sh.cn/install.ps1 | iex"

02.命令
    a.分类1
        bun run index.tsx                                              --开箱即支持 TS 和 JSX
        bun run start                                                  --运行 start 脚本
        bun install <pkg>                                              --安装软件包
        bun build ./index.tsx                                          --为浏览器打包项目
        bun test                                                       --运行测试用例
        bunx cowsay 'Hello, world!'                                    --运行软件包
    b.分类2
        bun init                                                       --初始化
        bun install                                                    --安装
        bun run dev                                                    --相当于bun run --watch src/index.ts
        bun run start                                                  --相当于bun run src/index.ts

4.3 nvm

01.环境变量
    NVM_HOME:C:\software\nvm
    NVM_SYMLINK:C:\Program Files\nodejs
    path:%NVM_HOME%
          %NVM_SYMLINK%
          %NVM_SYMLINK%\node-global

02.测试
    nvm v                                                                           --查看版本:1.1.11

03.配置
    删除nodejs普通文件夹,使用nvm use 14.16.1来重新生成硬链接文件夹(图标从 普通 -> 带快捷方式)
    ---------------------------------------------------------------------------------------------------------
    npm config set registry http://20.198.22.55:8082/repository/npm-central-psbc    --设置私服
    npm config set prefix "C:\Program Files\nodejs\node-global"                     --全局cache位置
    npm config set cache "C:\Program Files\nodejs\node-cache"                       --全局global位置
    npm config ls                                                                   --查看是否修改成功
    npm login                                                                       --登陆
    ---------------------------------------------------------------------------------------------------------
    root: C:\software\nvm
    path: C:\Program Files\nodejs
    node_mirror: https://npm.taobao.org/mirrors/node/                               --追加到settings.txt
    npm_mirror: https://npm.taobao.org/mirrors/npm/                                 --追加到settings.txt

04.更改版本
    nvm list available                                                              --查看node版本
    where node                                                                      --查看node位置
    --------------------------------------------------------------------------------
    nvm ls                                                                          --查看已安装
    nvm install 16.20.1                                                             --安装指定版本
    nvm install latest                                                              --安装最新版本
    nvm use 16.20.1                                                                 --使用该版本
    --------------------------------------------------------------------------------
    nvm alias default v14.16.1                                                      --修改默认版本
    nvm alias default v20.10.0                                                      --修改默认版本
    nvm alias default v22.19.0                                                      --修改默认版本

05.常见命令
    nvm install <version>                                                           --安装相应版本
    nvm uninstall <version>                                                         --卸载指定的版本
    nvm use <version>                                                               --切换使用指定的版本node
    nvm ls                                                                          --列出所有版本
    nvm version                                                                     --查看当前node版本
    nvm current                                                                     --显示当前node版本 nvm version一样
    nvm install                                                                     --安装最新版本nvm
    nvm alias default <version>                                                     --修改默认版本
    nvm alias default v20.10.0                                                      --修改默认版本

4.4 npm

01.环境变量
    cd C:\Program Files\nodejs\node-global
    ---------------------------------------------------------------------------------------------------------
    path:C:\software\Nodejs
          C:\software\Nodejs\node-global

02.测试
    node -v                                                                         --查看版本:10.16.0

03.配置1
    npm config set registry http://20.198.22.55:8082/repository/npm-central-psbc    --设置私服
    npm config set prefix "C:\software\Nodejs\node-global"                          --全局cache位置
    npm config set cache "C:\software\Nodejs\node-cache"                            --全局global位置
    npm config ls                                                                   --查看是否修改成功
    npm login                                                                       --登陆
    ---------------------------------------------------------------------------------------------------------
    npm set registry http://172.17.8.54/
    npm adduser --registry http://172.17.8.54/
    npm profile set password --registry http://172.17.8.54/

04.配置2
    npm cache clean --force                                                         --清理索引
    pnpm install                                                                    --安装
    ---------------------------------------------------------------------------------------------------------
    npm config set registry https://registry.npmjs.org/                             --设置国外镜像
    npm config set registry https://registry.npm.taobao.org                         --设置国内镜像1
    npm config set registry https://registry.npmmirror.com                          --设置国内镜像2
    npm config get registry                                                         --查看镜像
    ---------------------------------------------------------------------------------------------------------
    npm install -g cnpm --registry=https://registry.npm.taobao.org                  --构建工具:cnpm
    npm install -g yarn --registry=https://registry.npm.taobao.org                  --构建工具:yarn
    ---------------------------------------------------------------------------------------------------------
    npm install -g hexo && npm install -g textlint && npm install -g grunt          --常用工具:hexo、grunt
    cnpm --version && hexo --version && textlint --version && grunt --version       --检测命令

05.命令
    npm install                         yarn install                                --安装
    npm unintall                        yarn remove                                 --卸载
    npm install xxx --global/-g         yarn global add xxx                         --全局安装
    npm install xxx --save/-S           yarn add xxx                                --安装:部署环境
    npm install xxx --save-dev/-D       yarn add xxx --dev/-D                       --安装:开发环境
    npm update                          yarn upgrade                                --更新
    npm update -g                       yarn global upgrade                         --全局更新
    npm unintall xxx                    yarn remove xxx                             --卸载
    npm cache clean                     yarn cache clean                            --清除缓存
    rm -rf node_modules && npm install  yarn upgrade                                --重装
    ---------------------------------------------------------------------------------------------------------
    npm install -g lanyuncodingui --registry https://registry.npmmirror.com

4.5 yarn

01.环境变量
    cd C:\software\Yarn\yarn-global\node_modules\.bin
    ---------------------------------------------------------------------------------------------------------
    path:C:\software\Yarn\bin
          C:\software\Yarn\yarn-global\node_modules\.bin

02.测试
    yarn --version                                                                  --查看版本:1.22.4

03.配置
    yarn config set prefix "C:\software\Yarn"                                       --全局bin位置
    yarn config set cache-folder "C:\software\Yarn\yarn-cache"                      --全局cache位置
    yarn config set global-folder "C:\software\Yarn\yarn-global"                    --全局global位置
    yarn config set link-folder "C:\software\Yarn\yarn-link"                        --全局link位置
    yarn global bin && yarn global dir && yarn cache dir                            --查看是否修改成功

04.镜像
    yarn config set https://registry.yarnpkg.com                                    --设置国外镜像
    yarn config set registry https://registry.npm.taobao.org                        --设置国内镜像
    yarn config get registry                                                        --查看镜像

05.命令
    yarn install                                                                    --安装
    yarn run dev                                                                    --本地运行
    yarn run build                                                                  --构建
    yarn cache clean                                                                --等同pnpm store prune
    ---------------------------------------------------------------------------------------------------------
    npm install                         yarn install                                --安装
    npm unintall                        yarn remove                                 --卸载
    npm install xxx --global/-g         yarn global add xxx                         --全局安装
    npm install xxx --save/-S           yarn add xxx                                --安装:部署环境
    npm install xxx --save-dev/-D       yarn add xxx --dev/-D                       --安装:开发环境
    npm update                          yarn upgrade                                --更新
    npm update -g                       yarn global upgrade                         --全局更新
    npm unintall xxx                    yarn remove xxx                             --卸载
    npm cache clean                     yarn cache clean                            --清除缓存
    rm -rf node_modules && npm install  yarn upgrade                                --重装

4.6 pnpm

01.安装
    iwr https://get.pnpm.io/install.ps1 -useb | iex                                 --使用PowerShell运行(Node.js版本18+)
    C:\Users\mysla\AppData\Local\pnpm 移动至 C:\software\pnpm

02.环境变量
    path:C:\software\pnpm

03.测试
    where pnpm
    pnpm --version

04.配置
    a.在安装目录下新建四个文件夹,用来配置pnpm的路径,配置路径有两种方法:修改配置文件,或者PowerShell运行命令。
        pnpm-global:pnpm全局安装路径
        pnpm-store:pnpm全局仓库路径(类似 .git 仓库)
        pnpm-state:pnpm创建pnpm-state.json文件的目录
        pnpm-cache:pnpm全局缓存路径
    b.CMD管理员
        pnpm config set global-dir C:\software\pnpm\pnpm-global
        pnpm config set global-bin-dir C:\software\pnpm
        pnpm config set store-dir C:\software\pnpm\pnpm-store
        pnpm config set state-dir C:\software\pnpm\pnpm-state
        pnpm config set cache-dir C:\software\pnpm\pnpm-cache
        -----------------------------------------------------------------------------------------------------
        上述配置,会生成C:\Users\mysla\AppData\Local\pnpm\config\rc文件
    c.验证
        pnpm c get
    d.使用
        pnpm store prune                                                                --清理索引
        pnpm install                                                                    --安装
        -----------------------------------------------------------------------------------------------------
        pnpm store prune,20250121,修改了前端根路径为ydszcode,但是部分请求仍为ydszboot,使用此命令解决了该问题

05.镜像
    a.官方
        pnpm get registry                                                               --查看源
        pnpm --registry https://registry.npmmirror.com install axios                    --安装包时临时使用镜像源
        pnpm config set registry https://registry.npmmirror.com                         --国内镜像
        pnpm config set registry https://registry.npmjs.org                             --官方镜像
    b.verdaccio
        pnpm set registry http://172.17.8.54/
        pnpm adduser --registry http://172.17.8.54/
        pnpm profile set password --registry http://172.17.8.54/

06.命令
    a.汇总
        pnpm install                                                                    --安装
        pnpm run dev                                                                    --本地运行
        pnpm run build                                                                  --构建
        pnpm store prune                                                                --清理索引
        pnpm i --registry https://registry.npmmirror.com                                --安装
        -----------------------------------------------------------------------------------------------------
        pnpm add @element-plus/icons-vue                                                --依赖
        pnpm add js-base64                                                              --依赖
    b.对比
        npm install                         pnpm install                                --安装
        npm unintall                        pnpm remove                                 --卸载
        npm install xxx --global/-g         pnpm global add xxx                         --全局安装
        npm install xxx --save/-S           pnpm add xxx                                --安装:部署环境
        npm install xxx --save-dev/-D       pnpm add xxx --dev/-D                       --安装:开发环境
        npm update                          pnpm upgrade                                --更新
        npm update -g                       pnpm global upgrade                         --全局更新
        npm unintall xxx                    pnpm remove xxx                             --卸载
        npm cache clean                     pnpm cache clean                            --清除缓存
        rm -rf node_modules && npm install  pnpm upgrade                                --重装

4.7 pm2

01.全局安装pm2
    a.全局安装pm2
        npm install pm2 -g
    b.全局安装pm2-windows-startup
        npm install pm2-windows-startup -g                              --windows注册服务包
    c.执行命令
        pm2-startup install
    d.测试
        pm2 -v

02.windows下配置pm2开机自动开启服务
    a.全局安装pm2-windows-service
        npm install pm2-windows-service -g                              --windows注册服务包
    b.添加.pm2的系统环境变量
        PM2_HOME=C:\Users\13514\.pm2
    c.执行命令
        pm2-service-install
        Perform environment setup (recommended)? No
    d.测试
        services.msc

03.部署阶段
    a.编译easy-mock文件
        npm run build
    b.启动
        pm2 start app.js -i 4 -n Easymock                               --启动
        pm2 save                                                        --保存NodeJS服务
        pm2 list                                                        --查看列表
        pm2 monit                                                       --查看代码运行状态
        pm2 startup                                                     --创建开机启动
        127.0.0.1:7300                                                  --访问

04.常见参数(https://pm2.keymetrics.io/docs/usage/quick-start/)
    --watch
        监听应用目录的变化,一旦发生变化,自动重启。如果要精确监听、不见听的目录,最好通过配置文件
    -i --instances
        启用多少个实例,可用于负载均衡。如果-i 0或者-i max,则根据当前机器核数确定实例数目
    --ignore-watch
        排除监听的目录/文件,可以是特定的文件名,也可以是正则
    -n --name
        应用的名称,查看应用信息的时候可以用到
    -o --output
        标准输出日志文件的路径
    -e --error
        错误输出日志文件的路径

05.常见命令
    a.官方样例使用指南
        pm2 examples
    b.启动
        pm2 start  路径   --name  名称 --watch
        pm2 start app.js                                                --启动app.js应用
        pm2 start app.js --name demo                                    --启动应用并设置name
        pm2 start app.sh                                                --脚本启动
    c.查看列表
        pm2 ls
    d.停止
        pm2 stop all                                                    --停止所有应用
        pm2 stop [AppName]                                              --根据应用名停止指定应用
        pm2 stop [ID]                                                   --根据应用id停止指定应用
    e.重启
        pm2 restart 名称
    f.删除进程
        pm2 delete all                                                  --杀死全部进程
        pm2 delete [AppName]                                            --根据应用名关闭并删除应用
        pm2 delete [ID]                                                 --根据应用ID关闭并删除应用
    g.自动重启
        pm2 start 路径 --name 名称 --watch
        pm2 start app.js –watch
    h.查看日志
        pm2 log
    i.更新
        pm2 update
    j.保存
        pm2 save
    k.创建开机启动
        pm2 startup
    l.其他命令
        pm2 list                                                        --显示所有进程状态
        pm2 monit                                                       --监视所有进程
        pm2 logs                                                        --显示所有进程日志
        pm2 stop all                                                    --停止所有进程
        pm2 restart all                                                 --重启所有进程
        pm2 reload all                                                  --0秒停机重载进程
        pm2 stop 0                                                      --停止指定的进程
        pm2 restart 0                                                   --重启指定的进程
        pm2 startup                                                     --产生init脚本,保持进程存活
        pm2 delete 0                                                    --杀死指定的进程
        pm2 delete all                                                  --杀死全部进程

06.PM2配置文件方式启动
    a.生成示例配置文件
        pm2 ecosystem                                                   --生成一个示例JSON配置文件
        pm2 init                                                        --初始化
    b.配置文件示例
    {
        "apps": {
            "name": "wuwu",                                             --项目名
            "script": "./bin/www",                                      --执行文件
            "cwd": "./",                                                --根目录
            "args": "",                                                 --传递给脚本的参数
            "interpreter": "",                                          --指定的脚本解释器
            "interpreter_args": "",                                     --传递给解释器的参数
            "watch": true,                                              --是否监听文件变动然后重启
            "ignore_watch": [                                           --不用监听的文件
                "node_modules",
                "logs"
            ],
            "exec_mode": "cluster_mode",                                --应用启动模式
            "instances": 4,                                             --应用启动实例个数
            "max_memory_restart": 8,                                    --最大内存限制数
            "error_file": "./logs/app-err.log",                         --错误日志文件
            "out_file": "./logs/app-out.log",                           --正常日志文件
            "merge_logs": true,                                         --设置追加日志
            "log_date_format": "YYYY-MM-DD HH:mm:ss",                   --指定日志文件的时间格式
            "min_uptime": "60s",                                        --应用运行少于时间被认为是异常启动
            "max_restarts": 30,                                         --最大异常重启次数
            "autorestart": true,                                        --默认为true, 发生异常的情况自动重启
            "cron_restart": "",                                         --时间格式重启应用,支持cluster模式
            "restart_delay": "60s"                                      --异常重启情况下,延时重启时间
            "env": {
               "NODE_ENV": "production",                                --环境参数,指定当前环境为生产环境
               "REMOTE_ADDR": ""
            },
            "env_dev": {
                "NODE_ENV": "development",                              --环境参数
                "REMOTE_ADDR": ""
            },
            "env_test": {                                               --环境参数
                "NODE_ENV": "test",
                "REMOTE_ADDR": ""
            }
        }
    }

4.8 eslint

01.说明
    .eslintrc.js                        需要返回一个对象
    .eslintrc           yaml/json       可加后缀名:.yaml、.yml、.json
    eslintrc.toml       key-value       可加后缀名:只能为toml
    eslintrc.config.js                  需要返回一个对象
    package.json                        加上"prettier"属性
    eslint --init                       创建命令

02.安装
    npm install --save-dev eslint babel-eslint vue-eslint-parser eslint-plugin-vue eslint-config-alloy

03.使用
    .eslintrc.js

04.配置(Languages&Frameworks -> JavaScript -> ESLint -> Manual ESlint configuration)
    ESLint package:D:\software\JavaScript\Nodejs\node-global\node_modules\textlint
    Working directories:
    Configuration File:
    Additional rules directory:
    Extra eslint options:
    Run to files:{**/*,*}.{js,ts,jsx,tsx,html,vue}
    Run eslint --fix on save

4.9 husky

01.Husky概述
    a.定义
        Husky 是一个用于在 Git 钩子上运行脚本的工具。
        它可以帮助开发者在特定的 Git 操作(如提交、推送等)之前或之后执行自定义脚本,从而提高代码质量和开发效率。
    b.用途
        自动化代码检查和格式化
        运行测试套件
        检查提交信息格式
        防止不符合标准的代码被提交

02.安装和配置
    a.安装Husky
        # 使用 npm
        npm install husky --save-dev
        # 使用 yarn
        yarn add husky --dev
    b.初始化Husky
        npx husky install
    c.添加到package.json
        {
          "scripts": {
            "prepare": "husky install"
          }
        }

03.配置Git钩子
    a.创建钩子
        npx husky add .husky/pre-commit "npm test"                --这将在每次提交之前运行npm test
    b.常用钩子示例
        pre-commit:在提交之前运行脚本。
        commit-msg:在提交信息输入后运行脚本。
        pre-push:在推送之前运行脚本。

4.10 deploy

01.静态服务器
    a.打包
        npm run buid
    b.安装服务组件(静态服务)
        npm install -g serve
    c.运行
        serve dist

02.动态服务器:Tomcat
    a.配置webpack.prod.conf.js
        output: {
            publicPath: '/myvue/'  --配置访问时的项目名
        }
    b.打包成dist
        略
    c.将dist拷贝到tomcat/webapps中,并且再将dist修改成项目名myvue
        略
    d.启动tomcat,运行
        略

4.11 prettier

01.说明
    .prettierrc.js                      需要返回一个对象
    .prettierrc         yaml/json       可加后缀名:.yaml、.yml、.json
    .prettierrc.toml    key-value       可加后缀名:只能为toml
    prettier.config.js                  需要返回一个对象
    package.json                        加上"prettier"属性

02.安装
    npm install --save-dev --save-exact prettier

03.使用
    .prettierrc.js

04.配置(Languages&Frameworks -> JavaScript -> Prettier)
    Prettier packages:D:\software\JavaScript\Nodejs\node-global\node_modules\prettier
    Run to files:{**/*,*}.{js,ts,jsx,tsx,html,vue}
    On coe reformat
    On save

4.12 typescript

01.安装
    npm install -g typescript                                           --编译为JS,可以JS共存
    npm install -g ts-node                                              --编译为JS,可以JS共存
    tsc --version

02.示例
    a.编写hello.ts
        function sayHello(person: string) {
            return 'Hello, ' + person;
        }

        let user = 'Tom';
        console.log(sayHello(user));
    b.编译
        tsc hello.ts                                                    --编译为hello.js
        -----------------------------------------------------------------------------------------------------
        function sayHello(person) {
            return 'Hello, ' + person;
        }
        var user = 'Tom';
        console.log(sayHello(user));

5 javascript

5.1 bio

00.历史发展
    a.Node.js
        Ryan Dahl于2009年发布了Node.js
        虽然它不是第一个服务器端JavaScript运行时,但Node.js迅速崭露头角
        2023年发布了第20版,Node.js拥有最大的开发生态系统,拥有320万个模块,每周下载量接近5000亿次
    b.Deno
        2020年,Ryan Dahl发布了Deno,它是“noDe”的一种混合体
        旨在现代化JavaScript开发并解决Node.js安全性、API兼容性、工具和模块管理方面的传统问题
        虽然Deno受到了积极的评价,但尚未挑战Node的主导地位
    c.Bun
        2022年,Jarred Sumner发布了Bun,因为他在开发Next.js项目时对Node.js的速度感到不满
        Bun使用JavaScriptCore引擎,该引擎驱动WebKit浏览器,如Safari,而不是Node.js、Deno和Chrome中使用的V8引擎
        Bun运行时侧重于性能和开发人员体验。其目标是消除速度慢和复杂性,而不是放弃JavaScript的所有优点
        Bun可以比Node.js更快地发展,后者必须与现有的JavaScript和npm生态系统保持(基本)向后兼容
        与Deno一样,Bun对JavaScript和TypeScript本地支持,无需第三方转译器或配置
        Bun正在成为Node.js、Deno、无服务器运行时、构建和测试工具的即插即用替代品
        它可以替代npm、npx、yarn、TypeScript编译器、dotenv、nodemon、pm2、Webpack、Babel和Jest
        为在单一平台上开发应用程序提供了一个完整的多合一工具箱
    d.Bun
        在内部Bun使用ES模块,支持顶级await,翻译CommonJS,并实现了Node的node_modules解析算法
        Bun将模块缓存到~/.bun/install/cache/中,并使用硬链接将它们“复制”到项目的node_modules目录中
        因此,您系统上的所有项目都将引用同一库的单个实例,这减少了磁盘空间需求并提高了安装性能

01.版本管理
    a.node/golang/python
        版本管理工具,不要使用C盘复制F盘的方式来安装,请使用正规步骤
        -----------------------------------------------------------------------------------------------------
        C:\Users\mysla>nvm ls
            22.19.0
            20.10.0
          * 14.16.1 (Currently using 64-bit executable)
        -----------------------------------------------------------------------------------------------------
        C:\Users\mysla>g ls
          1.21.12
        * 1.22.5
        -----------------------------------------------------------------------------------------------------
        C:\Users\mysla>pyenv versions
          3.11.2
          3.6.2
          3.7.2
          3.8.2
        * 3.9.6 (set by C:\software\pyenv\version)
        -----------------------------------------------------------------------------------------------------
        https://asdf-vm.com/
        https://github.com/jdx/mise
    b.注意事项
        a.jdk
            m2仓库可以复制
            -------------------------------------------------------------------------------------------------
            C:\Users\mysla\.m2\settings.xml
            如果aliyun无法下载,请注释如下部分
            <mirrors>
              <mirror>
                <id>aliyunmaven</id>
                <mirrorOf>*</mirrorOf>
                <name>阿里云公共仓库</name>
                <url>https://maven.aliyun.com/repository/public</url>
              </mirror>
            </mirrors>
        b.node
            如果进度不动,请使用npmmirror镜像
            npm config get registry
            npm config set registry https://registry.npmmirror.com
        c.golang
            如果进度不动,请使用golang镜像
            [+] G_MIRROR => https://golang.google.cn/dl/
        d.python
            如果进度不动,请检查是否开启Clash代理
            下载python版本,命令行需clash设置TUN模式;镜像为https://www.python.org/ftp/python
            下载包,默认镜像位置为C:\Users\13514\pip\pip.ini,网络问题关闭Clash,权限开启CMD管理员

02.npm、pnpm和yarn都是JavaScript包管理工具
    a.依赖管理结构
        npm: 使用嵌套的node_modules结构,可能导致重复安装和"依赖地狱"问题。
        yarn: 使用扁平化的node_modules结构,减少了重复安装,但可能引发版本冲突。
        pnpm: 使用符号链接和内容寻址存储,创建一个非扁平化的node_modules结构,有效解决了重复安装和幽灵依赖问题。
        -----------------------------------------------------------------------------------------------------
        使用pnpm来代替npm进行包管理,它的设计目标就是【完全兼容】npm和Yarn
    b.性能
        npm: 早期版本较慢,但近期版本有所改进。
        yarn: 比早期npm快,使用并行安装和缓存机制。
        pnpm: 通常是最快的,因为它的链接方式和存储结构更高效。
    c.磁盘空间使用
        npm和yarn: 每个项目都有完整的node_modules副本。
        pnpm: 使用硬链接和符号链接,大幅减少磁盘空间使用。
    d.锁文件
        npm: 使用package-lock.json
        yarn: 使用yarn.lock
        pnpm: 使用pnpm-lock.yaml
        -----------------------------------------------------------------------------------------------------
        根据 npm/yarn/pnpm 官方文档建议:
        团队应该统一使用同一种包管理器
        如果使用 yarn,建议将 yarn.lock 提交到仓库
        如果使用 npm,建议将 package-lock.json 提交到仓库
        如果使用 pnpm,建议将 pnpm-lock.yaml 提交到仓库
        但是不要同时使用多个锁文件,这样会导致冲突。
    e.工作空间支持
        npm: 从v7开始支持工作空间
        yarn: 有良好的工作空间支持
        pnpm: 原生支持工作空间,且实现更高效
    f.安全性
        npm: 安全性一般,但在不断改进
        yarn: 提供了一些额外的安全特性
        pnpm: 由于其独特的结构,天然地避免了一些安全问题
    g.社区和生态系统
        npm: 最广泛使用,生态系统最大
        yarn: 也有广泛的采用,特别是在React社区
        pnpm: 相对较新,但正在快速增长
    h.配置和使用
        npm: 配置最简单,学习曲线最平缓
        yarn: 配置相对简单,提供了一些额外的功能
        pnpm: 可能需要一些额外的学习,但提供了更多的高级特性
    i.yarn.lock 文件的变更通常是由以下原因导致的
        自动更新原因
        当你执行 yarn install 或 yarn add/remove 命令时
        当你更新了 package.json 中的依赖版本时
        当你安装了新的依赖包时
        当依赖包有更新时
        -----------------------------------------------------------------------------------------------------
        检查当前状态
        可以通过以下命令查看具体变更:
        git status
        git diff yarn.lock
        -----------------------------------------------------------------------------------------------------
        处理建议
        如果你确定没有主动修改过依赖:
        # 方案1:放弃本地 yarn.lock 的修改
        git checkout -- yarn.lock
        git pull
        # 方案2:如果你不确定是否需要保留本地修改
        git stash
        git pull
        # 然后检查是否需要恢复本地修改
        # 如果需要恢复:git stash pop
        # 如果不需要恢复:git stash drop
        -----------------------------------------------------------------------------------------------------
        预防措施
        在执行 git pull 之前,确保没有运行 yarn install 等命令
        团队成员最好使用相同版本的 yarn
        如果要更新依赖,最好单独提交 yarn.lock 的变更
    j.删除并重新生成锁文件的步骤如下:
        删除锁文件
        # 删除所有锁文件
        rm -f package-lock.json yarn.lock pnpm-lock.yaml
        -----------------------------------------------------------------------------------------------------
        重新生成锁文件
        根据你使用的包管理器选择对应的命令:
        # 如果使用 yarn
        yarn install
        # 如果使用 npm
        npm install
        # 如果使用 pnpm
        pnpm install
        -----------------------------------------------------------------------------------------------------
        注意事项
        删除锁文件后重新生成可能会导致依赖版本的变化
        建议在重新生成后测试项目是否正常运行
        如果出现问题,可以从 git 历史中恢复原来的锁文件:
        git checkout origin/produce-ui-0.1.1 -- yarn.lock
        -----------------------------------------------------------------------------------------------------
        建议团队统一使用一种包管理器
        只保留一个锁文件,避免多个锁文件共存
        重新生成后,先在本地测试确认无问题,再进行后续操作

03.验证 node_modules 的完整性
    a.使用 yarn check 命令(如果使用 yarn)
        yarn check --integrity
        这个命令会检查安装的依赖是否与 yarn.lock 文件匹配
    b.使用 npm verify 命令(如果使用 npm)
        npm verify
        这会验证缓存中的包。
    c.检查依赖树
        # 使用 yarn
        yarn list
        # 或使用 npm
        npm list
        # 只查看顶层依赖
        yarn list --depth=0
        npm list --depth=0
    d.清理并重新安装
        如果怀疑安装不完整,可以完全重新安装:
        # 删除现有的 node_modules
        rm -rf node_modules
        # 清理缓存
        yarn cache clean   # 如果使用 yarn
        npm cache clean --force   # 如果使用 npm
        # 重新安装
        yarn install
        # 或
        npm install
    e.检查特定包的安装
        # 检查某个具体的包是否正确安装
        ls node_modules/包名
    f.检查依赖冲突
        yarn why 包名
        # 或
        npm why 包名
    g.使用第三方工具
        depcheck: 检查未使用的依赖
        npx depcheck
    h.检查错误和警告
        # 运行项目的测试脚本
        yarn test
        # 或
        npm test
    i.总结
        删除 node_modules 目录
        删除 lock 文件(yarn.lock 或 package-lock.json)
        清理缓存
        重新安装依赖

04.package.json
    a.基本信息
        name:项目的名称,通常用于标识项目
        version:项目的版本号,遵循语义化版本控制(semver)
        description:项目的简短描述
        keywords:与项目相关的关键字数组,便于搜索
        author:项目的作者信息
        license:项目的许可证类型
    b.依赖管理
        dependencies:项目运行时所需的依赖包。安装时会自动安装这些依赖
        devDependencies:项目开发和测试时所需的依赖包,不会在生产环境中安装
        peerDependencies:指定项目所需的宿主环境依赖,通常用于插件开发
        optionalDependencies:可选依赖包,即使安装失败也不会导致安装过程失败
        bundledDependencies 或 bundleDependencies:打包时需要包含的依赖包
    c.脚本和命令
        scripts:定义可执行的脚本命令,使用 npm run <script-name> 执行。例如,start、test、build 等
    d.配置和其他
        main:指定项目的入口文件
        repository:项目的代码仓库信息
        bugs:项目的错误报告地址
        homepage:项目的主页 URL
        engines:指定项目运行所需的 Node.js 和 npm 版本
        files:指定发布到 npm 时需要包含的文件
        browser:指定浏览器环境下的入口文件,通常用于前端库
        man:指定项目的手册页文件
        bin:指定可执行文件的路径,用于命令行工具
        config:用于配置项目的自定义参数
        private:布尔值,若为 true,则表示该项目不会被发布到 npm
    e.package.json:版本号前的符号
        "vue-router": "^4.0.14":
        ^ 符号表示“插入符号”版本范围
        允许更新到 4.x.x 版本中的最新版本,但不包括 5.0.0 或更高版本
        例如,如果有 4.1.0 或 4.0.15 发布,使用 ^4.0.14 会自动更新到这些版本
        -----------------------------------------------------------------------------------------------------
        "vue-router": "4.0.14":
        没有前缀符号,表示精确版本
        只安装 4.0.14 版本,不会自动更新到任何其他版本,即使有补丁或次要版本更新
    f.pnpm-lock.yaml:版本锁定
        vue-router:
          specifier: ^4.0.14
          version: 4.5.0([email protected]([email protected]))
        -----------------------------------------------------------------------------------------------------
        vue-router:
        specifier: ^4.0.14:表示在 package.json 中指定的版本范围。^4.0.14 允许安装 4.x.x 版本中的最新版本,但不包括 5.0.0 或更高版本
        version: 4.5.0:表示实际安装的 vue-router 版本。在满足 ^4.0.14 的条件下,4.5.0 是符合条件的最新版本
        [email protected]:表示 vue-router 依赖的 vue 版本为 3.5.13
        [email protected]:表示项目中使用的 TypeScript 版本为 4.9.5
    g.更改依赖后,重新安装
        更新依赖:运行 pnpm install 命令。这将根据 package.json 中的版本要求更新 node_modules 中的依赖,并更新 pnpm-lock.yaml 文件以反映这些更改
        检查 pnpm-lock.yaml:pnpm install 会自动更新 pnpm-lock.yaml 文件以匹配 package.json 中的新版本要求。你可以查看 pnpm-lock.yaml 文件,确保 vue-router 的版本已经更新为 4.0.14
        验证项目:运行项目的测试或启动项目,确保更改后的依赖版本不会引入新的问题

05.npm run dev 卡在 95% 的问题
    a.原因
        vue项目的安装依赖还是基于之前的node版本,与升级的node版本不相匹配,所以启动不了
        因为nodejs在17+版本后分布的OpenSSL3.0对允许算法和密钥大小增加了严格的限制,造成了这些影响
    b.解决
        a.一次性的方法,关闭之后就没用了,下次打开还的来一遍
            set NODE_OPTIONS=--openssl-legacy-provider
        b.永久性的方法
            安装个node版本管理工具(nvm)
            把node版本将到17版本以下
            (node版本降到17+下配置还的改为原来的)
        c.在package.json中输入
            "scripts": {
                "serve": "set NODE_OPTIONS=--openssl-legacy-provider &&  vue-cli-service serve",
            },

06.关闭sourcemap为false
    a.报错
        ERROR  error during build:                                                                                                      10:32:17
        Error: Multiple conflicting contents for sourcemap source /root/hr-project/hr-front/src/views/demo/tree/EditTree.vue
            at error (file:///root/hr-project/hr-front/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
            at Link.traceMappings (file:///root/hr-project/hr-front/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:13941:32)
            at collapseSourcemaps (file:///root/hr-project/hr-front/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:14034:63)
            at Chunk.render (file:///root/hr-project/hr-front/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:14930:19)
            at runMicrotasks (<anonymous>)
            at processTicksAndRejections (node:internal/process/task_queues:96:5)
            at async file:///root/hr-project/hr-front/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:15812:40
            at async Promise.all (index 374)
            at async Bundle.addFinalizedChunksToBundle (file:///root/hr-project/hr-front/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:15810:9)
            at async Bundle.generate (file:///root/hr-project/hr-front/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:15790:13)
            at async file:///root/hr-project/hr-front/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:23795:27
            at async catchUnfinishedHookActions (file:///root/hr-project/hr-front/node_modules/vite/node_modules/rollup/dist/es/shared/rollup.js:23126:20)
            at async doBuild (file:///root/hr-project/hr-front/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:45405:22)
            at async build (file:///root/hr-project/hr-front/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:45233:16)
            at async CAC.<anonymous> (file:///root/hr-project/hr-front/node_modules/vite/dist/node/cli.js:756:9)
        error Command failed with exit code 1.
        info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    b.这个错误的关键信息是:
        Error: Multiple conflicting contents for sourcemap source /root/hr-project/hr-front/src/views/demo/tree/EditTree.vue
        这表明在构建过程中出现了 sourcemap 冲突的问题。经过查找,这种错误通常有以下几个可能的原因和解决方案
    c.解决
        a.Vite 配置问题
            在 GitHub issues 中发现类似问题 (#8617, #4769)
            可以尝试在 vite.config.js 中修改 sourcemap 配置:
            build: {
              sourcemap: false // 或者改为 'inline'
            }
        b.重复引入问题
            检查 EditTree.vue 是否在项目中被重复引入
            确认是否存在循环依赖的情况
        c.Vite 版本兼容性
            建议检查 Vite 的版本,某些版本存在此类 bug
            可以尝试升级或降级 Vite 版本
        d.建议按以下步骤尝试解决
            首先尝试最简单的方案 - 关闭 sourcemap
            如果问题仍然存在,检查项目中 EditTree.vue 的引用情况
            如果以上都不能解决,可以尝试清除依赖缓存:
            rm -rf node_modules/.vite
            yarn install

07.git pull有冲突
    a.报错
        [root@localhost hr-front]# git pull
        remote: Counting objects: 5, done.
        remote: Compressing objects: 100% (3/3), done.
        remote: Total 3 (delta 2), reused 0 (delta 0)
        展开对象中: 100% (3/3), 340 字节 | 0 字节/秒, 完成.
        来自 ssh://git.jggroup.cn:9022/server/jeecg-vue3
        afbc5f9..bb977ae produce-ui-0.1.1 -> origin/produce-ui-0.1.1
        更新 c1db5e1..bb977ae
        error: 您对下列文件的本地修改将被合并操作覆盖:
        yarn.lock
        请在合并前提交或贮藏您的修改。
        正在终止
    b.说明
        这个错误提示表明你在本地对 yarn.lock 文件进行了修改,而远程仓库也对这个文件有更新。
        Git 无法自动合并这些更改,因为这可能会覆盖你的本地修改。
    c.解决
        a.提交你的本地更改
            如果你希望保留本地对 yarn.lock 文件的更改,可以先将这些更改提交到本地仓库:
            git add yarn.lock
            git commit -m "Save local changes to yarn.lock"
            然后,再次尝试执行 git pull:
            git pull
        b.贮藏(stash)你的本地更改
            如果你不想立即提交本地更改,可以将它们暂时贮藏起来,然后拉取远程更改:
            git stash
            git pull
            git stash pop
            git stash pop 会将贮藏的更改应用到当前分支。如果出现冲突,你需要手动解决。
        c.放弃本地更改
            如果你确定不需要保留本地的 yarn.lock 更改,可以放弃这些更改并恢复到远程版本:
            git checkout -- yarn.lock
            git pull
        d.使用 --autostash 选项
            你也可以在拉取时使用 --autostash 选项,它会自动贮藏你的本地更改,然后执行拉取操作:
            git pull --autostash
        e.总结
            选择哪种方法取决于你对 yarn.lock 文件本地更改的需求。
            如果你希望保留这些更改,使用提交或贮藏的方法;如果不需要保留,可以选择放弃更改。

08.node版本不匹配
    a.报错
        [3/6] Fetching packages...
        error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.19.0"
        error Found incompatible module.
        info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
    b.说明
        关于 urix 的警告:
        这只是一个警告,表明 urix 包已被弃用。通常这不会阻止安装,但你可能需要在将来更新依赖它的包。
        关于 @volar/vue-typescript 和 @volar/vue-code-gen 的警告:
        这些警告表明这些包已被重命名。你可以考虑更新你的 package.json 文件,使用新的包名。
        主要错误:Node.js 版本不兼容
        错误信息显示 [email protected] 需要 Node.js 18 或更高版本,但你当前使用的是 Node.js 16.19.0。
    c.解决
        a.更新 Node.js:
            最直接的解决方案是更新你的 Node.js 版本到 18 或更高。
            在 Linux 上,你可以使用 nvm(Node Version Manager)来管理 Node.js 版本:
            -------------------------------------------------------------------------------------------------
            nvm install 18
            nvm use 18
            如果你还没有安装 nvm,可以先安装它
        b.如果无法更新 Node.js,你可以尝试使用较旧版本的 commander:
            编辑你的 package.json 文件,将 commander 的版本改为兼容 Node.js 16 的版本,例如:
            "dependencies": {
              "commander": "^8.3.0"
            }
        c.清理缓存并重新安装:
            yarn cache clean
            yarn install
        d.如果问题仍然存在,可以尝试使用 npm 而不是 yarn
            npm install

09.验证node_modules
    a.命令
        yarn check --integrity
    b.报错
        yarn check v1.22.19
        warning package.json: No license field
        warning [email protected]: No license field
        warning Integrity check: System parameters don't match
        error Integrity check failed
        error Found 1 errors.
        info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
    c.说明
        "No license field" 警告:
        这个警告我们之前讨论过,表示 package.json 文件中没有指定许可证字段。
        "System parameters don't match" 警告:
        这通常意味着你的系统环境(如操作系统、Node.js 版本等)与 yarn.lock 文件中记录的不匹配。
        "Integrity check failed" 错误:
        这是最严重的问题,表示安装的依赖项与 yarn.lock 文件中记录的不一致。
    d.解决
        a.更新 package.json 中的许可证字段(可选但推荐)
            在 package.json 中添加:
            "license": "选择适当的许可证,如 MIT"
        b.清理并重新安装依赖
            rm -rf node_modules
            rm yarn.lock
            yarn cache clean
            yarn install
        c.如果问题仍然存在,可能需要更新 Yarn
            npm install -g yarn
        d.检查 Node.js 版本是否与项目要求匹配
            node -v
    e.要解决这个问题,可以按照以下步骤操作:
        a.删除 node_modules 目录和 yarn.lock 文件
            rm -rf node_modules
            rm yarn.lock
        b.清理 Yarn 缓存
            yarn cache clean
        c.重新安装依赖
            yarn install
    f.脱离版本控制
        git rm -r --cached ydsz-boot-starter_1.0.0/ydsz-boot-aaaaaaa/
        git check-ignore -v ydsz-boot-starter_1.0.0/ydsz-boot-aaaaaaa/jeecg-boot-encrypt/specific-file.jar
        -----------------------------------------------------------------------------------------------------
        git rm -r --cached yarn.lock
        git rm -r --cached pnpm-lock.yaml
        git rm -r --cached package-lock.json

5.2 vite

01.安装
    npm install -g vite                                                             --Node.js版本18+,只能通过npm安装,yarn安装报错
    vite -v                                                                         --查看版本
    ---------------------------------------------------------------------------------------------------------
    目前支持的模板预设如下:
    JavaScript  TypeScript
    vanilla     vanilla-ts
    vue         vue-ts
    react       react-ts
    preact      preact-ts
    lit         lit-ts
    svelte      svelte-ts
    solid       solid-ts
    qwik        qwik-ts

02.搭建第一个Vite项目
    # 使用 NPM
    npm create vite@latest

    #使用 Yarn
    yarn create vite

    #使用 PNPM
    pnpm create vite

03.搭建第一个Vite项目
    你还可以通过附加的命令行选项直接指定项目名称和你想要使用的模板。例如,要构建一个 Vite + Vue 项目,运行:
    # npm 6.x
    npm create vite@latest my-vue-app --template vue
    # npm 7+, extra double-dash is needed:
    npm create vite@latest my-vue-app -- --template vue
    # yarn
    yarn create vite my-vue-app --template vue
    # pnpm
    pnpm create vite my-vue-app --template vue

04.拉取 VUE 模板(JS)
    D:\software_xare\workspace_uniapp>npm create vite@latest
    √ Project name: ... demo
    √ Select a framework: » Vue
    √ Select a variant: » Customize with create-vue ↗

    Vue.js - The Progressive JavaScript Framework

    √ Add TypeScript? ... No / Yes
    √ Add JSX Support? ... No / Yes
    √ Add Vue Router for Single Page Application development? ... No / Yes
    √ Add Pinia for state management? ... No / Yes
    √ Add Vitest for Unit Testing? ... No / Yes
    √ Add an End-to-End Testing Solution? » Nightwatch
    √ Add ESLint for code quality? ... No / Yes
    √ Add Prettier for code formatting? ... No / Yes

    Scaffolding project in D:\software_xare\workspace_uniapp\demo...

    Done. Now run:

      cd demo
      npm install
      npm run format
      npm run dev

05.拉取 VUE 模板(TS)
    D:\software_xare\workspace_web2\omsh>npm create vite@latest
    Need to install the following packages:
    [email protected]
    Ok to proceed? (y)
    √ Project name: ... vue
    √ Select a framework: » Vue
    √ Select a variant: » TypeScript

    Scaffolding project in D:\software_xare\workspace_web2\omsh\vue...

    Done. Now run:

      cd vue
      npm install
      npm run dev

06.拉取 REACT 模板(TS)
    D:\software_xare\workspace_web2\omsh>npm create vite@latest
    Need to install the following packages:
    [email protected]
    Ok to proceed? (y) y
    √ Project name: ... react
    √ Select a framework: » React
    √ Select a variant: » TypeScript

    Scaffolding project in D:\software_xare\workspace_web2\omsh\react...

    Done. Now run:

      cd react
      npm install
      npm run dev

07.环境变量
    .env                # 基础配置,所有环境都会加载
    .env.development    # 开发环境配置
    .env.production     # 生产环境配置
    .env.test           # 测试环境配置
    ---------------------------------------------------------------------------------------------------------
    .env                # 可以删除,因为基础配置可以放在具体环境中
    .env.production     # 保留,生产环境必需
    .env.development    # 保留,开发环境必需
    .env.test           # 可以删除,如果没有测试环境
    ---------------------------------------------------------------------------------------------------------
    配置加载流程:
    1.vite.config.ts 中通过 loadEnv 加载环境变量
    2.使用 wrapperEnv 处理环境变量类型转换
    3.最终在 vite.config.ts 中使用这些配置

5.3 vue-cli

01.介绍
    a.生态
        vue.js:开发框架、vuex:状态管理、vue-cli:项目构建、vue loader:将组件转单文件、vue router:路由管理
    b.vue-cli 3.x 对比 vue-cli 2.x
        去除static、config、build、新增public
        自动依赖node_modules
        默认配置 webpack,通过 vue.config.js 修改,可通过 vue inspect 命令查看 webpack 默认配置
        内置了 vue-cli-service serve 服务
        浏览器打开图形界面,vue ui 查看

02.安装
    a.方式一
        npm install/uninstall -g vue/cli                                            --第2版,2.9.6
        npm install/uninstall -g @vue/[email protected]                                    --第3版,3.11.0
        npm install/uninstall -g @vue/cli                                           --第4版,4.5.12
        npm update -g @vue/cli                                                      --升级版本
        -----------------------------------------------------------------------------------------------------
        vue -V && webpack -v                                                        --查看版本
        -----------------------------------------------------------------------------------------------------
        npm install -g @vue/[email protected] && npm install -g webpack && npm install -g webpack-cli
        npm install -g @vue/cli && npm install -g webpack && npm install -g webpack-cli
    b.方式二
        yarn global add/remove vue/cli                                              --第2版,2.9.6
        yarn global add/remove @vue/[email protected]                                      --第3版,3.11.0
        yarn global add/remove @vue/cli                                             --第4版,4.5.12
        yarn global upgrade --latest @vue/cli                                       --升级版本
        -----------------------------------------------------------------------------------------------------
        vue -V && webpack -v                                                        --查看版本
        -----------------------------------------------------------------------------------------------------
        yarn global add @vue/[email protected] webpack webpack-cli
        yarn global add @vue/cli webpack webpack-cli

03.拉取 3.x 模板 (新版本)
    cd D:\software_ware\workspace_webstrom\web-stack && vue ui                                     --方式一:图形界面
    cd D:\software_ware\workspace_webstrom\web-stack && vue create vue-admin                       --方式二:命令行
    ---------------------------------------------------------------------------------------------------------
    Vue CLI v5.0.8
    ? Please pick a preset:
      demo1 ([Vue 3] dart-sass, babel, router, vuex, eslint)
      Default ([Vue 3] babel, eslint)
      Default ([Vue 2] babel, eslint)
    > Manually select features
    ---------------------------------------------------------------------------------------------------------
    Vue CLI v5.0.8
    ? Please pick a preset: Manually select features
    ? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert selection, and
    <enter> to proceed)
     (*) Babel
     ( ) TypeScript
    >( ) Progressive Web App (PWA) Support
     (*) Router
     (*) Vuex
     (*) CSS Pre-processors
     (*) Linter / Formatter
     ( ) Unit Testing
     ( ) E2E Testing
    ---------------------------------------------------------------------------------------------------------
    Vue CLI v5.0.8
    ? Please pick a preset: Manually select features
    ? Check the features needed for your project: Babel, Router, Vuex, CSS Pre-processors, Linter
    ? Choose a version of Vue.js that you want to start the project with
    > 3.x
      2.x
    ---------------------------------------------------------------------------------------------------------
    Vue CLI v5.0.8
    ? Please pick a preset: Manually select features
    ? Check the features needed for your project: Babel, Router, Vuex, CSS Pre-processors, Linter
    ? Choose a version of Vue.js that you want to start the project with 3.x
    ? Use history mode for router? (Requires proper server setup for index fallback in production) Yes
    ? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): Sass/SCSS (with dart-sass)
    ? Pick a linter / formatter config: Prettier
    ? Pick additional lint features: Lint on save
    ? Where do you prefer placing config for Babel, ESLint, etc.? In package.json
    ? Save this as a preset for future projects? (y/N) y
    ? Save preset as: Default
    🎉  Successfully created project vue-admin.
    👉  Get started with the following commands:
     $ cd vue-admin
     $ yarn serve
    ---------------------------------------------------------------------------------------------------------
    cd D:\software_ware\workspace_webstrom\web-stack && cd vue-admin && npm run serve              --启动
    ---------------------------------------------------------------------------------------------------------
    node_modules
    public
    src
        assets
            logo.png
        components
            HelloWorld.vue
        router
            index.js
        store
            index.js
        views
            AboutView.vue
            HomeView.vue
        App.vue
        main.js
    .gitignore
    babel.config.js
    jsconfig.json
    package.json
    README.md
    vue.config.js
    yarn.lock

04.拉取 2.x 模板 (旧版本)
    Vue CLI >= 3 和旧版使用了相同的 vue 命令,所以 Vue CLI 2 (vue-cli) 被覆盖了。
    如果你仍然需要使用旧版本的 vue init 功能,你可以全局安装一个桥接工具:
    ---------------------------------------------------------------------------------------------------------
    npm install -g @vue/cli-init
    # `vue init` 的运行效果将会跟 `[email protected]` 相同
    vue init webpack my-project
    ---------------------------------------------------------------------------------------------------------
    cd D:\software_ware\workspace_webstrom\web-stack && vue init webpack vue-admin                 --方式二:命令行
    ? Project name vue-admin
    ? Project description A Vue.js project
    ? Author
    ? Vue build standalone
    ? Install vue-router? Yes
    ? Use ESLint to lint your code? Yes
    ? Pick an ESLint preset Standard
    ? Set up unit tests No
    ? Setup e2e tests with Nightwatch? No
    ? Should we run `npm install` for you after the project has been created? (recommended) yarn
    ---------------------------------------------------------------------------------------------------------
    cd D:\software_ware\workspace_webstrom\web-stack && cd vue-admin && npm run dev                --启动
    ---------------------------------------------------------------------------------------------------------
    build
    config
    node_modules
    src
        assets
            logo.png
        components
            HelloWorld.vue
        router
            index.js
        App.vue
        main.js
    static
    .babelrc
    .editorconfig
    .eslintignore
    .eslintrc.js
    .gitignore
    .postcssrc.js
    index.html
    package.json
    package-lock.json
    README.md

5.4 react-cli

01.工具链
    纯净的Recat项目:
    create-react-app脚手架快速搭建react项目
    generator-react-webpack脚手架搭建react项目(舍弃)
    webpack逐步构建react项目(舍弃)
    ---------------------------------------------------------------------------------------------------------
    生产级的React框架:
    Expo 是一个 React 框架,可以让你创建具有真正原生 UI 的应用,包括 Android、iOS,以及 Web 应用。
    Remix 是一个具有嵌套路由的全栈式 React 框架。它可以把你的应用分成嵌套部分,该嵌套部分可以并行加载数据并响应用户操作进行刷新。
    Next.js 的页面路由 是一个全栈的 React 框架。它用途广泛,可让你创建任何规模的 React 应用程序——从大部分的静态博客到复杂的动态应用程序。
    Gatsby 是一个快速的支持 CMS 的网站的 React 框架。其丰富的插件生态系统和 GraphQL 数据层简化了将内容、API 和服务整合到一个网站的过程。
    ---------------------------------------------------------------------------------------------------------
    以下工具链为 React 提供更多更具灵活性的方案。推荐给更有经验的使用者:
    Neutrino 把 webpack 的强大功能和简单预设结合在一起。并且包括了 React 应用和 React 组件的预设。
    Nx 是针对全栈 monorepo 的开发工具包,其内置了 React,Next.js,Express 等。
    Parcel 是一个快速的、零配置的网页应用打包器,并且可以搭配 React 一起工作。
    Razzle 是一个无需配置的服务端渲染框架,但它提供了比 Next.js 更多的灵活性。

02.create-react-app
    a.安装
        npm install -g create-react-app
        create-react-app -V
    b.创建项目
        create-react-app hello_world
    c.运行项目
        cd hello_world
        npm start

03.generator-react-webpack(舍弃)
    a.安装
        npm install -g yo generator-react-webpack
    b.创建项目
        mkdir hello_world
        cd react-demo
        yo react-webpack
    c.运行项目
        npm hello_world
        npm start

5.5 angular-cli

01.安装
    npm install -g @angular/cli
    ng v

02.创建项目
    cd D:\software_xare\workspace_web2
    ng new project                                                      --创建项目
    ---------------------------------------------------------------------------------------------------------
    ng new angular
    cd angular
    npm install                                                         --安装
    ng serve                                                            --启动

5.6 tauri

01.介绍
    Tauri基于rust

02.安装
    npm install -g @tauri-apps/cli
    tauri -V

03.创建项目
    cd D:\software_xare\workspace_web2
    npm create tauri-app@latest                                         --创建项目
    ---------------------------------------------------------------------------------------------------------
    cd tauri-app
    npm install
    npm run tauri dev

5.7 wails

01.介绍
    开发者使用 Go 编写后端逻辑,前端则用 HTML、CSS 和 JavaScript 构建 UI,实现现代桌面应用开发的新组合
    它可以让你用 Go 写后端逻辑,再用 Vue、React、Svelte 等前端框架渲染界面
    最后打包成一个原生应用,在 Windows、macOS、Linux 上流畅运行

02.安装
    go install github.com/wailsapp/wails/v2/cmd/wails@latest
    wails -V

03.创建项目
    cd D:\software_xare\workspace_web2
    wails init -n myapp -t vue                                          --创建项目
    ---------------------------------------------------------------------------------------------------------
    cd myapp
    wails dev
    wails build

5.8 nextjs

01.介绍
    Next.js由Vercel维护,支持静态导出,不需要服务器

02.安装
    npm install -g create-next-app
    create-next-app -V

03.创建项目
    cd D:\software_xare\workspace_web2
    npx create-next-app project                                         --创建项目
    ---------------------------------------------------------------------------------------------------------
    npx create-next-app nextjs
    cd nextjs
    npm install                                                         --安装
    npm run dev 或 yarn dev                                             --启动

5.9 nuxtjs

01.安装
    使用yarn安装create-nuxt-app
    使用npx安装create-nuxt-app,发现出错                                 --npx在NPM版本5.2.0默认安装

02.创建项目
    cd D:\software_xare\workspace_web2
    yarn create nuxt-app nuxt
    cd nuxt
    npm install
    npm run dev

6 javascript

6.1 h5

00.汇总
    MobVue:MobVue 是一个精心制作的移动端 H5 模板,基于 Vue3、Vite、TypeScript、Vant 等主流技术
    vite-vue3-h5:使用 pnpm create vite 名称创建的项目 vue3 + vite5 + ts + pinia 通用 h5 移动端项目架子
    Vue-H5-Template:基于 vite7 + vue3.5 + pinia + ( Vant or Varlet or NutUI ) + viewport(VW) 适配方案 ,构建移动端快速开发脚手架

01.MobVue
    a.说明
        MobVue 是一个精心制作的移动端 H5 模板,基于 Vue3、Vite、TypeScript、Vant 等主流技术
    b.推荐环境
        新版 Visual Studio Code 或者 AI IDE Cursor 与 Trae
        安装 .vscode/extensions.json 文件中推荐的插件
        node 20.19+ 或 22.12+
        pnpm 10+
        bun 最新的
    c.本地开发
        # 安装依赖
        pnpm i
        # 启动服务
        pnpm dev
        -----------------------------------------------------------------------------------------------------
        # 安装依赖
        bun i
        # 启动服务
        bun run dev
    d.打包构建
        # 打包构建预发布环境
        pnpm build:staging
        # 打包构建生产环境
        pnpm build
        -----------------------------------------------------------------------------------------------------
        # 打包构建预发布环境
        bun build:staging
        # 打包构建生产环境
        bun build
    e.本地预览
        # 先执行打包构建命令生成 dist 目录后再执行以下预览命令
        pnpm preview
        -----------------------------------------------------------------------------------------------------
        # 先执行打包构建命令生成 dist 目录后再执行以下预览命令
        bun preview

02.vite-vue3-h5
    a.说明
        使用 pnpm create vite 名称创建的项目 vue3 + vite5 + ts + pinia 通用 h5 移动端项目架子,
        包含 vue3 + vite5 + ts + pinia + vant4 等技术栈,采用全新(当前日期最新版本)技术
        包括 eslint v9版本、vue3.4、vite5、vant4、typescript5.x、prettier 3.x、stylelint 16版本、pinia 2.0版本等等,
    b.安装
        # 安装依赖包
        pnpm intall
        # 启动项目
        pnpm run dev
        # 打包项目
        pnpm run build
    c.eslint 安装
        执行下面命令自动初始化配置文件 根目录自动生成(没有的需要手动创建 执行shell命令npx eslint --init) eslint.config.js 文件,
        无需根目录创建 .eslintignore 文件
    d.rule 配置规则
        官方原话 Node.js < v18.18、v19 不再支持,使用 ESLint v9.0.0 时,请确保至少升级到 Node.js v18.18.0。
        需要仔细检查的一件重要事情是通过编辑器集成使用 ESLint 时编辑器支持的 Node.js 版本。
        如果你无法升级,我们建议你继续使用 ESLint v8.56.0,直到你能够升级 Node.js=
        "off" 或 0 - 关闭规则
        "warn" 或 1 - 打开规则作为警告(不影响退出代码)
        "error" 或 2 - 打开规则作为错误(触发时退出代码为 1)
        npm init @eslint/config@latest
    e.prettier 安装
        执行下面命令自动初始化配置文件 根目录创建 .prettierrc.mjs 文件,并且根目录创建 .prettierignore 文件
        pnpm i prettier -D
    f.Stylelint 安装
        根目录创建 stylelint.config.mjs 写入配置文件即可,根目录创建 .stylelintignore 文件
        pnpm add  postcss-less postcss-html stylelint-config-recommended-less stylelint-config-standard stylelint-config-standard-vue stylelint-less stylelint-order -D
        stylelint-config-prettier 用于禁用 stylelint 与 prettier 冲突的规则,避免 stylelint 与 prettier 相互影响,避免不必要的错误,但是 stylelint v15版本开始就废除了该插件说明该插件已经不再需要了,所以不需要安装了

03.Vue-H5-Template
    a.说明
        基于 vite7 + vue3.5 + pinia + ( Vant or Varlet or NutUI ) + viewport(VW) 适配方案 ,构建移动端快速开发脚手架
        推荐 20.19.0+以上的版本,毕竟 2025 年了,别掐着 16+的版本了,你也可以使用nvm或nvm-windows在同一台电脑上管理多个 node 版本。
    b.vue2模版
        # 拉取项目
        git clone https://github.com/sunniejs/vue-h5-template
        # 切换分支
        git checkout -b vue2-h5-template origin/vue2-h5-template
        # 安装依赖
        yarn install
        # 启动项目
        yarn serve
    c.vue3模版
        # 拉取项目
        git clone https://github.com/sunniejs/vue-h5-template
        # 安装依赖
        pnpm install
        yarn install
        # 启动项目
        pnpm dev
        yarn dev

6.2 mini

01.常用信息
    a.汇总
        a.分类1
            vux               社区维护        vue2                               废弃
            Mint              饿了么团队      vue2                               废弃
            Cube              滴滴团队        vue2                               废弃
        b.分类2
            Vant              有赞官方        vue2、vue3                         用于小程序开发,兼容H5,不直接支持APP
            Vant4Kit          社区维护        vue3                               用于小程序开发,兼容H5,不直接支持APP
            VantWeapp         有赞官方        vue3                               用于小程序开发,不支持H5,不直接支持APP
        c.分类3
            Zoom UI           智米科技        vue3                               用于小程序开发,不支持H5,不直接支持APP
            Sober.js          社区维护        vue3                               用于小程序开发,不支持H5,不直接支持APP
        d.分类4
            VueMini           社区维护        vue3                               用于小程序开发,不支持H5,不直接支持APP
    b.Vue2适配
        a.vux
            https://vux.li/
            社区维护(非单一公司出品,早期由个人开发者发起,后形成社区生态)
            -------------------------------------------------------------------------------------------------
            小程序:主要适配微信小程序(早期对支付宝小程序等支持较弱,需额外配置)
            APP:支持基于Vue 2的Hybrid APP(如通过Cordova、HBuilder等打包的APP)
            其他:兼容H5移动端网页
            -------------------------------------------------------------------------------------------------
            基于Vue 2开发,主打移动端UI,设计风格贴近微信原生视觉,降低用户认知成本
            组件覆盖基础场景(如按钮、表单、导航、弹窗等),同时包含部分特色组件(如倒计时、验证码输入框)
            早期在Vue 2移动端生态中使用广泛,但后期更新频率降低,对Vue 3兼容性差,更适合维护旧Vue 2项目
        b.Mint
            http://mintui.github.io/docs//zhcn2
            饿了么(Ele.me)前端团队早期出品(目前已停止主要更新)
            -------------------------------------------------------------------------------------------------
            小程序:早期无原生小程序支持,需通过Vue 2 + 小程序转换工具(如mpvue)间接适配,兼容性一般
            APP:支持基于Vue 2的Hybrid APP(如通过Cordova、HBuilder打包的APP)
            其他:兼容H5移动端网页
            -------------------------------------------------------------------------------------------------
            基于Vue 2开发,曾是Vue 2移动端生态的主流组件库之一,设计风格简洁,贴近原生APP视觉
            组件覆盖基础场景(如导航栏、标签页、表单、加载动画等),支持按需引入,早期文档完善
            目前已停止重大更新,不支持Vue 3,仅适合维护旧Vue 2项目,新项目不推荐使用
        c.Cube
            https://didi.github.io/cubeui//zhCN/docs/quickstart
            滴滴(DiDi)前端团队官方出品
            -------------------------------------------------------------------------------------------------
            小程序:支持通过Vue 2 + mpvue(小程序Vue框架)适配微信小程序,原生小程序支持较弱
            APP:支持基于Vue 2的Hybrid APP(如通过Webpack打包后结合Cordova或滴滴内部打包工具生成APP)
            其他:兼容H5移动端网页,支持响应式适配
            -------------------------------------------------------------------------------------------------
            基于Vue 2开发,设计风格偏向“商务简约”,组件稳定性高(经滴滴内部业务验证)
            核心特点是“灵活的组件扩展能力”,支持自定义组件结构与样式,同时提供“主题定制”和“按需引入”功能
            包含部分特色组件(如日期时间选择器、城市选择器、分步表单等),适合中大型企业级移动端项目
            目前更新频率较低,对Vue 3支持不足,新项目若使用Vue 3需谨慎选择
    c.Vant系列
        a.Vant(Vue 2/Vue 3 版本)
            https://vantui.github.io/vant//zhCN/home
            有赞(Youzan)官方
            -------------------------------------------------------------------------------------------------
            小程序:完美适配微信小程序、支付宝小程序、百度小程序、字节跳动小程序等主流小程序平台
            APP:支持基于Vue 2/Vue 3的APP(如通过Vite、Webpack打包后,结合Capacitor、Electron或原生打包工具生成的APP)
            其他:全面兼容H5移动端网页,支持响应式适配
            -------------------------------------------------------------------------------------------------
            分为Vant(Vue 2)和Vant 3/Vant 4(Vue 3)版本,迭代活跃,维护稳定,文档完善
            组件库轻量(通过TreeShaking可按需引入,减少包体积),性能优秀,支持主题定制
            组件场景覆盖广,尤其侧重电商领域(如商品卡片、购物车、优惠券、地址选择等),同时也包含通用基础组件
            支持TypeScript,对大型项目友好,社区活跃,问题反馈与解决效率高
        b.Vant4Kit
            https://vant4kit.netlify.app/
            社区开发者基于Vant 4二次开发(非有赞官方出品)
            -------------------------------------------------------------------------------------------------
            小程序:与Vant 4一致,适配微信、支付宝、百度、字节跳动等主流小程序
            APP:支持Vue 3生态下的APP(依赖Vant 4的APP适配能力,可通过Vite打包后结合原生或混合开发工具生成APP)
            其他:兼容H5移动端网页
            -------------------------------------------------------------------------------------------------
            基于Vant 4扩展,在Vant 4基础组件之上,提供更多“场景化组件”和“业务模板”(如登录注册页、个人中心页、订单列表页等)
            降低重复开发成本,适合快速搭建中小型移动端项目,尤其适合对页面模板有需求的开发者
            依赖Vant 4,需与Vant 4版本兼容,更新节奏跟随Vant 4,自定义灵活性略低于原生Vant
        c.Vant Weapp(小程序原生版本)
            https://youzan.github.io/vantweapp//intro
            有赞(Youzan)官方
            -------------------------------------------------------------------------------------------------
            小程序:专注适配微信小程序(原生微信小程序语法,非Vue生态),同时兼容支付宝小程序、百度小程序等(需通过平台转换工具适配)
            APP:不直接支持APP,仅用于小程序开发
            其他:不支持H5
            -------------------------------------------------------------------------------------------------
            微信小程序原生组件库,基于小程序原生语法(WXML/WXSS/JS)开发,无需依赖Vue框架
            组件设计与Vant(Vue版本)保持一致,视觉风格统一,适合纯小程序项目开发
            体积轻量,加载速度快,支持按需引入,文档与示例完善,有赞官方维护,稳定性高
    d.Vue3适配
        a.Zoom
            https://smart.gtdreamlife.com/zoomintro//intro
            智米科技(GTDreamLife,推测为企业内部组件库开源版本,非头部互联网公司)
            支持环境:Android 4.0+、iOS 8.0+、支持服务端渲染
            -------------------------------------------------------------------------------------------------
            Zoom Design是一套面向未来的企业级移动端Vue组件库。做为绿城数字生活服务平台设计系统,
            Zoom Design致力于降低设计师工作成本、提高设计质量;通过构建设计系统,提高用户体验并保持品牌视觉一致性;
            通过数字生活平台设计系统与产品、前端在产品体验一致性、工作协同、开发效率方面等方面做出快速响应,以支撑我们的前台产品
        b.Sober
            https://soberjs.com/
            社区个人开发者维护(非企业级出品)
            -------------------------------------------------------------------------------------------------
            Sober 是一个使用 TypeScript 编写的 Material You 设计 Web Components 轻量级 UI 组件库,
            这使得 Sober 可以在所有前端框架包括但不限于 Vue、React、Preact、Solid-js 中使用,且均已支持这些框架的模版类型定义。
            它非常的轻量级,完整引入所有组件仅 139kb,在启用 gzip 压缩情况下只有 33kb。
    e.脚手架
        a.VueMini
            https://vuemini.org/
            社区开发者(专注于小程序Vue生态)维护
            -------------------------------------------------------------------------------------------------
            Vue Mini 是一个基于 Vue 3 的小程序框架,它能让你用组合式 API 写小程序。
            目前 Vue Mini 仅支持微信小程序。虽然技术上 Vue Mini 可以支持其他小程序平台,
            但由于时间跟精力的限制,短期内并没有这样的计划。未来一段时间 Vue Mini 仍然只会专注于微信小程序,持续提升微信小程序的 UX 以及 DX。
    f.创建项目
        a.微信云开发
            云开发基础模板              官方
            小程序示例                 官网
            -------------------------------------------------------------------------------------------------
            官方模板                   云模版
            微信支付功能展示模版         云模板
            美业模板                   云模板
            短剧模版小程序              云模板
            活动抽奖模板                云模板
            -------------------------------------------------------------------------------------------------
            小程序打开微信小店           云开发
            小程序Agent UI             云开发
            云开发企业官网              云开发
            云开发电商模版              云开发
            -------------------------------------------------------------------------------------------------
            社区内容模版                TDesign
            TDesign-零售电商模版        TDesign
            TDesign-组件库模版          TDesign
        b.不使用云服务
            TS-基础模版                 官方
            TS-Sass基础模版             官方
            TS-Skyline基础模版          官方
            -------------------------------------------------------------------------------------------------
            JS基础模版                  官方
            TS-Less基础模版             官方
            JS-Skyline基础模版          官方
            -------------------------------------------------------------------------------------------------
            组件库模版                   TDesign
            零售电商模版                 TDesign
            社区内容模版                 TDesign
            -------------------------------------------------------------------------------------------------
            活动报名模版                 地图应用构建平台
            位置展示模版                 地图应用构建平台
            路线规划模版                 地图应用构建平台
            -------------------------------------------------------------------------------------------------
            虚拟背景&美颜美妆             腾讯云音视频

02.常用组件
    a.Vant
        a.安装
            a.分类1
                # Vue 3 项目,安装最新版 Vant
                npm i vant
                # Vue 2 项目,安装 Vant 2
                npm i vant@latest-v2
            b.分类2
                # 通过 yarn 安装
                yarn add vant
                # 通过 pnpm 安装
                pnpm add vant
                # 通过 Bun 安装
                bun add vant
        b.引入:全局使用
            a.在完结根目录下 main.ts 中引入
                import { createApp } from 'vue';
                // 1. 引入你需要的组件
                import { Button } from 'vant';
                // 2. 引入组件样式
                import 'vant/lib/index.css';

                const app = createApp();

                // 3. 注册你需要的组件
                app.use(Button);
        c.引入:按需引入
            a.安装插件
                # 通过 npm 安装
                npm i @vant/auto-import-resolver unplugin-vue-components unplugin-auto-import -D

                # 通过 yarn 安装
                yarn add @vant/auto-import-resolver unplugin-vue-components unplugin-auto-import -D

                # 通过 pnpm 安装
                pnpm add @vant/auto-import-resolver unplugin-vue-components unplugin-auto-import -D

                # 通过 bun 安装
                bun add @vant/auto-import-resolver unplugin-vue-components unplugin-auto-import -D
            b.配置插件
                a.如果是基于 Rsbuild 的项目,在 rsbuild.config.js 文件中配置插件
                    import { defineConfig } from '@rsbuild/core';
                    import { pluginVue } from '@rsbuild/plugin-vue';
                    import AutoImport from 'unplugin-auto-import/rspack';
                    import Components from 'unplugin-vue-components/rspack';
                    import { VantResolver } from '@vant/auto-import-resolver';

                    export default defineConfig({
                      plugins: [pluginVue()],
                      tools: {
                        rspack: {
                          plugins: [
                            AutoImport({
                              resolvers: [VantResolver()],
                            }),
                            Components({
                              resolvers: [VantResolver()],
                            }),
                          ],
                        },
                      },
                    });
                b.如果是基于 Vite 的项目,在 vite.config.js 文件中配置插件
                    import vue from '@vitejs/plugin-vue';
                    import AutoImport from 'unplugin-auto-import/vite';
                    import Components from 'unplugin-vue-components/vite';
                    import { VantResolver } from '@vant/auto-import-resolver';

                    export default {
                      plugins: [
                        vue(),
                        AutoImport({
                          resolvers: [VantResolver()],
                        }),
                        Components({
                          resolvers: [VantResolver()],
                        }),
                      ],
                    };
                c.如果是基于 vue-cli 的项目,在 vue.config.js 文件中配置插件
                    const { VantResolver } = require('@vant/auto-import-resolver');
                    const AutoImport = require('unplugin-auto-import/webpack');
                    const Components = require('unplugin-vue-components/webpack');

                    module.exports = {
                      configureWebpack: {
                        plugins: [
                          // 当 unplugin-vue-components 版本小于 0.26.0 时,使用以下写法
                          AutoImport({ resolvers: [VantResolver()] }),
                          Components({ resolvers: [VantResolver()] }),
                          //当 unplugin-vue-components 版本大于等于 0.26.0 时,使用以下写法
                          AutoImport.default({
                            resolvers: [VantResolver()],
                          }),
                          Components.default({ resolvers: [VantResolver()] }),
                        ],
                      },
                    };
            c.使用组件和 API
                a.template
                    完成以上两步,就可以直接在模板中使用 Vant 组件了,unplugin-vue-components 会解析模板并自动注册对应的组件,
                    @vant/auto-import-resolver 会自动引入对应的组件样式
                    ---------------------------------------------------------------------------------------------
                    <template>
                      <van-button type="primary" />
                    </template>
                b.script
                    unplugin-auto-import 会自动导入对应的 Vant API 以及样式
                    ---------------------------------------------------------------------------------------------
                    <script>
                      showToast('No need to import showToast');
                    </script>
    b.Vant4Kit
        a.安装
            a.分类1
                # npm
                npm install @meetjs/vant4-kit
                # pnpm
                pnpm add @meetjs/vant4-kit
                # yarn
                yarn add @meetjs/vant4-kit
        b.引入:全局使用
            a.在完结根目录下 main.ts 中引入
                import { createApp } from 'vue'
                import App from './App.vue'
                import Vant from 'vant'
                import VantKit from '@meetjs/vant4-kit'
                import '@meetjs/vant4-kit/dist/index.css'

                const app = createApp(App)
                app.use(Vant)
                app.use(VantKit)
                app.mount('#app')
            b.在组件中使用
                <template>
                  <x-form :model="formValue" :items="formOptions" />
                </template>

                <script setup lang="ts">
                import { ref } from 'vue'
                import type { XFormItemRow } from '@meetjs/vant4-kit';

                const formValue = ref({})
                const formOptions = ref<XFormItemRow[]>([
                    {
                        label: '普通输入',
                        type: 'input',
                        name: 'name',
                    },
                ])

                </script>
        c.引入:按需引入
            a.只需要在 main.ts 中引入其样式文件即可
                <template>
                  <XForm :model="formValue" :items="formOptions" />
                </template>

                <script setup lang="ts">
                import { ref } from 'vue'
                import { XForm,type XFormItemRow } from '@meetjs/vant4-kit';

                const formValue = ref({})
                const formOptions = ref<XFormItemRow[]>([
                    {
                        label: '普通输入',
                        type: 'input',
                        name: 'name',
                    },
                ])
                </script>
    c.VantWeapp
        a.步骤1:通过 npm 安装
            # 通过 npm 安装
            npm i @vant/weapp -S --production
            # 通过 yarn 安装
            yarn add @vant/weapp --production
            # 安装 0.x 版本
            npm i vant-weapp -S --production
        b.步骤2:修改 app.json
            将 app.json 中的 "style": "v2" 去除,小程序的新版基础组件强行加上了许多样式,难以覆盖,不关闭将造成部分组件样式混乱。
        c.步骤3:构建 npm 包
            打开微信开发者工具,点击 工具 -> 构建 npm,并勾选 使用 npm 模块 选项,构建完成后,即可引入组件。
        d.步骤4:typescript 支持
            a.安装 miniprogram-api-typings
                # 通过 npm 安装
                npm i -D miniprogram-api-typings
                # 通过 yarn 安装
                yarn add -D miniprogram-api-typings
            b.在 tsconfig.json 中增加如下配置,以防止 tsc 编译报错
                请将path/to/node_modules/@vant/weapp修改为项目的 node_modules 中 @vant/weapp 所在的目录。
                -------------------------------------------------------------------------------------------------
                {
                  ...
                  "compilerOptions": {
                    ...
                    "baseUrl": ".",
                    "types": ["miniprogram-api-typings"],
                    "paths": {
                      "@vant/weapp/*": ["path/to/node_modules/@vant/weapp/dist/*"]
                    },
                    "lib": ["ES6"]
                  }
                }
        e.步骤5:使用
            a.引入组件
                以 Button 组件为例,只需要在app.json或index.json中配置 Button 对应的路径即可。
                所有组件文档中的引入路径均以 npm 安装为例,如果你是通过下载源代码的方式使用 @vant/weapp,请将路径修改为项目中 @vant/weapp 所在的目录。
                -------------------------------------------------------------------------------------------------
                // 通过 npm 安装
                // app.json
                "usingComponents": {
                  "van-button": "@vant/weapp/button/index"
                }
                -------------------------------------------------------------------------------------------------
                // 通过下载源码使用 es6版本
                // app.json
                "usingComponents": {
                  "van-button": "path/to/@vant/weapp/dist/button/index"
                }
                -------------------------------------------------------------------------------------------------
                // 通过下载源码使用 es5版本
                // app.json
                "usingComponents": {
                  "van-button": "path/to/@vant/weapp/lib/button/index"
                }
            b.使用组件
                引入组件后,可以在 wxml 中直接使用组件
                <van-button type="primary">按钮</van-button>
        f.步骤6:预览小程序
            # 将项目克隆到本地
            git clone [email protected]:youzan/vant-weapp.git
            # 安装项目依赖
            cd vant-weapp && npm install
            # 执行组件编译
            npm run dev

03.常用模版
    a.Vant系列
        a.说明
            Vant 是一个轻量、可靠的移动端组件库,于 2017 年开源。
            目前 Vant 官方提供了 Vue 2 版本、Vue 3 版本和微信小程序版本,并由社区团队维护 React 版本和支付宝小程序版本。
        b.模版
            https://github.com/vant-ui/vant-demo:Vant 官方的示例仓库,包含 Vant、Vant Weapp 和 Vant Cli 相关的示例
            https://github.com/youzan/vant-weapp:专注适配微信小程序(原生微信小程序语法,非Vue生态),同时兼容支付宝小程序、百度小程序等(需通过平台转换工具适配)
    b.VueMini
        a.说明
            Vue Mini 是一个基于 Vue 3 的小程序框架,它能让你用组合式 API 写小程序。
            与某些小程序开发方案不同的是 Vue Mini 核心仅仅是一个轻量的运行时库,它既不依赖任何编译步骤,也不涉及任何 Virtual DOM。
            并且 Vue Mini 从一开始就被设计为能跟小程序原生语法协同工作,你甚至能在同一个页面或组件内混用原生语法与 Vue Mini,
            这能让你很轻松的将其整合进既有项目中。当然,你也能完全使用 Vue Mini 开发一个小程序。
            Vue Mini 仅聚焦于小程序逻辑部分,也就是 JS 部分,它并不影响小程序的模版、样式及配置。
        b.支持性
            目前 Vue Mini 仅支持微信小程序。虽然技术上 Vue Mini 可以支持其他小程序平台,
            但由于时间跟精力的限制,短期内并没有这样的计划。未来一段时间 Vue Mini 仍然只会专注于微信小程序,持续提升微信小程序的 UX 以及 DX。
        c.前提条件
            已安装 >= 18.19.1 < 19 或 >= 20.6.1 版本的 Node.js
        d.创建一个 Vue Mini 小程序
            npm create vue-mini@latest
            pnpm create vue-mini@latest
            yarn create vue-mini
            bun create vue-mini@latest
            -------------------------------------------------------------------------------------------------
            ✔ 请输入项目名称:… <your-project-name>
            ✔ 是否使用 TypeScript 语法?… 否 / 是
            ✔ 是否引入 Pinia 用于状态管理?(试验)… 否 / 是
            ✔ 是否引入 Vitest 用于单元测试?… 否 / 是
            ✔ 是否引入 ESLint 用于 JS 代码质量检测?… 否 / 是
            ✔ 是否引入 Stylelint 用于 CSS 代码质量检测?… 否 / 是
            ✔ 是否引入 Prettier 用于代码格式化?… 否 / 是
            正在初始化项目 ./<your-project-name>...
            项目初始化完成。
        e.安装依赖并启动开发服务器
            cd <your-project-name>
            npm install
            npm run dev
            -------------------------------------------------------------------------------------------------
            cd <your-project-name>
            pnpm install
            pnpm dev
            -------------------------------------------------------------------------------------------------
            cd <your-project-name>
            yarn
            yarn dev
            -------------------------------------------------------------------------------------------------
            cd <your-project-name>
            bun install
            bun run dev
        f.预览
            将项目导入微信开发者工具,注意选择项目【根目录】,而【非dist目录】
            -------------------------------------------------------------------------------------------------
            使用微信开发者工具上传。请忽略微信开发者工具关于 JS 代码未压缩的警告,上述命令已经对 JS 代码做了自定义压缩。
        g.上线
            npm run build
            pnpm build
            yarn build
            bun run build
        h.使用包管理器安装
            npm install @vue-mini/core
            pnpm install @vue-mini/core
            yarn add @vue-mini/core
            bun add @vue-mini/core

6.3 uniapp

01.常用信息
    a.组件
        a.uniui
            https://uniapp.dcloud.net.cn/
            DCloud 官方
        b.nutui
            https://nutui.jd.com
            京东官方
            性能稳定,文档完善,适合电商类小程序、APP 及 H5 项目开发
        c.uv-ui
            https://www.uvui.cn/
            UniApp 生态社区维护(专注于高颜值移动端组件开发)
        d.tuniao
            https://vue2.tuniaokj.com/
            途牛团队
        e.skiyee
            https://skiyee-ui.netlify.app/docs/components/basic/button
            社区开发者(专注于原子化 CSS 驱动的移动端组件开发)
        f.wot-uni
            https://wot-ui.cn/
            wot-design 团队(专注于 Vue 3+TypeScript 移动端组件开发)
        g.uview
            https://uviewui.com/
            UniApp 生态社区维护(成熟的 UniApp 组件库开发商)
        h.uview-plus
            https://uiadmin.net/uview-plus/
            UniApp 生态社区维护(uView UI 的升级版本)
    b.模版
        a.snail-uni
            https://hu-snail.github.io/snail-uni/guide/quick-start.html
            https://github.com/hu-snail/snail-uni
            社区开发者(hu-snail)维护
            -------------------------------------------------------------------------------------------------
            一个基于 UniApp 的轻量级前端框架,提供了一套完整的开发规范和基础组件,注重开发效率与性能优化,文档清晰,适合快速搭建中小型 UniApp 项目。
        b.wot-starter
            https://starter.wot-ui.cn/
            https://github.com/wot-ui/wot-starter
            wot-design-ui 团队
            -------------------------------------------------------------------------------------------------
            由 wot-design-ui 团队推出的 UniApp 脚手架,集成了 wot-design-ui 组件库及常用开发工具链,配置开箱即用,支持多端适配,适合希望快速上手并使用 wot 系列生态的项目。
        c.unibest
            https://unibest.tech/
            https://github.com/unibest-tech/unibest
            unibest-tech 团队
            -------------------------------------------------------------------------------------------------
            专注于 UniApp 最佳实践的企业级脚手架,整合了状态管理、路由封装、请求拦截等基础能力,提供标准化开发流程,适合中大型团队协作开发复杂应用。
        d.uni-plus
            https://damaicoding.github.io/uni-plus-doc/
            https://github.com/DaMaiCoding/uni-plus
            DaMaiCoding 团队
            -------------------------------------------------------------------------------------------------
            一款增强型 UniApp 脚手架,扩展了框架功能并优化了构建流程,包含丰富的业务组件和工具函数,注重开发体验与项目可维护性,适合各类 UniApp 项目快速启动。
        e.vitesse-uni-app
            https://uni-helper.js.org/vitesse-uni-app/getting-started/introduction/
            https://github.com/uni-helper/vitesse-uni-app
            uni-helper 团队
            -------------------------------------------------------------------------------------------------
            基于 Vitesse 理念打造的 UniApp 脚手架,集成 Vue3、TypeScript 等现代前端技术栈,配置精简高效,支持按需加载和 tree-shaking,适合追求现代化开发体验的项目。
        f.uniez-template
            https://github.com/zhe-qi/uniez-template
            社区个人开发者(zhe-qi)维护
            -------------------------------------------------------------------------------------------------
            一个轻量灵活的 UniApp 模板,提供基础项目结构和常用配置,无过多预设约束,保留了框架原生特性,适合希望按需定制开发环境的开发者。
    c.创建项目
        a.普通项目(任意文件夹项目,包括非uni-app的web项目、文档目录等)
            空项目:仅包含一个工程目录
            基本HTML项目:包含index.html和css、js、img目录
            vue项目(普通模式):在html中引用vue.js(v3.2.8)
            vue3项目(3.2.8):vue3-cli默认项目(包含vite)
            vue项目(2.6.10):vue-cli默认项目(仅包含babel)
            Express项目:Node.js Express开发框架默认项目
            Node项目:Node默认项目
            Node ts项目:Nodets默认项目
        b.uni-app(开发一次,同时发布为Android、iOS原生App、小程序、H5等多个平台)
            默认模板:默认模板
            Hello uni-app x:演示uni-appx框架的组件、接口、模板
            Hello uvue:uvue的vue语法示例工程,
            Hello uni-app:演示uni-app框架的组件、接口、模板
            Hello uniCloud:js全栈开发前后端示例
            Hello uts:uts语法开发原生示例
            uni-starter:云端一体应用快速开发基本项目模版
            uni-admin:admin管理系统基础框架
            uni-ui项目:基于uni-app的UI组件库
            Hello i18n:uni-app国际化演示
            -----------------------------------------------------------------------------------------------------
            新闻/资讯模板:支持PC和nvue的新闻模板
            底部选项卡模板:中间带+号的底部选项卡
            网赚游戏-合成猫:集成uniAD的合成类网赚游戏
            有奖猜歌游戏:集成uniAD开发的小游戏,通过猜歌曲、观看广告赚取现金奖励
            快亿商城:云端一体多商户电商模板
            创云电商:云端一体全套电商模板
            用云电商:基于uni-starter和uni-admin的购物商城
            云上商城-商超连锁:周边生鲜超市、连锁餐饮,已接入美团配送
            云上商城-多语言版:周边生鲜超市、连锁餐饮,支持英文和西班牙
            天天商城:支持分销和激励视频的购物商城
            -----------------------------------------------------------------------------------------------------
            贝壳阅读:小说电子书+激励视频
            游戏试玩和网赚项目:试玩游戏、任务、优惠券返佣、短视频等
            猿由·智能建站系统:带后台、多行业适用、支持多端的微官网系统
            趣味AI照片转换:集成大量照片转换功能的网赚项目
            智能垃圾分类:AI图片识别垃圾分类环保主题项目
            看图猜成语游戏:已集成激励视频变现
            交友相亲盲盒系统:付费投入或抽取异性联系方式
            礼券提货系统:商家发券,用户凭二维码提货
        c.Wap2App(快速把wap网站升级为具有原生功能体验的App)
            默认模板:默认模版
            Hello wap2app:Wap2App基本功能演示
        d.新建5+App项目(HTML5+标准的跨平台App)
            默认模板:默认模版
            mui项目:已包含mui的js、css、字体资源的项目模板
            mui登录模板:带登录和设置的MUI项目模板
            底部选项卡模板:原生选项卡示例,含tab中部凸起半圆示例
            Hello H5+:HTML5Plus规范的演示,包含摄像头等各种底层能力的调用
            Hello mui:mui前端框架各种UI控件(如按钮)的展示
        e.IDE插件(通过JavaScript语言编写HBuilderX的插件)
            插件扩展开发:开发HBuilderX插件的简单示例
            插件扩展国际化:插件开发国际化简单示例
            snippet:代码块插件
            QuickPick:演示插件API,showQuickPick的基本操作
            webviewdialog:演示插件API,WebViewDialog的基本操作

02.常用组件
    a.skiyee
        a.说明
            https://skiyee-ui.netlify.app/docs/components/basic/button
            社区开发者(专注于原子化 CSS 驱动的移动端组件开发)
            -------------------------------------------------------------------------------------------------
            小程序:支持微信小程序(可结合 UniApp 或 Vue 3 生态适配其他小程序平台)
            APP:支持基于 Vue 3 的 APP 开发(可通过 Vite+Capacitor 或 UniApp 打包为 iOS/Android APP)
            其他:兼容 H5 移动端网页,支持原子化 CSS 的灵活适配
            -------------------------------------------------------------------------------------------------
            由原子化 CSS 驱动,符合直觉设计逻辑,支持高度定制化
            定位“面向 AI 时代”的移动端 UI 库,组件结构灵活,可根据业务需求快速组合定制
            能助力开发者打造独特且差异化的移动端应用程序,适合追求组件定制化的 Vue 3 或 UniApp 项目
        b.前提
            Vue: 3.4+
            Vite: 5.2.8+
            UniApp: 3.0.0-4060420250429001+
            UnoCSS: 66.0.0+
        c.构建流程
            # 安装组件库
            pnpm add @skiyee/uni-ui
            # 安装Uno预设
            pnpm add -D @skiyee/ui-preset
            # 载入预设
            import presetSkiyeeUI from '@skiyee/ui-preset'

            export default defineConfig({
              presets: [
                // ...
                presetSkiyeeUI(),
              ],
            })
            # 注册使用
            <script setup lang="ts">
            import SkButton from '@skiyee/uni-ui/sk-button.vue';
            </script>

            <template>
              <SkButton>Hello skiyee/ui</SkButton>
            </template>
    b.wot-uni
        a.说明
            https://wot-ui.cn/
            wot-design 团队(专注于 Vue 3+TypeScript 移动端组件开发)
            -------------------------------------------------------------------------------------------------
            小程序:依托 UniApp 框架,支持微信、支付宝、百度、字节跳动等主流小程序
            APP:支持通过 UniApp 打包为 iOS/Android APP,适配 APP 端的暗黑模式、国际化等特性
            其他:兼容 H5 移动端网页,保障多端功能与视觉一致性
            -------------------------------------------------------------------------------------------------
            基于 Vue 3+TypeScript 构建,参照 wot design 设计规范开发,类型定义完善
            提供 70+ 高质量组件,覆盖基础与业务场景,支持暗黑模式、国际化和自定义主题
            旨在提供统一的 UI 交互体验,提高研发效率,适合中大型 UniApp 多端项目
        b.npm安装
            npm i wot-design-uni
            yarn add wot-design-uni
            pnpm add wot-design-uni
        c.uni_modules 安装
            下载地址:https://ext.dcloud.net.cn/plugin?id=13889
            Wot UI 支持 uni_modules 规范,已经上架到 uni-app 的插件市场。
            在 uni-app 插件市场 选择使用 HBuildX 导入,或者选择手动在 src 目录下创建 uni_modules 文件夹并将 Wot UI 解压到 uni_modules 中,结构如下:
            - uni_modules
            - - - wot-design-uni
        d.Wot UI 依赖 sass,因此需要提前安装
            npm i sass -D
            yarn add sass -D
            pnpm add sass -D
        e.脚手架
            pnpm create uni <你的项目名称> --ts -m pinia -u wot -e
            -------------------------------------------------------------------------------------------------
            创建一个 TypeScript 项目
            集成 Pinia 状态管理
            自动配置 WotUI 组件库
            添加 ESLint 支持
        f.模版
            pnpm create uni <project-name> -t wot-starter            基于 vitesse-uni-app 深度整合 Wot UI 组件库的 uni-app 快速起手项目,它由 Wot UI 团队维护,告别 HBuilderX ,拥抱现代前端开发工具链。
            pnpm create uni <project-name> -t vitesse-uni-app        由 Vite & uni-app 驱动的跨端快速启动模板,背靠 Uni Helper 团队,告别 HBuilderX ,拥抱现代前端开发。
            pnpm create uni <project-name> -t unibest                使用了最新的前端技术栈,无需依靠 HBuilderX,通过命令行方式运行,内置大量基础功能,提供大量辅助功能,让你编写 uniapp 拥有 best 体验。
            pnpm create uni <project-name> -t vite-uniapp-template   以实用为先的 uni-app 起手模板。
            pnpm create uni <project-name> -t uni-plus               一个 “超超超” 好用的 uniapp 开发模板。
            pnpm create uni <project-name> -t uniez-template         一个“功能”和“开发体验”优先的 uniapp 模板。
            pnpm create uni <project-name> -t snail-uni              专为开发者打造的 UniApp 框架模板。
    c.uview
        a.说明
            View是uni-app生态专用的UI框架,uni-app 是一个使用 Vue.js 开发所有前端应用的框架,开发者编写一套代码,
            可发布到iOS、Android、H5、以及各种小程序(微信/支付宝/百度/头条/QQ/钉钉)等多个平台(引言自uni-app网)。
            但目前除微信小程序,其它小程序平台的兼容可能存在一些问题,后续会针对这方面持续优化。
        b.Hbuilder X方式
            如果您是使用Hbuilder X开发的用户,您可以在uni-app插件市场通过uni_modules的形式进行安装,此安装方式可以方便您后续在uni_modules对uView进行一键升级。
            在uni-app插件市场右上角选择uni_modules版本下的使用HBuilderX导入插件,导入到对应的项目中即可。
            注意: 此安装方式必须要按照下载方式安装的配置中的说明配置了才可用。
            下载地址:https://ext.dcloud.net.cn/plugin?id=1593
        c.NPM方式
            // 如果您的根目录没有package.json文件的话,请先执行如下命令:
            // npm init -y

            npm install [email protected]

            // 更新
            // npm update uview-ui
        d.版本查询
            // 通过`console.log`打印的形式
            console.log(uni.$u.config.v);

            // 可以查阅uView的配置文件得知当前版本号,具体位置为:
            /uview-ui/libs/config/config.js
    d.uview-plus
        a.说明
            uview-plus3.0是基于uView2.x修改的vue3版本,感谢uView2.x开发者。
            uview-plus是uni-app生态专用的UI框架,uni-app 是一个使用 Vue.js 开发所有前端应用的框架,开发者编写一套代码,
            可发布到iOS、Android、H5、以及各种小程序(微信/支付宝/百度/头条/QQ/钉钉)等多个平台(引言自uni-app网)。
            但目前除微信小程序,其它小程序平台的兼容可能存在一些问题,后续会针对这方面持续优化。
        b.Hbuilder X方式
            如果您是使用Hbuilder X开发的用户,您可以在uni-app插件市场通过uni_modules的形式进行安装,此安装方式可以方便您后续在uni_modules对uview-plus进行一键升级。
            在uni-app插件市场右上角选择uni_modules版本下的使用HBuilderX导入插件,导入到对应的项目中即可。
            注意: 此安装方式必须要按照下载方式安装的配置中的说明配置了才可用。
            下载地址:https://ext.dcloud.net.cn/plugin?name=uview-plus
        c.NPM方式
            // 如果您的根目录没有package.json文件的话,请先执行如下命令:
            // npm init -y

            npm install uview-plus

            // 更新
            // npm update uview-plus
        d.版本查询
            // 通过`console.log`打印的形式
            console.log(uni.$u.config.v);

            // 可以查阅uview-plus的配置文件得知当前版本号,具体位置为:
            /uview-plus/libs/config/config.js

03.常用模版
    a.snail-uni
        a.说明
            snail-uni 是 uniapp 最佳的开发框架,使用最新的前端技术栈 Vite5 + Vue3 + Ts + Uni Mini Router + UnoCss 构建,
            让你可以使用 Vscode 编辑器进行高效编码,通过命令行方式即可运行 web、小程序 和 App, 无需依靠 HBuilderX
            注:App 需要依赖 HBuilderX
            -------------------------------------------------------------------------------------------------
            snail-uni 集成了 Uni Mini Router路由插件系统,让你可以使用 vue-router的方式进行路由交互,
            内置了常用组件,layout布局,请求封装,UnoCSS,i18n多语言等基础功能。snail-uni 提供了专用的脚手架工具,
            通过命令方式即可创建不同启动模板,snail-uni集成了Oxlint最新的代码规范,更高效的检测代码质量。
        b.命令导向方式
            npm create snail-uni@latest
            pnpm create snail-uni                                    --使用
            yarn create snail-uni
            bun create snail-uni
        c.命令行选项
            支持以下模板:uni-ts、uni-tabbar-ts、uni-js、uni-tabbar-js
            支持以下ui库:Wot-Design、Uv-ui、Uview-plus、TuniaoUI
            npm create snail-uni <project-name> --t <template-name 模板名称> --ui <ui库(Wot-Design/Uv-ui/Uview-plus/TuniaoUI> --lint <yes/no)>
            npm create snail-uni <project-name> <语言类型(js/ts)> <是否使用(tabbar/no)> <是否使用代码检查(eslint/no)> <ui库(Wot-Design/Uv-ui/Uview-plus/TuniaoUI)>
        d.命令导向方式-界面版
            ● wot-design-ui (推荐)    轻量级 UI 组件库,专为 UniApp 设计,组件丰富(覆盖表单、导航、交互等场景),体积小且性能优化较好,支持按需引入,适合追求轻量化和跨端一致性的项目。
            ○ uv-ui                  基于 UniApp 的高颜值 UI 组件库,主打 “简洁优雅”,组件设计偏向现代风格,动画效果流畅,文档清晰,对新手友好,适合注重界面美观度的应用。
            ○ uview-plus             前身是 uView UI,是 UniApp 生态中比较成熟的组件库,组件数量多(超过 200 个),覆盖场景全面,支持 H5、小程序、App 多端适配,社区活跃,问题解决效率高,适合中大型项目。
            ○ tuniao-ui              由 “途牛” 团队开发的 UniApp 组件库,最初为旅游场景设计,后来开源通用化,组件注重实用性和交互体验,包含一些特色功能(如日历选择、地址选择等),适合电商、旅游类应用。
            ○ nut-ui                 京东推出的移动端 UI 组件库,基于 Vue 3,同时支持 UniApp,组件风格偏电商场景(如商品卡片、购物车、支付相关组件),设计规范统一,性能稳定,适合电商类项目。
            ○ uni-ui                 DCloud 官方推出的 UniApp 组件库,与 UniApp 框架深度集成,兼容性最佳,更新迭代与框架同步,组件轻量化但基础功能齐全,适合对兼容性要求高、追求稳定的项目。
            -------------------------------------------------------------------------------------------------
            进入项目: cd snail-uni-app
            安装依赖: pnpm install (安装前,请检查Node版本>= 18.0.0 )
            运行项目: pnpm dev (默认运行微信小程序),打开 微信开发者工具, 导入 dist/dev/mp-weixin 运行
            snail-uni文档: https://hu-snail.github.io/snail-uni
        e.snail-uni启动运行脚本
            在package.json中配置
            -------------------------------------------------------------------------------------------------
            {
              "scripts": {
                "dev": "uni -p mp-weixin",
                "dev:h5": "uni",
                "build": "uni build -p mp-weixin",
                "build:h5": "uni build"
              },
            }
        f.dev脚本
            将启动具有即时热更新的本地开发服务器。使用以下命令运行它:
            默认启动微信小程序,根据自己需求在package.json 中进行调整
            -------------------------------------------------------------------------------------------------
            npm run dev
            pnpm dev
            yarn dev
            bun run dev
        g.build脚本
            将构建应用,并生成一个或多个平台包。使用以下命令运行它:
            默认构建微信小程序,根据自己需求在package.json 中进行调整
            -------------------------------------------------------------------------------------------------
            npm run build
            pnpm build
            yarn build
            bun run build
    b.unibest
        a.说明
            最好的 uniapp 开发模板,由 uniapp + Vue3 + Ts + Vite5 + UnoCss + wot-ui + z-paging 构成,使用了最新的前端技术栈,
            无需依靠 HBuilderX,通过命令行方式运行 web、小程序 和 App(编辑器推荐 VSCode,可选 webstorm)
        b.前置依赖
            Node.js - >=v20 (我的是 v22.13.0)
            pnpm - >=9+ (我的是 10.11.0)
            VSCode - 可选 WebStorm
            HBuilderX - APP 的运行和发布还是离不开它
        c.创建项目
            # 如果没有 pnpm,请先安装: npm i -g pnpm
            pnpm create unibest
            # 时不时加一下 @latest 标识,这样可以使用最新版本的 create-unibest
            pnpm create unibest@latest
            -------------------------------------------------------------------------------------------------
            base (基于wot-ui)
            base-sard-ui (基于 sard-ui)
            base-uv-ui (基于 uv-ui)
            base-uview-pro (基于 uview-pro)
            base-skiyee-ui (基于 skiyee-ui)
            base-uview-plus (基于 uview-plus, 需要看广告不推荐使用)
            i18n (多语言)
            demo (演示项目)
        d.安装、运行
            pnpm i
            pnpm dev     # 运行h5,在浏览器打开 http://localhost:9000/
            pnpm dev:mp  # 运行微信小程序
            pnpm dev:app # 运行App
        e.注意事项
            若代码里面自动引入的 API 报错,只需要 pnpm dev 即可
            若代码运行后,H5端 浏览器界面底部没有 tabbar,刷新浏览器或者再次 pnpm dev 即可
    c.uni-plus
        a.说明
            一个 “超超超” 好用的 uniapp 开发框架:uni-plus 是由 Uniapp + Vue3 + TS + Vite + Pinia + Unocss + WotUi 驱动的跨端快速启动模板,
            使用 VS Code 开发,具有丰富的代码提示、错误校验、类型提醒、预先插件安装、代码片段等功能,
            而且拥有丰富的案例 Echarts 图表,表单分页,权限控制、接口请求优化等等(配备搭建教程)
            -------------------------------------------------------------------------------------------------
            uni-plus 提供了 layout布局、请求封装、请求拦截、权限控制、原子CSS、路由拦截、路由自动导入 等基础功能,
            并且配备了 代码提示、代码高亮、代码格式化、commit 优化 等开发环境配置,让您的开发更加高效、便捷
            -------------------------------------------------------------------------------------------------
            uni-plus 目前支持 H5、小程序 和 App
        b.创建项目
            pnpm create uni-plus -n <项目名>
            -------------------------------------------------------------------------------------------------
            pnpm create uni-plus -n uni-plus
            npx create-uni-plus -n uni-plus
            npm create uni-plus -n uni-plus
        c.两个模板
            一个是 base 模板,一个是 demo 模板
            demo 模板是基于 base 模板进行扩展的
            想快速入门的话,可以下载 demo 模板,然后使用查看文档教程
            大概看一遍就能大致理解,模板的大致结构与组成了

6.4 shadcn

01.shadcn
    a.环境准备
        # Node.js 版本检查
        node --version  # >= 18.0.0
        # npm 版本检查
        npm --version   # >= 8.0.0
        # 或者使用 yarn/pnpm
        yarn --version # >= 1.22.0
        pnpm --version # >= 7.0.0
    b.创建react项目
        # 使用 Vite 创建项目(推荐)
        npm create vite@latest my-shadcn-app -- --template react-ts
        # 使用 Next.js 创建项目
        npx create-next-app@latest my-shadcn-app --typescript
        # 使用 Create React App
        npx create-react-app my-shadcn-app --template typescript
    c.初始化项目
        cd my-shadcn-app
        # 安装 Tailwind CSS 及其依赖
        npm install -D tailwindcss postcss autoprefixer
        # 初始化 Tailwind 配置
        npx tailwindcss init -p
    d.初始化 Shadcn/ui
        # 安装 Shadcn/ui CLI
        npm install -D shadcn-ui@latest
        # 安装 Shadcn/ui CLI
        npx shadcn@latest init
        # 或者使用 yarn
        yarn dlx shadcn@latest init
        # 或者使用 pnpm
        pnpm dlx shadcn@latest init
    e.安装必要依赖
        # 安装 Radix UI 和其他依赖
        npm install class-variance-authority clsx tailwind-merge
        # 如果使用了动画功能,还需要安装
        npm install tailwindcss-animate
    f.修改 tailwind.config.js
        module.exports = {
          content: [
            './pages/**/*.{js,ts,jsx,tsx}',
            './components/**/*.{js,ts,jsx,tsx}',
            './app/**/*.{js,ts,jsx,tsx}',
          ],
          theme: { extend: {} },
          plugins: [],
        }
    g.在 globals.css 加上
        @tailwind base;
        @tailwind components;
        @tailwind utilities;

02.shadcn命令
    a.查看
        # 查看所有可用组件
        npx shadcn@latest list
    b.添加新组件
        # 添加单个组件
        npx shadcn@latest add [component-name]
        # 添加多个组件
        npx shadcn@latest add button card input
        -----------------------------------------------------------------------------------------------------
        # 添加组件(例如 Button),它会在项目中创建一个组件文件,components/ui/button.tsx
        npx shadcn@latest add button
    c.常用组件
        # 表单组件
        npx shadcn@latest add textarea checkbox radio-group switch
        # 导航组件
        npx shadcn@latest add navigation-menu sidebar breadcrumb
        # 数据展示
        npx shadcn@latest add progress skeleton separator
        # 反馈组件
        npx shadcn@latest add tooltip popover hover-card
        # 布局组件
        npx shadcn@latest add scroll-area aspect-ratio
    d.主题切换
        import { useTheme } from "next-themes"

        export function ThemeToggle() {
          const { theme, setTheme } = useTheme()

          return (
            <Button
              variant="outline"
              size="icon"
              onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
            >
              {theme === "dark" ? "🌙" : "☀️"}
            </Button>
          )
        }
    e.按钮使用
        import { Button } from "@/components/ui/button"
        import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
        import { Input } from "@/components/ui/input"
        import { Label } from "@/components/ui/label"
        import { Badge } from "@/components/ui/badge"

        export function ExampleComponent() {
          return (
            <Card className="w-96">
              <CardHeader>
                <CardTitle>用户信息</CardTitle>
              </CardHeader>
              <CardContent className="space-y-4">
                <div className="space-y-2">
                  <Label htmlFor="name">姓名</Label>
                  <Input id="name" placeholder="输入姓名" />
                </div>
                <Badge variant="secondary">新用户</Badge>
                <Button>提交</Button>
              </CardContent>
            </Card>
          )
        }

03.shadcn-mcp
    a.Shadcn UI MCP (客户端命令)
        a.地址
            https://ui.shadcn.com/docs/mcp
        b.安装
            npx shadcn@latest mcp init --client claude
            yarn shadcn@latest mcp init --client claude
            bunx --bun shadcn@latest mcp init --client claude
            pnpm dlx shadcn@latest mcp init --client claude
        c.配置
            {
              "mcpServers": {
                "shadcn": {
                  "command": "npx",
                  "args": ["shadcn@latest", "mcp"]
                }
              }
            }
        d.使用
            mcp init: 初始化项目,使其连接到 MCP 服务器。
            mcp add: 从您的 MCP 服务器添加或拉取组件。
            mcp sync: 将本地组件与 MCP 服务器上的组件同步。
            -----------------------------------------------------------------------------------------------------
            # 示例:拉取组件
            pnpm dlx shadcn@latest mcp add button
    b.Shadcn UI MCP Server (服务端程序)
        a.地址
            https://github.com/Jpisnice/shadcn-ui-mcp-server
        b.安装
            # 基本用法 (每小时 60 次请求)
            npx @jpisnice/shadcn-ui-mcp-server
            # 使用 GitHub 令牌 (每小时 5000 次请求) - 推荐
            npx @jpisnice/shadcn-ui-mcp-server --github-api-key ghp_your_token_here
            # 切换框架
            npx @jpisnice/shadcn-ui-mcp-server --framework svelte
            npx @jpisnice/shadcn-ui-mcp-server --framework vue
            npx @jpisnice/shadcn-ui-mcp-server --framework react-native
    c.Shadcn调用
        a.查看
            # 查看1
            /mcp
            # 查看2
            claude mcp list
        b.操作
            XXXXXX

6.5 platform

00.汇总
    mpx:受Vue单文件开发的启发,Mpx也提供了类似的单文件开发模式,拓展名为.mpx
    tnwx:支持微信公众号、微信支付、微信小游戏、微信小程序、企业号/企业微信、企业微信开发平台
    taro:一个开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架,只编写一套代码就能够适配到多端的能力

01.mpx
    a.说明
        a.介绍
            Mpx是一款致力于提高小程序开发体验和开发效率的增强型小程序框架,
            通过Mpx,我们能够高效优雅地开发出具有极致性能的优质小程序应用,并将其输出到各大小程序平台和web平台中运行。
        c.极致性能
            Mpx在性能上做到了极致,我们在框架中通过模板数据依赖收集进行了深度的setData优化,做到了程序上的最优,让用户能够专注于业务开发;
            其次,Mpx的编译构建完全基于依赖收集,支持按需进行的npm构建,能够自动根据用户的分包配置抽离共用模块,确保用户最终产出项目的包体积最优;
            最后,Mpx的运行时框架部分仅占用51KB;
            Mpx和业内其他框架的运行时性能对比可以参考这篇文章
        d.编译构建
            Mpx的编译构建以webpack为基础,针对小程序项目结构深度定制开发了一个webpack插件和一系列loaders,
            整个构建过程完全基于依赖收集按需打包,兼容大部分webpack自身能力及生态,此外Mpx的编译构建还支持以下能力:
            npm构建
            分包构建
            包体积优化
            原生组件支持
            原生能力兼容(custom-tab-bar/workers/云开发等)
            小程序插件
            模板预编译
            css预编译
            静态资源处理
        e.跨平台能力
            Mpx支持全部小程序平台(微信,支付宝,百度,头条,qq)的增强开发,
            同时支持将一份基于微信增强的业务源码输出到全部的小程序平台和web平台中运行,也即将支持输出快应用的能力,更多详情请查看这里
    b.快速开始
        a.单文件开发
            小程序规范中每个页面和组件都是由四个文件描述组成的,wxml/js/wxss/json,分别描述了组件/页面的视图模板,执行逻辑,样式和配置,
            由于这四个部分彼此之间存在相关性,比如模板中的组件需要在json中注册,数据需要在js中定义,这种离散的文件结构在实际开发的时候体验并不理想;
            受Vue单文件开发的启发,Mpx也提供了类似的单文件开发模式,拓展名为.mpx。
        b.IDE支持
            推荐使用的 IDE 是 VS Code,配合官方维护的新版本 Mpx (Official) 插件。
            该插件提供了语法高亮、TypeScript 支持,以及模板内表达式与组件 props 的智能提示,提供更好的开发体验。
            Mpx (Official) 现在取代了我们过去提供的插件 mpx、mpx-template-features。历史插件将不再维护逐步废弃,请大家及时切换到新版插件。更多历史背景及功能差异请参考说明。
            Mpx (Official) 插件一大亮点功能是为 <template> 模板中的变量支持 TS 智能提示,包括类型提示、类型检查、自动补全、定义跳转等等功能。如下图所示:
        c.增强的模板语法
            同样受到Vue的启发,Mpx提供了很多增强模板语法便于开发者方便快捷地进行视图开发,主要包含以下:
            wx:style动态样式
            wx:class动态类名
            wx:model双向绑定
            wx:model-prop双向绑定属性
            wx:model-event双向绑定事件
            wx:model-value-path双向绑定数据路径
            wx:model-filter双向绑定过滤器
            wx:ref获取实例
            wx:show隐藏显示
            component动态组件
            事件处理内联传参
            模板条件编译

02.tnwx
    a.快速开始
        TNWX: TypeScript + Node.js + WeiXin 微信系开发脚手架,
        支持微信公众号、微信支付、微信小游戏、微信小程序、企业号/企业微信、企业微信开发平台。
        最最最重要的是能快速的集成至任何 Node.js 框架(Express、Nest、Egg、Koa 等)
    b.简易指南
        a.尝鲜版
            $ git clone https://gitee.com/javen205/TNWX.git
            $ cd TNWX
            $ yarn bootstrap
            $ yarn tsc
        b.运行示例
            $ cd sample/express && yarn
            $ yarn build
            $ yarn dev
        c.稳定版
            $ mkdir TNWX && cd TNWX
            $ yarn init -y
            $ yarn add tnwx
    c.开源推荐
        IJPay 让支付触手可及:https://gitee.com/javen205/IJPay
        SpringBoot 微服务高效开发 mica 工具集:https://gitee.com/596392912/mica
        Avue 一款基于 vue 可配置化的神奇框架:https://gitee.com/smallweigit/avue
        pig 宇宙最强微服务(架构师必备):https://gitee.com/log4j/pig
        SpringBlade 完整的线上解决方案(企业开发必备):https://gitee.com/smallc/SpringBlade

03.taro
    a.快速开始
        a.介绍
            Taro 是一个开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发
            微信/京东/百度/支付宝/字节跳动/QQ/飞书/快手小程序,H5/RN/ASCF元服务等应用。
            -------------------------------------------------------------------------------------------------
            现如今市面上端的形态多种多样,Web、React Native、微信小程序等各种端大行其道。
            当业务要求同时在不同的端都要求有所表现的时候,针对不同的端去编写多套代码的成本显然非常高,
            这时候只编写一套代码就能够适配到多端的能力就显得极为需要。
        b.安装
            # 使用 npm 安装 CLI
            $ npm install -g @tarojs/cli
            # 使用 yarn 安装 CLI
            $ yarn global add @tarojs/cli
            # 使用 pnpm 安装 CLI
            $ pnpm install -g @tarojs/cli
            -------------------------------------------------------------------------------------------------
            由于 Taro 部分能力使用 Rust 开发,在 Windows 上,请确保安装了 Microsoft Visual C++ Redistributable。
        c.查看 Taro 全部版本信息
            npm info @tarojs/cli
    b.项目初始化
        a.创建项目
            # 使用命令创建模板项目
            $ taro init myApp
            # npm 5.2+ 也可在不全局安装的情况下使用 npx 创建模板项目
            $ npx @tarojs/cli init myApp
        b.依赖安装
            在创建完项目之后,Taro 会默认开始安装项目所需要的依赖,安装使用的工具按照 yarn > cnpm > npm 顺序进行检测。
            一般来说,依赖安装会比较顺利,但某些情况下可能会安装失败,这时候你可以在项目目录下自己使用安装命令进行安装:
            # 进入项目根目录
            $ cd myApp
            # 使用 npm 安装依赖
            $ npm install
            # 使用 yarn 安装依赖
            $ yarn
            # 使用 pnpm 安装依赖
            $ pnpm install
    c.编译运行
        a.说明
            a.开发工具
                使用 Taro 的 build 命令可以把 Taro 代码编译成不同端的代码,然后在对应的开发工具中查看效果。
            b.Taro 编译分为 dev 和 build 模式
                dev 模式(增加 --watch 参数) 将会监听文件修改。
                build 模式(去掉 --watch 参数) 将不会监听文件修改,并会对代码进行压缩打包。
                dev 模式生成的文件较大,设置环境变量 NODE_ENV 为 production 可以开启压缩,方便预览,但编译速度会下降。
        b.微信小程序
            a.编译命令
                # pnpm
                $ pnpm dev:weapp
                $ pnpm build:weapp

                # yarn
                $ yarn dev:weapp
                $ yarn build:weapp

                # npm script
                $ npm run dev:weapp
                $ npm run build:weapp

                # 仅限全局安装
                $ taro build --type weapp --watch
                $ taro build --type weapp

                # npx 用户也可以使用
                $ npx taro build --type weapp --watch
                $ npx taro build --type weapp

                # watch 同时开启压缩
                $ set NODE_ENV=production && taro build --type weapp --watch # CMD
                $ NODE_ENV=production taro build --type weapp --watch # Bash
            b.小程序开发者工具
                下载并打开微信开发者工具,然后选择项目根目录进行预览。
                需要注意开发者工具的项目设置:
                需要设置关闭 ES6 转 ES5 功能,开启可能报错
                需要设置关闭上传代码时样式自动补全,开启可能报错
                需要设置关闭代码压缩上传,开启可能报错
        c.支付宝小程序
            a.编译命令
                # pnpm
                $ pnpm dev:alipay
                $ pnpm build:alipay

                # yarn
                $ yarn dev:alipay
                $ yarn build:alipay

                # npm script
                $ npm run dev:alipay
                $ npm run build:alipay

                # 仅限全局安装
                $ taro build --type alipay --watch
                $ taro build --type alipay

                # npx 用户也可以使用
                $ npx taro build --type alipay --watch
                $ npx taro build --type alipay

                # watch 同时开启压缩
                $ set NODE_ENV=production && taro build --type alipay --watch # CMD
                $ NODE_ENV=production taro build --type alipay --watch # Bash
            b.小程序开发者工具
                下载并打开支付宝小程序开发者工具,然后选择项目根目录下 dist 目录(根目录 config 中的 outputRoot 设置的目录)进行预览。
                需要注意开发者工具的项目设置:
                需要关闭 ES6 转 ES5 功能,开启可能报错
                需要关闭上传代码时样式自动补全,开启可能报错
                需要关闭代码压缩上传,开启可能报错

6.6 koa

01.安装
    npm install -g koa-generator
    koa --version

02.创建项目
    cd D:\software_xare\workspace_web2
    koa2 project                                                        --创建项目
    koa2 -e project                                                     --创建项目(使用ejs引擎)
    ---------------------------------------------------------------------------------------------------------
    koa2 koa
    cd koa
    npm install                                                         --安装
    SET DEBUG=koa* & npm start koa                                      --启动(project为项目名)

6.7 nestjs

01.安装
    npm install -g @nestjs/cli
    nest --version

02.创建项目
    cd D:\software_xare\workspace_web2\omsh
    nest new project                                                    --创建项目
    ---------------------------------------------------------------------------------------------------------
    nest new nestjs
    cd nestjs
    npm install                                                         --安装
    npm run start                                                       --启动

6.8 express

01.安装
    npm install -g express
    npm install -g express-generator                                    --express在4.0后把命令工具单独分了出来
    express --version

02.创建项目
    cd D:\software_xare\workspace_web2\omsh
    express -e project                                                  --创建项目
    ---------------------------------------------------------------------------------------------------------
    express -e express
    cd express
    npm install                                                         --安装
    SET DEBUG=project:* & npm start                                     --启动(表示启用所有以project开头的调试消息)

7 python

7.1 cuda

01.CUDA
    a.CUDA的默认安装位置
        C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
    b.解压CUDNN后的bin、include、lib三个文件夹 -> 粘贴至CUDA的默认安装位置
        C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
    c.环境变量
        CUDA_PATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
        CUDA_PATH_V10_2:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
        NVCUDASAMPLES_ROOT:C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.2
        NVCUDASAMPLES10_2_ROOT:C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.2
        C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin
        C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp
        C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\extras\CUPTI\libx64
        C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\cudnn\bin
        C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.1\
    d.测试CUDA是否安装成功
        C:\Users\13514>nvcc -V
        nvcc: NVIDIA (R) Cuda compiler driver
        Copyright (c) 2005-2019 NVIDIA Corporation
        Built on Wed_Oct_23_19:32:27_Pacific_Daylight_Time_2019
        Cuda compilation tools, release 10.2, V10.2.89
        C:\Users\13514>nvidia-smi
        Thu Sep 24 12:47:59 2020
    e.NVIDIA控制面板(NVIDIA GeForce GTX 1660 Ti)
        NVIDIA Control Panel -> 帮助 -> 系统信息 -> 组件 -> NVIDIA CUDA 10.2.132 driver

02.Pytorch 1.2.0
    a.创建Pytorch新环境,并指定python版本为3.7.9
        conda create -n pytorch python=3.7.9
    b.列举conda当前全部环境
        conda env list
        conda remove -n pytorch --all
    c.激活Pytorch新环境
        conda activate pytorch
    d.安装Pytorch(conda方式,可以判断所有安装包的版本间的兼容性,各种必备包自动安装),管理员方式启动
        a.升级conda
            conda update -n base -c defaults conda
        b.安装Pytorch的GPU版本(注意一定去掉-c pytorch,才可以使用国内镜像加速)
            conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0
        c.安装Pytorch的CPU版本
            conda install pytorch torchvision cpuonly
    e.测试Pytorch
        import torch
        print(torch.__version__)
        print('gpu:', torch.cuda.is_available())

03.TensorFlow 2.0.0
    a.创建TensorFlow新环境,并指定python版本为3.7.9
        conda create -n tf2 tensorflow-gpu python=3.7.9
    b.列举conda当前全部环境
        conda env list
        conda remove -n tf2 --all
    c.激活TensorFlow新环境
        conda activate tf2
    d.安装TensorFlow(conda方式,可以判断所有安装包的版本间的兼容性,各种必备包自动安装),管理员方式启动
        a.升级conda
            conda update -n base -c defaults conda
        b.安装TensorFlow的GPU版本
            conda search tensorflow-gpu
            conda install tensorflow-gpu=2.0.0
        c.安装TensorFlow的CPU版本
            conda search tensorflow
            conda install tensorflow=2.0.0
    e.测试TensorFlow
        import tensorflow as tf
        tf.compat.v1.disable_eager_execution()
        sess = tf.compat.v1.Session()
        a=tf.constant(1)
        b=tf.constant(2)
        print(sess.run(a+b))
        print(tf.test.is_gpu_available())
    f.解决报错
        pip uninstall tensorflow
        pip install tensorflow==2.0.0

7.2 colab

01.Colab
    a.Golab
        https://colab.research.google.com/notebooks/welcome.ipynb
    b.Google Drive
        https://drive.google.com/drive/my-drive
    C.Colaboratory
        新建 -> Goole Colaboratory -> XXX.ipynb
        修改 -> 笔记本设置 -> GPU
    d.Pytorch
        a.安装
            !pip3 install https://download.pytorch.org/whl/cu80/torch-0.4.1-cp36-cp36m-linux_x86_64.whl
        b.测试
            import torch
            print(torch.__version__)
            print('gpu:', torch.cuda.is_available())
            x = torch.empty(5, 3)
            print(x)
            ------------------------------------------------
            1.7.0+cu101
            gpu: True
            tensor([[-6.0314e+18,  0.0000e+00,  3.3631e-44],
                    [ 0.0000e+00,         nan,  0.0000e+00],
                    [ 4.4721e+21,  1.5956e+25,  4.7399e+16],
                    [ 3.7293e-08,  1.4838e-41,  0.0000e+00],
                    [-6.0314e+18,  0.0000e+00, -1.9342e-03]])
    e.Tensorflow
        a.安装

        b.测试
            import tensorflow as tf
            tf.test.gpu_device_name()
            ------------------------------------------------
            '/device:GPU:0'
            True
    f.性能
        a,GPU显存信息
            !/opt/bin/nvidia-smi
            +-----------------------------------------------------------------------------+
            | NVIDIA-SMI 418.67       Driver Version: 418.67       CUDA Version: 10.1     |
            |-------------------------------+----------------------+----------------------+
            | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
            | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
            |===============================+======================+======================|
            |   0  Tesla T4            Off  | 00000000:00:04.0 Off |                    0 |
            | N/A   60C    P0    29W /  70W |   1065MiB / 15079MiB |      0%      Default |
            +-------------------------------+----------------------+----------------------+

            +-----------------------------------------------------------------------------+
            | Processes:                                                       GPU Memory |
            |  GPU       PID   Type   Process name                             Usage      |
            |=============================================================================|
            +-----------------------------------------------------------------------------+
        b.将页面挂在到Google drive
            !apt-get install -y -qq software-properties-common python-software-properties module-init-tools
            !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
            !apt-get update -qq 2>&1 > /dev/null
            !apt-get -y install -qq google-drive-ocamlfuse fuse
            from google.colab import auth
            auth.authenticate_user()
            from oauth2client.client import GoogleCredentials
            creds = GoogleCredentials.get_application_default()
            import getpass
            !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
            vcode = getpass.getpass()
            !echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}
        c.进入需要的目录中调用数据集
            !mkdir -p drive
            !google-drive-ocamlfuse drive
            import os
            import sys
            os.chdir('drive/Colab Notebooks')

02.Colaboratory本地运行
    a.本地安装Jupyter
        conda install -c conda-forge jupyterlab
    b.本地安装并启用jupyter_http_over_ws jupyter扩展程序(一次性)
        a.安装
            pip install jupyter_http_over_ws
            jupyter serverextension enable --py jupyter_http_over_ws
        b.停用
            !jupyter serverextension disable --py jupyter_http_over_ws
        c.移除
            !pip uninstall jupyter_http_over_ws
    c.本地启动服务器并进行身份验证,设置一个标记来明确表明信任来自Colaboratory前端的WebSocket连接
        jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
    d.Colab连接到本地运行时
        http://127.0.0.1:8888/?token=fd9d6e20ebb86845ef855600b5ff00aa91e1c2a08b9f62e9

7.3 jupyter

01.默认路径
    a.运行命令:jupyter notebook --generate-config
        a.报错
            ImportError: DLL load failed: 找不到指定的模块
            ModuleNotFoundError: No module named 'pysqlite2'
        b.解决
            https://www.pianshen.com/article/56211259074/
            去sqlite3官网下载对应64位的插件,将sqlite3.def、sqlite3.dll复制到../Anaconda/DLLs目录
    b.由于存在多个python版本,因此需要指定环境变量(Anaconda的base环境、Anaconda的tf2环境,添加一个即可)
        D:\software\JetBrains\Anaconda\Scripts(本次)
        D:\software\JetBrains\Anaconda\envs\tf2\Scripts
        D:\software\JetBrains\Anaconda\envs\pytorch\Scripts
    c.查找配置文件,若不存在jupyter_notebook_config.py,会自动生成
        C:\Users\13514>jupyter notebook --generate-config
        Writing default config to: C:\Users\13514\.jupyter\jupyter_notebook_config.py
    d.默认路径
        a.打开目录
            cd C:\Users\13514\.jupyter\jupyter_notebook_config.py
        b.修改jupyter_notebook_config.py
            ## The directory to use for notebooks and kernels.
            c.NotebookApp.notebook_dir = 'D:\\software_ware\\workspace_conda'
    e.快捷键
        Jupyter Notebook-> 右键属性 -> 快捷方式 -> 目标 -> 删除%USERPROFILE% -> 保存

02.主题
    a.安装jupyterthemes
        pip install jupyterthemes
    b.查看主题
        jt -l
    c.主题设置
        jt -t oceans16
    d.还原主题
        jt -r
    e.主题详细设置
        jt -t monokai -f roboto -nf robotosans -tf robotosans -N -T -cellw 70% -dfs 10 -ofs 10

03.Nbextensions插件:针对Jupyter Notebook中的Markdown文件自动生成目录,以及自动补全代码
    a.安装
        python -m pip install jupyter_contrib_nbextensions
    b.执行
        jupyter contrib nbextension install --user --skip-running-check
    c.勾选
        Table of Contents 以及 Hinterland

7.4 anaconda

01.Anaconda
    a.下载Anaconda
        https://www.anaconda.com/distribution/
    b.环境变量
        C:\ProgramData\Anaconda3\
        C:\ProgramData\Anaconda3\Scripts\                                                   --conda位置
        C:\ProgramData\Anaconda3\Library\bin\
        C:\ProgramData\Anaconda3\Library\usr\bin\
        C:\ProgramData\Anaconda3\Library\mingw-w64\bin\
    c.conda测试
        a.命令
            conda info
            conda info --envs
            -------------------------------------------------------------------------------------------------
            conda create -n tf2 tensorflow-gpu python=3.6
            conda list
            conda activate tf2
            conda deactivate
            conda install scipy
            conda remove scipy
            conda remove -n tf2 --all
            conda remove -n pytorch --all
            -------------------------------------------------------------------------------------------------
            conda --version
            conda update -n base -c defaults conda
        b.镜像源(C:\Users\13514\.condarc)
            channels:
              - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
              - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
              - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
              - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
              - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
              - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
              - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
            show_channel_urls: true
            ssl_verify: true
        c.修改conda默认下载位置(C:\Users\13514\.condarc)
            channels:
              - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
              - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
              - defaults
            show_channel_urls: true
            ssl_verify: true
            pkgs_dirs:
              - D:\software\JetBrains\Anaconda\pkgs
              - C:\Users\13514\.conda\pkgs
              - C:\Users\13514\AppData\Local\conda\conda\pkgs
            envs_dirs:
              - D:\software\JetBrains\Anaconda\envs
              - C:\Users\13514\.conda\envs
              - C:\Users\13514\AppData\Local\conda\conda\envs
        d.查看配置信息
            conda info
    d.conda卸载
        a.第1步
            conda install anaconda-clean
            anaconda-clean --yes
        b.第2步
            conda info
            安装路径为:/Users/zhaojungang/downloads/enter
            首先进入该文件夹内:cd downloads
            删除此目录下的enter文件夹:rm -rf ./enter
        c.第3步
            rm -rf ~/miniconda3
            rm -rf ~/Apps/anaconda3
            rm -rf ~/.anaconda_backup
            rm -rf ~/.conda
            rm -rf ~/.continuum
            rm -rf ~/.condarc
            rm -rf ~/.condarc ~/.conda ~/.continuum
        c.第3步
            vi ~/.zshrc
            vi ~/.bash_profile
            -------------------------------------------------------------------------------------------------
            删除
        d.第4步
            conda info --envs

02.python测试
    a.命令
        pip --version
        python -m pip install --upgrade pip==20.2.4
        python --version
        python -m site
        python -m site -help
        pip freeze > requirements.txt
        pip install -r requirements.txt
        pip unistall -r requirements.txt
        https://pypi.python.org/simple
        https://pypi.tuna.tsinghua.edu.cn/simple
    b.镜像源(C:\Users\13514\pip\pip.ini)
        [global]
        index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
    c.修改pip默认下载位置(D:\software\JetBrains\Anaconda\Lib\site.py,第87行附近)
        USER_SITE = "D:\software\JetBrains\Anaconda\Lib\site-packages"
        USER_BASE = "D:\software\JetBrains\Anaconda\Scripts"
    d.查看配置信息
        python -m site

7.5 python

01.环境变量
    C:\software\Python-3.6.2\
    C:\software\Python-3.6.2\Scripts\
    C:\software\Python-3.7.2\
    C:\software\Python-3.7.2\Scripts\
    C:\software\Python-3.8.2\
    C:\software\Python-3.8.2\Scripts\
    ---------------------------------------------------------------------------------------------------------
    [+] WORKON_HOME => .
    [+] PIPENV_CUSTOM_VENV_NAME => .venv

02.命令
    pip --version
    python --version
    ---------------------------------------------------------------------------------------------------------
    pip list
    python -m site
    pip config list -v
    ---------------------------------------------------------------------------------------------------------
    pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
    pip uninstall -y 包名1 包名2 包名3
    pip show numpy
    ---------------------------------------------------------------------------------------------------------
    pip freeze > requirements.txt
    pip install -r requirements.txt
    pip uninstall -r requirements.txt
    ---------------------------------------------------------------------------------------------------------
    python -m pip install --upgrade pip
    python -m pip install --upgrade pip==21.1.1
    python -m pip install --upgrade pip==21.1.1 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

03.配置
    a.修改pip默认下载位置(C:\software\Python-3.7.2\Lib\site.py,第87行附近)
        USER_SITE = "C:\software\Python-3.6.2\Lib\site-packages"
        USER_BASE = "C:\software\Python-3.6.2\Scripts"
        USER_SITE = "C:\software\Python-3.7.2\Lib\site-packages"
        USER_BASE = "C:\software\Python-3.7.2\Scripts"
        USER_SITE = "C:\software\Python-3.8.2\Lib\site-packages"
        USER_BASE = "C:\software\Python-3.8.2\Scripts"
        USER_SITE = "C:\software\Python-3.9.6\Lib\site-packages"
        USER_BASE = "C:\software\Python-3.9.6\Scripts"
    b.永久更改镜像源(C:\Users\13514\pip\pip.ini)
        [global]
        index-url = http://pypi.douban.com/simple
        -----------------------------------------------------------------------------------------------------
        index-url = https://pypi.python.org/simple
        index-url = https://mirrors.aliyun.com/pypi/simple/
        index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
        -----------------------------------------------------------------------------------------------------
        [global]
        timeout = 3000
        index-url = https://pypi.tuna.tsinghua.edu.cn/simple
        trusted-host = pypi.tuna.tsinghua.edu.cn
    c.临时更改镜像源
        pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
    d.Pycharm依赖于--build-dir来安装包,而最新版pip移除了该方式,故需要将pip版本回退至20.2.4
        WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
        经测试,IDEA设置代理可以看到pip安装版本,命令行需clash设置TUN模式;
        如果要使用pipenv环境,需关闭clash代理;
        如果要使用pip环境,访问https://pypi.python.org/simple,需开启clash代理
        -----------------------------------------------------------------------------------------------------
        C:\software\Python-3.8.2\python.exe -m pip install pip==20.2.4
        C:\software\Python-3.7.2\python.exe -m pip install pip==20.2.4
        C:\software\Python-3.6.2\python.exe -m pip install pip==20.2.4

04.手动安装
    a.网址
        https://pypi.org/
    b.whl包
        pip3 install XlsxWriter-1.0.5-py2.py3-none-any.whl
    c.tar.gz包
        tar -zxvf et_xmlfile-1.0.1.tar.gz && cd et_xmlfile-1.0.1 && ./configure && make && make install
        tar -zxvf et_xmlfile-1.0.1.tar.gz && cd et_xmlfile-1.0.1 && python setup.py install
    d.zip包
        unzip et_xmlfile-1.0.1.zip && cd et_xmlfile-1.0.1 && python setup.py install

05.常见命令
    a.pipdeptree
        pip install pipdeptree                                              --安装pipdeptree
        pipdeptree                                                          --查看依赖树
        pipdeptree --warn silence                                           --只显示项目直接依赖的包,不包括间接依赖
        pipdeptree --json-tree                                              --将依赖树以JSON格式输出,便于后续处理
        pipdeptree > dependencies.txt                                       --保存依赖树
    b.pip-autoremove(废弃)
        pip install pip-autoremove                                          --安装pip-autoremove
        pip-autoremove                                                      --自动移除不必要的包
        pip-autoremove requests -y                                          --卸载requests

06.依赖管理
    a.使用requirements.txt文件
        pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
        pip freeze > requirements.txt
        pip install -r requirements.txt
        pip uninstall -r requirements.txt
    b.使用pipenv
        pip install pipenv                                                  --安装
        pipenv --python 3.6 && pipenv --two && pipenv --three               --指定环境配置
        pipenv shell                                                        --进入虚拟环境
        pipenv --rm                                                         --删除虚拟环境
        exit                                                                --退出虚拟环境
        pipenv install numpy                                                --安装包
        pipenv install --dev numpy                                          --安装开发环境所需的包
        pipenv uninstall package_name                                       --卸载包
        pipenv uninstall --all                                              --只卸载包,不删除虚拟环境
        pipenv --clear                                                      --清理缓存
        pipenv install                                                      --根据Pipfile或Pipfile.lock安装依赖
        pipenv lock                                                         --更新Pipfile.lock文件
    c.使用Poetry
        pip install poetry                                                  --安装
        poetry new demo2                                                    --初始化一个项目
        poetry init                                                         --初始化项目并生成pyproject.toml
        poetry add <package>                                                --安装包并更新pyproject.toml
        poetry install                                                      --根据pyproject.toml安装依赖
        poetry shell                                                        --创建和激活虚拟环境
        poetry show                                                         --查看依赖列表
        poetry update                                                       --更新依赖
        poetry remove package-name                                          --删除依赖
        poetry publish                                                      --发布项目
        poetry config cache-dir D:/pypoetry_cache                           --修改默认缓存路径
        poetry config --list                                                --确认修改
        poetry env use python                                               --创建一个虚拟环境
        poetry env list
        poetry env info
    d.使用Conda
        conda info                                                          --查看Conda的总体信息
        conda info --envs                                                   --查看所有环境
        -----------------------------------------------------------------------------------------------------
        conda create -n env396 python=3.9.6
        conda create -n env38 python=3.8                                    --创建一个新环境
        conda activate env38                                                --激活一个环境
        conda deactivate                                                    --退出当前环境
        conda list                                                          --列出当前环境中的所有包
        conda remove -n env38 --all                                         --删除一个环境
        conda install scipy                                                 --安装包
        conda remove scipy                                                  --删除包
        -----------------------------------------------------------------------------------------------------
        conda --version                                                     --查看 Conda 版本

07.thefuck
    a.地址
        https://github.com/nvbn/thefuck/
    b.安装
        a.确保 Git Bash 或 Cygwin 中安装了 Python 3 和 pip
            python3 --version
            pip3 --version
        b.安装 thefuck
            注意,【关闭Clash代理,才能正常使用CMD】
            -------------------------------------------------------------------------------------------------
            pip3 install thefuck
            pip3 install thefuck -i https://mirrors.aliyun.com/pypi/simple/
        c.配置 thefuck
            将以下内容添加到 ~/.bashrc 或 ~/.zshrc 文件中:
            eval "$(thefuck --alias)"
            -------------------------------------------------------------------------------------------------
            运行以下命令使配置生效:
            source ~/.bashrc
    c.测试
        a.操作
            输入一个错误的命令,然后输入 fuck,看看是否能自动修正。
        b.示例
            ➜ puthon
            No command 'puthon' found, did you mean:
             Command 'python' from package 'python-minimal' (main)
             Command 'python' from package 'python3' (main)
            zsh: command not found: puthon
            ➜ fuck
            python [enter/↑/↓/ctrl+c]
            Python 3.4.2 (default, Oct  8 2014, 13:08:17)
            ...
        c.示例
            ➜ git brnch
            git: 'brnch' is not a git command. See 'git --help'.
            Did you mean this?
                branch
            ➜ fuck
            git branch [enter/↑/↓/ctrl+c]
            * master
    d.配置别名
        a.确保thefuck已安装
            thefuck --version
        b.编辑 ~/.bashrc 文件
            a.打开 Git Bash。
                略
            b.运行以下命令编辑 ~/.bashrc 文件:
                vi ~/.bashrc
            c.在文件末尾添加以下内容
                eval "$(thefuck --alias fuck)"
            d.保存并退出:
                按 Ctrl + O 保存文件。
                按 Enter 确认文件名。
                按 Ctrl + X 退出编辑器。
            e.使配置生效
                source ~/.bashrc
            f.测试
                type fuck

7.6 python:uv

01.介绍
    uv
    pip
    pipx
    pdm
    PyFlo
    conda
    poetry
    pipenv

02.uv工具
    a.安装
        curl -LsSf https://astral.sh/uv/install.sh | sh                           --On macOS and Linux
        powershell -c "irm https://astral.sh/uv/install.ps1 | iex"                --On Windows
        pip install uv                                                            --With pip
        pipx install uv                                                           --With pipx
        brew install uv                                                           --With Homebrew
    b.安装
        PS C:\Windows\system32> powershell -c "irm https://astral.sh/uv/install.ps1 | iex"                                      Downloading uv 0.5.27 (x86_64-pc-windows-msvc)                                                                          Installing to C:\Users\mysla\.local\bin
          uv.exe
          uvx.exe
        everything's installed!
        To add C:\Users\mysla\.local\bin to your PATH, either restart your shell or run:
            set Path=C:\Users\mysla\.local\bin;%Path%   (cmd)
            $env:Path = "C:\Users\mysla\.local\bin;$env:Path"   (powershell)
    c.使用
        uv venv                                                                   --在 .venv 文件夹创建虚拟管径
        uv pip install flask                                                      --安装依赖 Flask.
        uv pip install -r requirements.txt                                        --从 requirements.txt 文件中安装
        uv pip freeze > requirements.txt                                          --依赖保存到文件

02.uv工具
    a.虚拟环境管理
        uv venv .venv                                                             --创建虚拟环境
        uv venv -p python3.9 .venv                                                --使用指定 Python 版本创建虚拟环境
        uv sync                                                                   --同步依赖(通过uv在本地创建虚拟环境,并安装依赖)
    b.包管理基础命令
        uv pip install package_name                                               --安装包
        uv pip install -r requirements.txt                                        --从 requirements.txt 安装
        uv pip install package_name==1.0.0                                        --安装特定版本
        uv pip uninstall package_name                                             --卸载包
        uv pip install --upgrade package_name                                     --更新包
    c.依赖管理
        uv pip freeze > requirements.txt                                          --生成 requirements.txt
        uv pip export --requirement requirements.txt                              --导出依赖
        uv pip compile requirements.in -o requirements.txt                        --编译依赖锁定文件
    d.包信息查询
        uv pip list                                                               --列出已安装的包
        uv pip show package_name                                                  --显示包信息
        uv pip search package_name                                                --搜索包
    e.缓存管理
        uv cache clean                                                            --清理缓存
        uv cache clear                                                            --清理所有缓存
    f.开发工具
        uv pip install -e .                                                       --以可编辑模式安装包
        uv pip build                                                              --构建分发包
    g.高级选项
        uv pip install --offline package_name                                     --离线模式安装
        uv pip install --no-cache package_name                                    --禁用缓存安装
        uv pip install --pre package_name                                         --安装预发布版本
        uv pip install --index-url https://pypi.org/simple package_name           --指定源安装
    h.配置管理
        uv config list                                                            --显示配置信息
        uv config set key value                                                   --设置配置
        uv config get key                                                         --获取配置值
    i.环境检查
        uv doctor                                                                 --检查环境
        uv --version                                                              --版本信息
    j.依赖解析
        uv pip list --tree                                                        --显示依赖树
        uv pip check                                                              --检查依赖冲突

7.7 python:direnv

01.windows
    a.安装
        https://github.com/direnv/direnv/releases
    b.环境变量
        C:\direnv
    c.初始化PowerShell,Microsoft.PowerShell_profile.ps1
        if (Test-Path -Path $PROFILE) {
            Add-Content $PROFILE "`n`n# direnv hook`nInvoke-Expression (&direnv hook ps)"
        } else {
            New-Item -Path $PROFILE -ItemType File -Force
            Add-Content $PROFILE "`n`n# direnv hook`nInvoke-Expression (&direnv hook ps)"
        }
    d.初始化GitBash,.bashrc 或 .bash_profile
        eval "$(direnv hook bash)"
    e.验证
        direnv version

02.linux、mac
    a.安装direnv
        sudo apt-get install direnv                                         --linux
        brew install direnv                                                 --mac
    b.初始化shell
        eval "$(direnv hook bash)"                                          --linux.bashrc或.zshrc
        eval "$(direnv hook zsh)"                                           --zsh
    c.验证
        direnv version

03.配置示例
    use python                                                              --使用pyenv和direnv管理Python版本
    layout pipenv                                                           --使用pipenv和direnv管理虚拟环境
    layout python-venv                                                      --使用virtualenv和direnv管理虚拟环境

04.基本命令
    a.分类1
        direnv allow                                                        --允许加载.envrc文件
        direnv deny                                                         --撤销.envrc文件的加载
        direnv reload                                                       --重新加载环境
    b.分类2
        direnv status                                                       --列出当前加载的环境变量
        direnv edit .                                                       --编辑.envrc文件
        direnv diff                                                         --显示.envrc文件的 diff
    c.分类3
        export DATABASE_URL="postgres://user:password@localhost:5432/mydb"  --设置环境变量
        source_env .env                                                     --加载其他文件中的环境变量

7.8 python:pipenv1

01.安装
    a.地址
        https://github.com/pyenv-win/pyenv-win/archive/master.zip
    b.环境变量
        +代表添加,*代表追加
        [+] PYENV => C:\software\pyenv
        [+] PYENV_ROOT => C:\software\pyenv
        [+] PYENV_HOME => C:\software\pyenv
        [+] WORKON_HOME => .
        [+] PIPENV_CUSTOM_VENV_NAME => .venv
        [*] Path => %PYENV_HOME%\bin
        [*] Path => %PYENV_HOME%\shims

02.相关信息
    a.说明
        下载python版本,命令行需clash设置TUN模式;镜像为https://www.python.org/ftp/python
        下载包,默认镜像位置为C:\Users\13514\pip\pip.ini,网络问题关闭Clash,权限开启CMD管理员
    b.命令
        pipdeptree
        python -m site
        pip config list -v
    c.位置
        C:\software\pyenv\versions\3.9.6\Scripts\flask.exe
        C:\software\pyenv\versions\3.9.6\Lib\site-packages\flask

03.常见命令
    a.命令1
        pyenv install -l                                                             --查看支持的python版本列表
        pyenv install 3.6.2                                                          --安装一个版本
        pyenv install 3.7.2                                                          --安装一个版本
        pyenv install 3.8.2                                                          --安装一个版本
        pyenv install 3.9.6                                                          --安装一个版本
        pyenv install 3.11.2                                                         --安装一个版本
        pyenv uninstall 3.6.2                                                        --卸载python版本
        pyenv uninstall 3.7.2                                                        --卸载python版本
        pyenv uninstall 3.8.2                                                        --卸载python版本
        pyenv uninstall 3.9.6                                                        --卸载python版本
        pyenv uninstall 3.11.2                                                       --卸载python版本
        pyenv rehash                                                                 --手动删除shims文件夹,使用命令重新生成shims
        pyenv rehash                                                                 --经测试,即使重新生成,其他版本的flask命令依旧存在,但不影响使用
        pyenv rehash                                                                 --经测试,当前python36、37、38、39、311全部的命令集合
    b.命令2
        shell > local> global                                                        --优先级顺序
        pyenv versions                                                               --查看安装的所有python版本
        pyenv version                                                                --查看使用的python版本及其路径
        pyenv global 3.6.2                                                           --设置全局默认的Python版本
        pyenv global 3.7.2                                                           --设置全局默认的Python版本
        pyenv global 3.8.2                                                           --设置全局默认的Python版本
        pyenv global 3.9.6                                                           --设置全局默认的Python版本
        pyenv global 3.11.2                                                          --设置全局默认的Python版本
        pyenv local 3.9.6                                                            --在当前目录下设置默认的Python版本
        pyenv shell 3.9.6                                                            --设置临时的shell环境中使用的Python版本
    c.命令3
        出现路径/代码错误,使用CMD管理员执行命令,比如pipenv --python 3.6
        pipenv --python 3.9 && pipenv --two && pipenv --three                        --指定环境配置
        pipenv shell                                                                 --进入虚拟环境
        pipenv --rm                                                                  --删除虚拟环境
        exit                                                                         --退出虚拟环境

04.pyenv_mac,开启TUN模式,镜像源为https://www.python.org/ftp/python
    a.安装
        a.说明
            brew install openssl readline ncurses zlib
            brew install pyenv
        b.bash
            alias brew='env PATH="${PATH//$(pyenv root)\/shims:/}" brew'
            export PYENV_ROOT="$HOME/.pyenv"
            [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
            eval "$(pyenv init - bash)"
        c.zsh
            alias brew='env PATH="${PATH//$(pyenv root)\/shims:/}" brew'
            export PYENV_ROOT="$HOME/.pyenv"
            [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
            eval "$(pyenv init - zsh)"
        d.版本
            pyenv install 3.9.6                                                        --安装一个版本
            pyenv install 3.11.2                                                       --安装一个版本
        e.切换
            shell > local> global                                                      --优先级顺序
            pyenv versions                                                             --查看安装的所有python版本
            pyenv version                                                              --查看使用的python版本及其路径
            pyenv global 3.9.6                                                         --设置全局默认的Python版本
            pyenv global 3.11.2                                                        --设置全局默认的Python版本
            pyenv local 3.9.6                                                          --在当前目录下设置默认的Python版本
            pyenv shell 3.9.6                                                          --设置临时的shell环境中使用的Python版本
        f.M4芯片
            Python 3.9.1:第一个官方支持 Apple Silicon 的版本。它提供了对 M1 芯片的原生支持
            Python 3.8.x:虽然可以在 M1 芯片上运行,但它们通常需要通过 Rosetta 2 进行翻译,以支持 x86 架构
        g.永久更改镜像源(~/pip/pip.ini)
            [global]
            index-url = https://mirrors.aliyun.com/pypi/simple/
    b.镜像源
        a.地址
            包:https://pypi.python.org/simple
            包:https://mirrors.aliyun.com/pypi/simple/
            包:https://pypi.tuna.tsinghua.edu.cn/simple/
            软件:https://www.python.org/ftp/python
            软件:https://mirrors.tuna.tsinghua.edu.cn/python
        b.方式1:代理
            export http_proxy=http://127.0.0.1:7897
            export https_proxy=http://127.0.0.1:7897
        c.方式2:手动下载并安装
            curl -O https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
            tar -xf ~/Downloads/Python-3.7.2.tar.xz -C ~/Downloads
            pyenv install --skip-existing ~/Downloads/Python-3.7.2
        d.方式3:临时镜像源
            # 指定镜像
            export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
            export PYTHON_BUILD_MIRROR_URL="https://mirrors.tuna.tsinghua.edu.cn/python"
            # 安装依赖项
            brew install openssl readline ncurses zlib
        e.构建错误
            # 默认系统架构:arch
            pyenv install 3.7.2
            # arch(M1、M2)指定架构为x86_64
            arch -x86_64 pyenv install 3.7.2
            # 清理临时工作目录,然后重新尝试安装
            rm -rf /var/folders/_t/ydjhnbps3rl7llf2_y9mpyy00000gn/T/python-build.*
            # 查看报错日志
            open /var/folders/_t/ydjhbps3rl7llf2_y9mpyy00000gn/T/python-build.20250509085606.10559.log
    c.相关报错
        a.报错
            /var/folders/_t/ydjhnbps3rl7llf2_y9mpyy00000gn/T/python-build.20250509093828.27211 ~
            /var/folders/_t/ydjhnbps3rl7llf2_y9mpyy00000gn/T/python-build.20250509093828.27211/Python-3.8.3 /var/folders/_t/ydjhnbps3rl7llf2_y9mpyy00000gn/T/python-build.20250509093828.27211 ~
            checking build system type... arm-apple-darwin24.3.0
            checking host system type... arm-apple-darwin24.3.0
            checking size of pthread_key_t... 8
            checking whether pthread_key_t is compatible with int... no
            configure: error: Unexpected output of 'arch' on OSX
            make: *** No targets specified and no makefile found.  Stop.
        b.说明
            arch平台,需要变成arch -x86_64 pyenv install 3.8.3
        c.报错
            Last 10 log lines:
            clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/var/pyenv/versions/3.8.3/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/var/pyenv/versions/3.8.3/include -I/usr/local/opt/sqlite/include  -DPy_BUILD_CORE_BUILTIN  -c ./Modules/_codecsmodule.c -o Modules/_codecsmodule.o
            clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/var/pyenv/versions/3.8.3/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/var/pyenv/versions/3.8.3/include -I/usr/local/opt/sqlite/include  -DPy_BUILD_CORE_BUILTIN  -c ./Modules/_weakref.c -o Modules/_weakref.o
            ./Modules/posixmodule.c:9221:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                    ret = sendfile(in, out, offset, &sbytes, &sf, flags);
                          ^
        d.说明
            编译环境不同,需要使用CFLAGS="xxxxxxx"
        e.最终解决
            # 解决将 pyenv install --patch 3.8.3 变为 arch -x86_64 pyenv install --patch 3.8.3
            CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" arch -x86_64 pyenv install --patch 3.8.3 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch?full_index=1)

7.9 python:pipenv2

01.安装
    pip install pipenv && setx -m PIPENV_VENV_IN_PROJECT true                        --Windows环境
    pip install pipenv && cd /root/answer && pipenv --python 3.7.2                   --Vmware环境
    Virtualenv location: /root/.local/share/virtualenvs/answer-tFUt2dYh/bin/python   --输出环境信息

02.命令
    a.创建
        Virtualenv                                                          --继承全局站点软件包
        Pipenv                                                              --Pipenv可执行文件
        Poetry                                                              --Poetry可执行文件
        Conda                                                               --Python版本
    b.常用1
        pipenv --venv                                                       --查看项目位置
        pipenv --where                                                      --查看虚拟环境
        pipenv --py                                                         --查看虚拟环境中解释器的位置
    c.常用2(推荐pipenv安装,会生成Pipfile.lock文件)
        pipenv --python 3.9 && pipenv --two && pipenv --three               --指定环境配置
        pipenv shell                                                        --进入虚拟环境
        pipenv --rm                                                         --删除虚拟环境
        exit                                                                --退出虚拟环境
        --------------------------------------------------------------------
        pipenv install numpy                                                --安装包
        pipenv install numpy scipy matplotlib scikit-learn                  --自动处理依赖关系
        pipenv install --dev numpy                                          --安装开发环境所需的包
        pipenv uninstall package_name                                       --卸载包
        pipenv uninstall --all                                              --只卸载包,不删除虚拟环境
        pipenv --clear                                                      --清理缓存
        pipenv install                                                      --根据Pipfile或Pipfile.lock安装依赖
        pipenv lock                                                         --重新生成Pipfile.lock文件
        --------------------------------------------------------------------
        pipenv lock -r > requirements.txt                                   --将Pipfile里的全部包导出到requirements.txt
        pipenv lock -r --dev-only > requirements.txt                        --只导出开发环境的包
        pipenv lock -r --dev > requirements.txt                             --导出开发环境+ 默认的环境的包
        pipenv install -r requirements.txt                                  --通过pipenv导入
        pipenv run pip freeze > requirements.txt                            --使用底层pip的命令导出
        pipenv run pip install -r requirements.txt                          --使用底层pip的命令导入
    d.常用3(进入pipenv shell,执行pip,不会生成Pipfile.lock)
        pipenv --python 3.6 && pipenv --two && pipenv --three               --指定环境配置
        pipenv shell                                                        --进入虚拟环境
        pip list                                                            --进入虚拟环境,包列表
        pipenv run pip install numpy                                        --进入虚拟环境,安装包
        pip install numpy                                                   --进入虚拟环境,安装包
        pip uninstall package_name                                          --进入虚拟环境,卸载包
        pip freeze > requirements.txt                                       --进入虚拟环境,生成requirements.txt
        pip install -r requirements.txt                                     --进入虚拟环境,安装requirements.txt
        pip uninstall -r requirements.txt                                   --进入虚拟环境,卸载requirements.txt
        pipenv lock                                                         --重新生成Pipfile.lock文件
    e.由于通过pycharm或者进入进入pipenv shell,执行pip,不会生成Pipfile.lock,此时如果需要更新requirements.txt、Pipfile、Pipfile.lock
        pipenv shell                                                        --进入虚拟环境
        pip freeze > requirements.txt                                       --进入虚拟环境,生成requirements.txt
        -----------------------------------------------------------------------------------------------------
        此时,requirements.txt,版本号如下:
        anyio==4.4.0
        asgiref==3.8.1
        attrs==23.2.0
        -----------------------------------------------------------------------------------------------------
        此时,Pipfile,版本号均为*,由Pipfile.lock指定版本号
        [[source]]
        url = "https://mirrors.aliyun.com/pypi/simple/"
        verify_ssl = true
        name = "pip_conf_index_global"

        [dev-packages]

        [requires]
        python_version = "3.8"
        python_full_version = "3.8.2"

        [packages]
        anyio= "*"
        asgiref= "*"
        attrs= "*"
        -----------------------------------------------------------------------------------------------------
        关闭Clash代理工具,使用如下命令来重新更新Pipfile、Pipfile.lock
        -----------------------------------------------------------------------------------------------------
        pipenv install -r requirements.txt                                  --通过pipenv导入
        pipenv lock                                                         --重新生成Pipfile.lock文件

03.创建项目环境
    a.进入项目文件夹
        [root@bigdata01 ~]# cd /root/answer
        [root@bigdata01 workspace_pycharm]# ll
        total 8
        -rw-r--r--. 1 root root  192 Mar 18 19:39 Pipfile               --替代原来的requirements.txt
        -rw-r--r--. 1 root root 1082 Mar 18 19:34 Pipfile.lock          --根据Pipfile生成的JSON格式依赖文件
    b.修改镜像源,vi Pipfile
        [[source]]                                                      --设置仓库地址
        url = "https://pypi.tuna.tsinghua.edu.cn/simple"
        verify_ssl = true
        name = "pypi"
        [packages]                                                      --生产环境:项目依赖的包
        django = "==2.1.7"
        pytz = "==2018.9"
        [dev-packages]                                                  --开发环境:项目依赖的包
        [requires]                                                      --环境配置
        python_version = "3.7"
    c.安装项目依赖(django==2.1.7、pytz==2018.9)
        pipenv install django==2.1.7 pytz==2018.9                       --生产环境:更新Pipfile.lock中hash值
        pipenv install django==2.1.7 pytz==2018.9 --skip-lock           --生产环境:跳过更新hash值
        pipenv install django==2.1.7 pytz==2018.9 --skip-lock --dev     --开发环境:跳过更新hash值
        pip freeze > requirements.txt
        pip install -r requirements.txt
        pip unistall -r requirements.txt
        pipenv install -r requirements/local.txt -i https://pypi.python.org/simple --skip-lock
        pipenv install                                                  --安装Pipfile中[packages]的包
        pipenv install --dev                                            --安装Pipfile中[dev-packages]的包
        pipenv install --system                                         --使用系统的pip命令而不是虚拟环境命令
        pipenv install --ignore-pipfile                                 --忽略Pipfile直接安装Pipfile.lock
        pipenv install --skip-lock                                      --忽略Pipfile.lock直接安装Pipfile
        pipenv uninstall --all                                          --删除虚拟环境包,不改变Pipfile
        pipenv uninstall --all-dev                                      --删除虚拟环境包,并从Pipfile删除
    d.启动项目(startapp -> DJANGO_APPS、THIRD_PARTY_APPS、LOCAL_APPS -> install、migrate、runserver)
        pipenv run python manage.py makemigrations                      --针对某个字段进行迁移更新
        pipenv run python manage.py migrate                             --针对某个字段进行重新生成
        pipenv run python manage.py startapp news                       --生成应用
        pipenv run python manage.py runserver 0.0.0.0:8000              --启动项目
        pipenv run python manage.py createsuperuser                     --配置admin(halavah、XXXXXX)

04.其他
    a.管理虚拟环境
        pipenv shell                                                    --进入虚拟环境
        pipenv --rm                                                     --删除虚拟环境
        exit                                                            --退出虚拟环境
        python manage.py createsuperuser                                --进入pipenv创建管理
        python manage.py runserver 192.168.2.128:8000                   --进入pipenv启动项目
    b.生成测试覆盖度报告
        pipenv install coverage --skip-lock                             --安装测试工具
        pipenv run coverage run manage.py test -v 2                     --运行测试用例
        pipenv run coverage html                                        --生成测试报告
    c.常见命令汇总
        pipenv [OPTIONS] COMMAND [ARGS]
        OPTIONS:
            --where                                                     --显示项目文件所在路径
            --venv                                                      --显示虚拟环境文件路径
            --py                                                        --显示解释器的所在路径
            --envs                                                      --显示虚拟环境的选项变量
            --rm                                                        --删除当前使用的虚拟环境
            --bare                                                      --最小化输出
            --completion                                                --完整输出
        COMMAND:
            check                                                       --检查安全漏洞
            graph                                                       --显示当前依赖关系图信息
            install                                                     --安全虚拟环境或第三方库
            lock                                                        --锁定生成Pipfile.lock
            open                                                        --在编辑器中查看一个库
            run                                                         --在虚拟环境中运行命令
            shell                                                       --进入虚拟环境
            uninstall                                                   --卸载一个库
            update                                                      --卸载当前包并安装最新版

7.10 python:管理版本

01.Python检查版本
    a.查看系统自带的Python、pip
        whereis pip
        whereis python
    b.安装
        apt-get install python-minimal
        apt-get install curl
        curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
        python3 get-pip.py                                              --安装pip3
        python2 get-pip.py                                              --安装pip2
        apt-get install python3-testresources                           --防止pip3出错
        apt-get install python-testresources                            --防止pip2出错
        pip3 install --upgrade pip                                      --升级pip3
        pip2 install --upgrade pip                                      --升级pip2
        apt-get install -y python-pip                                   --安装pip2
        apt-get install -y python3-pip                                  --安装pip3
        pip install --upgrade pip                                       --更新pip版本
    c.测试
        pip3 --version                                                  --pip 20.2.4(Python 3.6.17)
        pip2 --version                                                  --pip 20.2.4(Python 2.7.17)
        python --version                                                --Python 2.7.17

02.Python默认版本
    a.用户级修改
        echo "alias python='/usr/bin/python3.6'" >> ~/.bashrc && source ~/.bashrc
    b.系统级修改
        a.修改软链接
            rm /usr/bin/python && ln -s /usr/bin/python3.6 /usr/bin/python
            rm /usr/bin/python3 && ln -s /usr/local/Python3.6.2/bin/python3 /usr/bin/python3
        b.管理器
            ls /usr/bin/python* && ls | grep python && dpkg -l python*
            update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
            update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
            update-alternatives --install /usr/bin/python python /usr/local/Python3.6.2/bin/python 3

03.pip报错
    a.修改pip默认版本,导致pip报错
        a.报错
            ImportError: No module named 'pip'
        b.文件
            vi /usr/bin/pip 或 vi /usr/bin/pip3
        c.解决
            #!/usr/bin/python 修改为 #!/usr/bin/python2.7 或 /usr/bin/python3.6
    b.升级pip更新为10.0.0,库里面的函数有所变动,导致pip报错
        a.报错
            ImportError: cannot import name 'main'
        b.文件
            vi /usr/bin/pip 或 vi /usr/bin/pip3
        c.解决
            from pip import main 修改为 from pip._internal import main
    c.修改python默认版本,导致yum报错
        a.报错
            ImportError: No module named 'pip'
        b.文件
            vi /usr/bin/yum 或 vi /usr/libexec/urlgrabber-ext-down
        c.解决
            #!/usr/bin/python 修改为 #!/usr/bin/python2.7 或 /usr/bin/python3.6

04.Python3.6.2
    a.依赖、卸载旧版本
        apt-get -y install gcc g++ make cmake
        apt-get -y install build-essential tk-dev
        apt-get -y install libncurses5-dev libncursesw5-dev libreadline6-dev
        apt-get -y install libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libc6-dev
        apt-get -y install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
        apt-get -y purge --auto-remove python3.7
    b.安装
        cd /root/ && wget --no-check-certificate https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz && tar -xvJf Python-3.6.2.tar.xz && rm -rf Python-3.6.2.tar.xz
    c.进入Modules目录修改配置文件Setup.dist,添加编译ssl模块
        vi /root/Python-3.6.2/Modules/Setup.dist
        SSL=/usr/local/ssl                                              --打开这四行注释
        _ssl _ssl.c \                                                   --打开这四行注释
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \           --打开这四行注释
        -L$(SSL)/lib -lssl -lcrypto                                     --打开这四行注释
    d.编译
        cd /root/Python-3.6.2/ && ./configure --prefix=/usr/local/python-3.6.2/ --enable-shared --with-openssl=/usr/local/openssl-1.1.1g && make -j 4 && make install && rm -rf /root/Python-3.6.2/
    e.无法加载libpython3.6m.so.1.0库文件
        cp /usr/local/python-3.6.2/lib/libpython3.6m.so.1.0 /usr/lib/
        cp /usr/local/python-3.6.2/lib/libpython3.6m.so.1.0 /usr/lib32/
        cp /usr/local/python-3.6.2/lib/libpython3.6m.so.1.0 /usr/lib64/
    f.修改软链接
        rm /usr/bin/python && rm /usr/bin/python2* && rm /usr/bin/python3* && rm /usr/bin/pip*
        # ln -s /usr/local/python-3.6.2/bin/python3 /usr/bin/python
        # ln -s /usr/local/python-3.6.2/bin/python3-config /usr/bin/python-config
        ln -s /usr/local/python-3.6.2/bin/python3 /usr/bin/python3
        ln -s /usr/local/python-3.6.2/bin/python3-config /usr/bin/python3-config
        ln -s /usr/local/python-3.6.2/bin/python3 /usr/bin/python3.6
        ln -s /usr/local/python-3.6.2/bin/python3-config /usr/bin/python3.6-config
        ln -s /usr/local/python-3.6.2/bin/pip3 /usr/bin/pip
        ln -s /usr/local/python-3.6.2/bin/pip3 /usr/bin/pip3
        python --version && python3 --version && python3.6 --version && pip --version && pip3 --version
    g.用update-alternatives来为整个系统更改Python版本
        a.设置优先级
            ls /usr/bin/python* && ls | grep python && dpkg -l python*
            update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
            update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
            update-alternatives --install /usr/bin/python python /usr/local/python-3.6.2/bin/python3.6 3
            update-alternatives --remove /usr/bin/python python /usr/local/python-3.6.2/bin/python3.6 3
        b.列出可用的Python替代版本
            update-alternatives --list python
        c.选择可用的Python替代版本
            update-alternatives --config python

05.Vim8支持Python3
    a.依赖、卸载旧版本
        apt-get -y install gcc g++ make cmake
        apt-get -y install build-essential tk-dev
        apt-get -y install libncurses5-dev libncursesw5-dev libreadline6-dev
        apt-get -y install libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libc6-dev
        apt-get -y install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
        apt-get -y install libcairo2-dev libx11-dev libxpm-dev libxt-dev python3-dev ruby-dev libperl-dev
        apt-get -y remove vim vim-runtime vim-tiny vim-common vim-scripts vim-doc
    b.安装
        cd /root/ && wget https://github.com/vim/vim/archive/refs/tags/v8.2.3156.tar.gz && tar -xvzf v8.2.3156.tar.gz && rm -rf v8.2.3156.tar.gz && python-config --configdir && python3-config --configdir
    c.编译
        cd /root/vim-8.2.3156/
        ./configure --with-features=huge \
        --enable-multibyte \
        --enable-rubyinterp=yes \
        --enable-python3interp=yes \
        --with-python3-config-dir=/usr/lib/python3.7/config-3.7m-x86_64-linux-gnu/ \
        --enable-perlinterp=yes \
        --prefix=/usr/local/vim8
        make -j 4 && make install && rm -rf /root/vim-8.2.3156/
    d.用户别名
        echo "alias vi='/usr/local/vim8/bin/vim'" >> ~/.bashrc && source ~/.bashrc && vi --version
        echo "alias vim='/usr/local/vim8/bin/vim'" >> ~/.bashrc && source ~/.bashrc && vim --version
    e.常见报错
        报错1:export PYTHON_CONFIGURE_OPTS="--enable-shared"
        解决1:Python编译,configure --prefix=/usr/local/python-3.6.2/ --enable-shared,python共享动态链接
        报错2:requires Vim compiled with Python (3.6.0+) support
        解决2:VIM编译,configure --enable-python3interp=yes --with-python3-config-dir,参数只能python2/3
        报错3:restart with ':YcmRestartServer', you need to compile YCM before using it
        解决3:YCM编译,cd ../k-vim/bundle/YouCompleteMe && python install.py,python软链接对应为python3.6+

7.11 pycharm远程开发

01.创建新文件夹
    mkdir D:\software_ware\workspace_pycharm\answer -> PyCharm打开answer新文件夹

02.Centos7远程项目
    a.配置【Root Path:/root + Deployment path:/answer = /root/answer】
        a.打开配置
            Tools -> Deployment -> Configuration -> + -> 类型SFTP -> 名称answer
        b.Connection
            SSH Configurations -> 192.168.2.128、root、4023666
            Root Path:/root
            Web server URL:http://192.168.2.128
            Advanced:Send keep alive messages each -> 2 seconds
        c.Mappings
            Local path:D:\software_ware\workspace_pycharm\answer
            Deployment path:/answer
            Web path:http://192.168.2.128
        d.Excluded Paths
            无
    b.选项
        a.打开配置
            Tools -> Deployment -> Options
        b.修改配置
            Exclude items by name:.svn;.cvs;.idea;.DS_Store;.git;.hg;*.hprof;*.pyc,【名称排除项】
            Operations logging:Details,【操作记录】
            Stop operation on the first error:不勾选,【在遇到第一个错误时停止操作】
            Overwrite up-to-date files:勾选,【覆盖最新文件】
            Preserve files timestamps:勾选,【保留文件时间戳】
            Delete target items when source ones do not exist:勾选,【当源项不存在时删除目标项】
            Create empty directories:勾选,【创建空目录】
            Prompt when overwriting or deleting local items:勾选,【覆盖或删除本地项时提示】
            Upload changed files automatically to the default server:勾选,【自动将更改的文件上传默认服务器】
            Skip external changes:勾选,【跳过外部变更】
            Delete remote files when local are deleted:勾选,【本地删除后删除远程文件】
            Override default permissions on files:rwxrwxrwx(777),【重写文件的默认权限】
            Override default permissions on folders:rwxrwxrwx(777),【重写文件夹的默认权限】
            Warn when uploading over newer file:No,【在有更新的文件情况下进行上传时发出警告】
            Show warning dialog on moving on Remote Host:勾选,【在远程主机上移动时显示警告对话框】
            SFTP Advanced Options(IDE level setting):勾选,SFTP高级选项(IDE级别设置)
            Add new host key to known_hosts:Always,将新主机键添加到known_hosts
            Hash hosts in known_hosts file:勾选,known_hosts文件中的哈希主机

03.Python解释器
    a.选择SSH解释器
        Project: answer -> Python Interpreter -> Add Python Interpreter -> SSH Interpreter
        SSH Configurations -> 192.168.2.128、root、4023666
    b.移动本地IDE编辑器到服务器
        Move
    c.配置SSH解释器对应的服务器相关内容
        Interpreter: /root/.local/share/virtualenvs/answer-tFUt2dYh/bin/python
        Sync folders:D:/software_ware/workspace_pycharm/answer 对应 /root/answer
        Automatically upload project files to the server

04.同步服务器代码、开启Django支持、项目启动配置
    a.同步代码
        answer -> Deployment -> Sync with Deployed to answer -> 手动Ctrl+S触发自动同步
    b.开启Django支持
        a.开启
            Languages & Frameworks -> Enable Django Support
        b.配置
            Django project root:D:\software_ware\workspace_pycharm\answer
            Settings:config\settings\local.py
            Do not use Diango test runner:不勾选
            Manage script:manage.py
            Environment variables:无
            Folder pattern to track files:无
    c.项目启动配置
        a.Host
            Host:192.168.2.128:8000
            Additional options:无
            Run browser:勾选
            Costom run command:不勾选
            Test server:不勾选
            No reload:不勾选
        b.Environment:
            Environment variables:PYTHONUNBUFFERED=1
            Python interpreter:Interpreter: /root/.local/share/virtualenvs/answer-tFUt2dYh/bin/python
            Interpreter options:无
            Working directory:D:\software_ware\workspace_pycharm\answer
            Path mappings:无
            Add content roots to PYTHONPATH:勾选
            Add source roots to PYTHONPATH:勾选
        c.Logs
            show console when a message is printed to standard output stream:勾选
            show console when a message is printed to standard error stream:勾选

8 sql

8.1 navicat

01.关系型数据库
    a.MySQL
        连接名:MySQL-5.7.25
        主机:localhost
        端口:3306
        用户名:root
        密码:123456
        -----------------------------------------------------------------------------------------------------
        连接名:MySQL-8.0.20
        主机:localhost
        端口:3307
        用户名:root
        密码:123456
    b.Oracle
        连接名:Oracle11g
        连接类型:Basic
        主机:127.0.0.1
        端口:1521
        服务名:ORCL
        用户名:scott
        密码:tiger
        -----------------------------------------------------------------------------------------------------
        连接名: Oracle11g_system
        连接类型:Basic
        主机:127.0.0.1
        端口:1521
        服务名:ORCL
        用户名:system
        密码:oracle
        -----------------------------------------------------------------------------------------------------
        连接名: Oracle11g_docker
        连接类型: Basic
        主机:127.0.0.1
        端口:41521
        SID:xe
        用户名: system
        密码: oracle
    c.MariaDB
        连接名:MariaDB
        主机:localhost
        端口:3309
        用户名:root
        密码:123456
    d.PostgreSQL
        连接名:PostgreSQL
        主机:localhost
        端口:5432
        初始数据库:postgres
        用户名:postgres
        密码:123456
    e.SQL Server
        连接名:SQL Server
        主机:127.0.0.1,1433
        初始数据库:master
        验证:SQL Server验证
        用户名:sa
        密码:123456
    f.SQLite3
        连接名:SQLite3
        类型:新建SQLite3
        数据库文件:C:\software\sqlite3\demo01.db

02.非关系型数据库
    a.Redis
        redis-cli.exe -h 127.0.0.1 -p 6379 -a myslayers
        redis-cli.exe -h 127.0.0.1 -p 6389 -a myslayers
    b.MongoDB
        连接名:MongoDB
        连接:Standalone
        主机:localhost
        端口:27017
        验证数据库:test
        用户名:root
        密码:123456
    c.Memcached
        11211

03.MySQL汇总
    a.application-druid.yml
        spring:
            datasource:
                master:
                  name: tent
                  # MySQL Connector/J 8.X 连接的示例
                  url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true

                  # MySQL Connector/J 5.X 连接的示例
                  url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8

                  # MySQL Connector/J 5.X 连接的示例
                  # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT

                  # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name}
                  # url: jdbc:oracle:thin:@127.0.0.1:1521:xe
                  # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name}
                  username: root
                  password: 123456
    b.application.properties
        mysql.driverClass=com.mysql.jdbc.Driver
        mysql.connectionUrl=jdbc:mysql://127.0.0.1:3307/ms_test_1115
        mysql.username=root
        mysql.password=123456
    c.常见配置
        驱动:mysql-connector-java-x.jar
        连接:jdbc:mysql://localhost:3306/clothsystem?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8
        连接:jdbc:mysql://127.0.0.1:3306/clothsystem?serverTimezone=Asia/Shanghai    --上海时间
        连接:jdbc:mysql://127.0.0.1:3306/clothsystem?serverTimezone=GMT%2b8          --北京时间(GMT-8)

04.驱动类汇总
    a.Oracle
        驱动:ojdbc-x.jar
        连接:jdbc:oracle:thin:@localhost:1521:ORCL
        -----------------------------------------------------------------------------------------------------
        Enterprise Manager Console HTTP 端口 (orcl) = 1158
        Enterprise Manager 代理端口 (orcl) = 3938
        Enterprise Manager Console HTTP 端口 (mynewccs) = 5500
        Enterprise Manager 代理端口 (mynewccs) = 1830
        Enterprise Manager Console HTTP 端口 (myicd) = 5501
        Enterprise Manager 代理端口 (myicd) = 1831
    b.PostgreSQL
        驱动:com.ibm.db2.jdbc.app.DB2Driver
        连接:jdbc:db2://<:port>/dbname
    c.SQL Server
        驱动:sqljdbc-x.jar
        连接:jdbc:microsoft:sqlserver:localhost:1433;databasename=数据库实例名
    d.DB2
        驱动:com.ibm.db2.jdbc.app.DB2Driver
        连接:jdbc:db2://<:port>/dbname

8.2 mysql1

01.安装
    a.环境变量
        path:C:\software\MySQL-8.0.20\bin
              C:\software\MySQL-5.7.25\bin
              C:\software\MySQL-5.5.62\bin
    b.测试
        mysql -V
        mysql -uroot -P 3307 -p
    c.在D:\software\SQL\MySQL-8.0.20下新建my.ini文件(C:\ProgramData\MySQL\MySQL Server 5.7\my.ini)
        [mysqld]
        # 设置3307端口
        port=3307
        # 设置mysql的安装目录
        basedir=C:\\software\\MySQL-8.0.20
        # 设置mysql数据库的数据的存放目录
        datadir=C:\\software\\MySQL-8.0.20\\data
        # 允许最大连接数
        max_connections=200
        # 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
        max_connect_errors=10
        # 服务端使用的字符集默认为UTF8
        character-set-server=UTF8MB4
        # 创建新表时将使用的默认存储引擎
        default-storage-engine=INNODB
        # 默认使用“mysql_native_password”插件认证
        default_authentication_plugin=mysql_native_password
        [mysql]
        # 设置mysql客户端默认字符集
        default-character-set=UTF8MB4
        [client]
        # 设置mysql客户端连接服务端时默认使用的端口
        port=3307
        default-character-set=UTF8MB4
    d.cmd(管理员运行,配置环境变量后,在识别bin目录的情况下,安装MySQL8.0.20服务会失败,建议不将MySQL添加到环境变量)
        a.打开bin目录
            cd C:\software\MySQL-8.0.20\bin
            cd C:\software\MySQL-5.7.25\bin
            cd C:\software\MySQL-5.5.62\bin
        b.初始化数据库(MySQL-5.5.62无需初始化数据库,默认root用户,无密码,可以直接进入修改密码)
            mysqld --initialize --console
            mysqld --initialize --console
            mysqld --initialize --console
            mysqld --defaults-file=C:\software\MySQL-8.0.20\my.ini --initialize --console
            mysqld --defaults-file=C:\software\MySQL-5.7.25\my.ini --initialize --console
            mysqld --defaults-file=C:\software\MySQL-5.5.62\my.ini --initialize --console
        c.命令行安装MySQL服务
            mysqld --install mysql-8.0.20
            mysqld --install mysql-5.7.25
            mysqld --install mysql-5.5.62
            mysqld -remove
        d.启动服务
            net start mysql-8.0.20
            net start mysql-5.7.25
            net start mysql-5.5.62
        e.登录MySQL
            mysql -uroot -P 3307 -p
            mysql -uroot -P 3306 -p
            mysql -uroot -P 3308 -p
        f.修改密码
            ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
            UPDATE mysql.user SET password=PASSWORD('123456') WHERE User='root';
            flush privileges;
        g.远程访问
            grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
    e.新版-开启远程访问
        a.修改root用户的密码
            ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
        b.如果需要允许远程访问,修改root用户的主机限制
            ALTER USER 'root'@'%' IDENTIFIED BY 'root';
        c.授予root用户所有权限
            GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
        d.刷新权限
            FLUSH PRIVILEGES;
        e.MySQL版本
            SELECT VERSION();

02.配置
    a.修改时区
        a.Advanced
            Advanced -> serverTimezone -> Hongkong
        b.命令行
            show variables like'%time_zone';
            set global time_zone = '+8:00';
    b.版本对应关系
        Connector/J JDBC version    MySQL Server
        8.0         4.2 1           5.6, 5.7, 8.0
        5.1         3.0, 4.0        5.6, 5.7, 8.0
    c.连接信息
        spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
        spring.datasource.username=root
        spring.datasource.password=4023666
        spring.datasource.url=jdbc:mysql://localhost:3307/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
    d.打开全部权限
        mysql> use mysql;
        mysql> update user set `Select_priv` = 'Y', `Insert_priv` = 'Y',`Update_priv` = 'Y',`Delete_priv` = 'Y', `Create_priv` = 'Y',`Drop_priv` = 'Y',`Reload_priv` = 'Y',`Shutdown_priv` = 'Y', `Process_priv` = 'Y',`File_priv` = 'Y',`Grant_priv` = 'Y',`References_priv` = 'Y', `Index_priv` = 'Y',`Alter_priv` = 'Y',`Show_db_priv` = 'Y',`Super_priv` = 'Y', `Create_tmp_table_priv` = 'Y',`Lock_tables_priv` = 'Y',`Execute_priv` = 'Y', `Repl_slave_priv` = 'Y',`Repl_client_priv` = 'Y',`Create_view_priv` = 'Y', `Show_view_priv` = 'Y',`Create_routine_priv` = 'Y',`Alter_routine_priv` = 'Y', `Create_user_priv` = 'Y',`Event_priv` = 'Y',`Trigger_priv` = 'Y',`Create_tablespace_priv` = 'Y' where user='root' ;
        mysql> flush privileges;
    e.创建数据库和分配用户权限
        docker exec -it mysql8 /bin/bash
        mysql> mysql -u root -p
        mysql> create database answer charset utf8;                         --创建answer数据库
        mysql> create database answer_test charset utf8;                    --创建answer_test数据库
        mysql> CREATE USER 'halavah'@'%' IDENTIFIED BY '123456';            --创建halavah用户
        mysql> GRANT ALL ON answer.* TO 'halavah'@'%';                      --分配answer全部权限给halavah
        mysql> GRANT ALL ON answer_test.* TO 'halavah'@'%';                 --分配answer_test全部权限给halavah
        mysql> flush privileges;
    f.解决:无法识别MySQL8默认用户认证方式,plugin需要从caching_sha2_password变为mysql_native_password
        docker exec -it mysql8 /bin/bash
        mysql> mysql -u root -p p
        mysql> use mysql;
        mysql> select host, user, plugin from user;
        mysql> ALTER USER 'halavah'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
        mysql> select host, user, plugin from user;
        mysql> exit
    g.解决:Lost connection to MySQL server during query
        https://developer.aliyun.com/article/1371311
        选中数据库 -> 右键编辑连接 ->选择高级,配置限制连接会话和保持连接间隔(秒)均为2400,建议1000。
    h.解决:Got a packet bigger than ‘max_allowed_packet‘ bytes
        https://blog.csdn.net/qq_31083947/article/details/127666353
        set global max_allowed_packet = 1048576*10;
    i.编码
        设计数据库中的库和表时选择 UTF8(更准确地说是 UTF8MB4)作为字符集,主要原因如下
        国际化支持:UTF8MB4 字符集能够支持全球大多数语言的文字,包括各种特殊字符、表情符号等,这使得应用能够无障碍地服务于多语言环境下的用户
        兼容性:UTF8MB4 是 UTF8 的超集,它向下兼容 UTF8,意味着使用 UTF8MB4 不会影响原有的 UTF8 数据,同时还能支持 4 字节的 Unicode 字符,确保了数据的完整性和广泛适用性
        未来扩展性:UTF8 是一种可扩展的字符集,它支持 Unicode 编码,并具备适应未来字符需求的能力
    j.慢查询
        myprofi:这是一个用于 MySQL 性能分析的工具,能够帮助用户监控和分析数据库的性能指标,提供可视化的报告,帮助识别性能瓶颈
        mysqlsla:这是一个用于分析 MySQL 慢查询日志的工具。它可以对慢查询日志进行解析和汇总,生成统计信息,帮助用户识别和优化慢查询
        mysqldumpslow:这是 MySQL 自带的一个工具,用于分析慢查询日志。它可以对日志中的查询进行汇总,显示最耗时的查询,帮助用户找到需要优化的 SQL 语句
        mysql-log-filter:这是一个用于过滤 MySQL 日志的工具,可以根据用户指定的条件筛选出特定的日志记录,便于分析和排查问题
        mysql-explain-slow-log:这是一个用于分析慢查询日志中 SQL 语句的工具,结合 EXPLAIN 语句的输出,帮助用户理解查询的执行计划,从而优化 SQL 语句的性能
        pt-query-digest:Percona Toolkit 中的一个工具,用于分析 MySQL 查询日志(包括慢查询日志、通用查询日志和二进制日志)
    k.快速查找
        https://github.com/readysettech/readyset:ReadySet位于您的应用程序和数据库之间,可将最复杂的SQL读取转换为闪电般的快速查找

03.Binlog恢复数据
    a.定义
        Binlog是MySQL的二进制日志,用于记录所有对数据库进行更改的SQL语句。它主要用于数据恢复和主从复制
    b.原理
        a.记录更改
            Binlog记录所有导致数据更改的SQL语句(如INSERT、UPDATE、DELETE)
        b.数据恢复
            通过重放Binlog,可以将数据库恢复到某个时间点
        c.主从复制
            从库通过读取主库的Binlog来实现数据同步
    c.常用API
        a.SHOW BINARY LOGS;
            查看所有Binlog文件
        b.SHOW BINLOG EVENTS IN 'log_name';
            查看指定Binlog文件中的事件
        c.mysqlbinlog
            用于解析和重放Binlog文件的命令行工具
    d.使用步骤
        a.启用Binlog
            在MySQL配置文件中设置log-bin参数
        b.查看Binlog
            使用SHOW BINARY LOGS;查看Binlog文件
        c.选择恢复点
            确定需要恢复的时间点或事件
        d.使用mysqlbinlog工具
            解析Binlog文件并重放SQL语句以恢复数据
    e.场景及代码示例
        a.场景1:查看Binlog文件
            -- 查看所有Binlog文件
            SHOW BINARY LOGS;
            -- 查看指定Binlog文件中的事件
            SHOW BINLOG EVENTS IN 'mysql-bin.000001';
        b.场景2:使用mysqlbinlog工具恢复数据
            假设需要恢复到某个时间点,可以使用mysqlbinlog工具解析Binlog文件并重放SQL语句
            -------------------------------------------------------------------------------------------------
            # 使用mysqlbinlog工具解析Binlog文件
            mysqlbinlog --start-datetime="2023-01-01 00:00:00" --stop-datetime="2023-01-01 12:00:00" mysql-bin.000001 > restore.sql
            # 将解析出的SQL语句导入数据库
            mysql -u username -p database_name < restore.sql
            -------------------------------------------------------------------------------------------------
            说明:--start-datetime和--stop-datetime用于指定恢复的时间范围。解析出的SQL语句可以导入数据库以恢复数据

04.查询日志:每条语句执行时间
    a.配置通用日志
        -- 查看当前日志状态
        SHOW VARIABLES LIKE 'general_log%';
        -- 开启日志记录(临时生效)
        SET GLOBAL general_log = 'ON';
        -- 设置日志存储方式(FILE/TABLE)
        SET GLOBAL log_output = 'FILE';
    b.永久生效配置
        [mysqld]
        general_log = 1
        general_log_file = /var/log/mysql/mysql.log
        log_output = FILE
    c.日志格式解析
        2024-03-20T14:35:22.123456Z    10 Connect   user@localhost on db
        2024-03-20T14:35:24.567890Z    10 Query SELECT * FROM orders WHERE id=100
        2024-03-20T14:35:25.001234Z    10 Quit
    d.日志管理策略
        -- 日志文件轮转
        FLUSH LOGS;
        -- 清理历史日志
        PURGE BINARY LOGS BEFORE '2024-03-01 00:00:00';

05.重置密码
    a.停止MySQL服务
        a.命令行执行
            sudo systemctl stop mysql
        b.其他命令
            sudo service mysql stop
    b.修改MySQL配置文件
        a.打开配置文件
            打开MySQL的配置文件`my.cnf`或`my.ini`(通常位于`/etc/mysql/`或`/etc/`目录下)
        b.在`[mysqld]`部分添加`skip-grant-tables`选项
            [mysqld]
            skip-grant-tables
    c.重启MySQL服务
        a.启动服务
            sudo systemctl start mysql
        b.其他命令
            sudo service mysql start
    d.重置密码
        a.连接MySQL
            mysql -u root
        b.执行SQL语句
            FLUSH PRIVILEGES;
            ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
        c.旧版本MySQL:MySQL 5.7或更早版本
            SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');
    e.恢复MySQL配置文件
        a.退出MySQL客户端
            EXIT;
        b.停止服务
            sudo systemctl stop mysql
        c.其他命令
            sudo service mysql stop
        d.编辑配置文件
            编辑MySQL配置文件,删除或注释掉`skip-grant-tables`选项
    f.重启MySQL服务
        a.启动服务
            sudo systemctl start mysql
        b.其他命令
            sudo service mysql start

8.3 mysql2

00.支持性
    苹果的 M1 芯片(以及后续的 M2、M3 等芯片)是基于 ARM 架构的,因此在选择 MySQL 版本时需要确保其支持 ARM 架构
    MySQL 从 8.0.26 版本开始正式支持 ARM 架构,包括苹果的 M1 芯片
    因此,如果你使用的是苹果 M1 或更高版本的芯片,建议使用 MySQL 8.0.26 或更高版本

01.homebrew安装mysql5
    a.说明
        MySQL5已经不支持brew下载
        在 MySQL 官方 Archive 中,可以发现 MySQL 5.7(5.7.32~5.7.36)都没提供macOS的安装
        而 MySQL 5.7.31提供了安装 但是没有支持ARM的,Apple Silicon采用ARM架构 虽然可以通过Rosetta运行x86架构Application
        MySQL8提供x86架构与ARM架构的macOS安装,如果需要安装MySQL8点击前往下载
    b.命令
        brew install [email protected]                                                  --默认无root密码
        brew services list                                                      --列出当前可用服务
        brew services start [email protected]                                           --开启服务
        brew services stop [email protected]                                            --终止服务
        brew services stop --all                                                --终止所有服务
    c.强制安装
        brew edit [formula] 删除 disable 哪一行,如 brew edit [email protected]
        -----------------------------------------------------------------------------------------------------
        brew edit xxx 命令实际上就是帮我们直接打开对应的 xxx.rb文件
        #deprecate! date: "2023-05-25", because: unsupported
        depends_on "bison"=>:build
        depends_on "cmake"=>:build
        depends on "pkq-config"=> :build
        -----------------------------------------------------------------------------------------------------
        HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]                   --安装旧版,报错不再维护
        告诉brew 不使用api中的formula而是使用你自己编辑后的, 这样就可以正常安装被brew禁止disable的软件包了
    d.方式1:使用root
        brew link --force [email protected]                                             --连接MySQL
        echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc     --配置PATH
        mysql.server start                                                      --开启MySQL
        mysql.server stop                                                       --关闭MySQL
        mysql -uroot                                                            --连接
        set password for 'root'@'localhost' = password('123456');               --修改密码
    e.方式2:使用mysql_secure_installation
        $ brew link --force [email protected]
        # mysql_secure_installation
        -----------------------------------------------------------------------------------------------------
        ➜  ~ mysql_secure_installation
        Securing the MySQL server deployment.
        Connecting to MySQL using a blank password.
        VALIDATE PASSWORD PLUGIN can be used to test passwords
        and improve security. It checks the strength of password
        and allows the users to set only those passwords which are
        secure enough. Would you like to setup VALIDATE PASSWORD plugin?
        -----------------------------------------------------------------------------------------------------
        Press y|Y for Yes, any other key for No: y
        如果是个人使用,这里可以不开启密码校验插件,这样我们可以使用较为简单的密码组合,方便记忆,因此输入n。
        -----------------------------------------------------------------------------------------------------
        Please set the password for root here.
        [New password:
        设置密码
        -----------------------------------------------------------------------------------------------------
        There are three levels of password validation policy:
        LOW    Length >= 8
        MEDIUM Length >= 8, numeric, mixed case, and special characters
        STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
        Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:
        -----------------------------------------------------------------------------------------------------
        此方式会开启MySQL密码验证插件
        由上述提示可知最低密码策略的密码长度也需要8位
        不建议通过SET GLOBAL validate_password_length=4;修改密码验证插件相关参数
        -----------------------------------------------------------------------------------------------------
        Remove anonymous users?(PressyYforYes,any other key for No):y
        Success.
        选择是否移除用户,这一步可以将不需要的匿名用户移除,输入y回车即可。
        -----------------------------------------------------------------------------------------------------
        Normally,root should only be allowed to connect from
        'localhost'.This ensures that someone cannot guess at
        the root password from the network.
        Disallow root login remotely?(Press ylY for Yes,any other key for No):n
        开启root用户远程连接
        默认给出的选项是不允许通过root用户远程连接,因为root用户拥有最高权限,学习阶段可以开启方便虚拟机或局域网调试(如果开启需要输入n)
        -----------------------------------------------------------------------------------------------------
        Bydefault,MySQLcomes witha database named'test'that
        anyone can access.This is also intended only for testing,
        andshouldbe removedbeforemovingintoaproduction
        environment.
        Remove test database andaccess to it?(Press ylY for Yes,any other key for No)
        : n
        选择是否保留测试数据集
        安装是默认附带一个test数据集,这里可以根据需要选择是否保留(如果需要移除则输入y)。
        -----------------------------------------------------------------------------------------------------
        Reloading the privilege tables will ensure that all changes
        made so far willtakeeffectimmediately.
        Reload privilege tables now?(Press ylY for Yes,any other key for No):y
        Success.
        All done!
        立即刷新权限
        输入y使得密码和权限设置立即生效,否则需要重新启动数据库服务。

02.homebrew安装mysql8
    a.开始
        a.安装
            brew install [email protected]
        b.brew启动
            brew services list
            brew services start [email protected]
        c.官方启动
            mysql.server start
            mysql.server stop
            mysql.server restart
        d.检查
            brew services list
        e.登录
            mysql -u root -p
            mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
    b.全部路径
        a.配置文件
            /opt/homebrew/etc/my.cnf
        b.软连接路径
            /opt/homebrew/opt/[email protected]
        c.源文件路径
            /opt/homebrew/Cellar/[email protected]
        d.数据路径
            /opt/homebrew/var/mysql
    c.环境变量
        a.默认Homebrew时自动生成的.zprofile
            echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >>  ~/.zprofile
            echo 'export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"' >> ~/.zprofile
            echo 'export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"' >> ~/.zprofile
        b.自定义
            .zshrc
    d.方式1:使用root
        a.进入
            mysql -uroot
        b.修改
            # 设置密码
            ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
            # 远程访问
            grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
            # 新权限
            flush privileges;
    e.方式2:使用mysql_secure_installation
        a.mysql_secure_installation
            xxx ~ % mysql_secure_installation

            Securing the MySQL server deployment.

            Enter password for user root:
            Error: Access denied for user 'root'@'localhost' (using password: YES)
            xxx ~ % mysql_secure_installation

            Securing the MySQL server deployment.

            Enter password for user root:

            VALIDATE PASSWORD PLUGIN can be used to test passwords
            and improve security. It checks the strength of password
            and allows the users to set only those passwords which are
            secure enough. Would you like to setup VALIDATE PASSWORD plugin?

            Press y|Y for Yes, any other key for No: y

            There are three levels of password validation policy:

            LOW    Length >= 8
            MEDIUM Length >= 8, numeric, mixed case, and special characters
            STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

            Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
            Using existing password for root.

            Estimated strength of the password: 100
            Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

            New password:

            Re-enter new password:

            Estimated strength of the password: 100
            Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
             ... Failed! Error: Your password does not satisfy the current policy requirements

            New password:

            Re-enter new password:

            Estimated strength of the password: 100
            Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
            By default, a MySQL installation has an anonymous user,
            allowing anyone to log into MySQL without having to have
            a user account created for them. This is intended only for
            testing, and to make the installation go a bit smoother.
            You should remove them before moving into a production
            environment.

            Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
            Success.


            Normally, root should only be allowed to connect from
            'localhost'. This ensures that someone cannot guess at
            the root password from the network.

            Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

             ... skipping.
            By default, MySQL comes with a database named 'test' that
            anyone can access. This is also intended only for testing,
            and should be removed before moving into a production
            environment.


            Remove test database and access to it? (Press y|Y for Yes, any other key for No) :

             ... skipping.
            Reloading the privilege tables will ensure that all changes
            made so far will take effect immediately.

            Reload privilege tables now? (Press y|Y for Yes, any other key for No) :

             ... skipping.
            All done!
        b.查看进程
            ps aux|grep mysqld
            lsof -i :3306
        c.文件权限
            sudo chown -R $(whoami):admin /opt/homebrew/var/mysql
            sudo chown -R $(whoami):admin /opt/homebrew/opt/mysql
            sudo chown -R $(whoami):admin ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

03.mysql社区版
    a.安装
        https://dev.mysql.com/downloads/mysql/
    b.配置
        a.说明
            官网说明中:从5.7.18开始不在二进制包中提供my-default.cnf文件
            【5.7.18前的版本可以检查一下 etc 目录下是否存在,如果 etc 目录下没有 my.cnf,
            可以找找安装包中有没有提供 my-default.cnf,有的话拷贝到 etc 目录下,并且修改文件名为 my.cnf】
        b.创建文件
            # 既然官网不再提供,则自己创建,在 /etc 新建 my.cnf 文件
            sudo vim /etc/my.cnf
        c.配置内容
            [client]
            default-character-set=utf8
            port=3306
            socket=/tmp/mysql.sock

            [mysqld]
            character-set-server=utf8
            init_connect='SET NAMES utf8'
            port=3306
            socket=/tmp/mysql.sock
            skip-external-locking
            key_buffer_size = 16M
            max_allowed_packet = 1M
            table_open_cache = 64
            sort_buffer_size = 512K
            net_buffer_length = 8K
            read_buffer_size = 256K
            read_rnd_buffer_size = 512K
            myisam_sort_buffer_size = 8M
            log-bin=mysql-bin
            binlog_format=mixed
            server-id = 1

            [mysqldump]
            quick
            max_allowed_packet = 16M

            [mysql]
            no-auto-rehash
            default-character-set=utf8

            [myisamchk]
            key_buffer_size = 20M
            sort_buffer_size = 20M
            read_buffer = 2M
            write_buffer = 2M

            [mysqlhotcopy]
            interactive-timeout
        d.文件权限
            sudo chmod 664 /etc/my.cnf
        e.重启服务
            重启MySQL服务,在【系统偏好设置】-【MySQL】关闭服务,在打开即可
    c.环境变量
        a.zshrc
            sudo echo 'PATH=$PATH:/usr/local/mysql-5.7.31-macos10.14-x86_64/bin'>> ~/.zshrc
            source ~/.zshrc
        b.bash_profile
            sudo echo 'PATH=$PATH:/usr/local/mysql-5.7.31-macos10.14-x86_64/bin'>> ~/.bash_profile
            source ~/.bash_profile
    d.修改密码
        a.认证密码
            # 输入初始密码【输入时,密码不可见,拷贝初始密码后粘贴后直接 enter 即可】
            mysql -uroot -p
            SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
            FLUSH PRIVILEGES;
        b.跳过密码
            #打开终端,找到mysql所在位置
            cd /usr/local/mysql/bin
            #执行命令,如果提示password输入开机密码
            sudo mysqld_safe --skip-grant-tables
            #打开一个新终端 command+N,执行命令
            mysql -u root
            #修改密码
            UPDATE mysql.user SET authentication_string=PASSWORD('你想要的密码') WHERE User='root';
            FLUSH PRIVILEGES;
    e.修改cnf配置/身份验证方式
        a.报错
            起因:修改密码验证方式为mysql_native_password
            起因是:新版 mysql 使用 mysqldump 旧版本的数据库会报错
            具体原因是 MySQL 8.0 及更高版本中默认的身份验证插件从 mysql_native_password 变更为 caching_sha2_password ,而客户端可能不支持新的身份验证插件。
            mysqldump: Got error: 2059: Authentication plugin 'mysql_native_password' cannot be loaded: dlopen(/opt/homebrew/Cellar/mysql/9.0.1_6/lib/plugin/mysql_native_password.so, 0x0002)
        b.查看当前用户的身份验证方式
            1.登录到 MySQL 数据库,查看plugin列的数据
            mysql -u root -p
            SELECT * FROM mysql.user;
            2.将用户的身份验证方式更改为 mysql_native_password(如果插件已安装的话)
            ALTER USER '<USERNAME>'@'<HOST>' IDENTIFIED WITH mysql_native_password BY '<PASSWORD>';
            3.如果插件未安装
            SHOW PLUGINS;  # 查看插件
            INSTALL PLUGIN mysql_native_password SONAME 'mysql_native_password';  # 尝试手动安装
        c.尝试在 MySQL 配置文件中添加
            [mysqld]
            mysql_native_password=ON
            -------------------------------------------------------------------------------------------------
            加了mysql_native_password=ON 配置导致mysql启动不了
    f.如何查找mysql配置文件位置
        a.Debian/Ubuntu系统
            该文件位于 /etc/mysql/ 目录
            推荐为此创建新文件,比如 /etc/mysql/conf.d/enable-mysql-native-password.cnf
        b.mac系统
            配置文件:/usr/local/etc/my.cnf
            数据库文件:/usr/local/mysql/data
            本地IP地址和端口:127.0.0.1:3306
            Socket文件路径:/tmp/mysql.sock
        c.Homebrew安装的MySQL
            配置文件可能位于/usr/local/etc/my.cnf,或者在 ~/.my.cnf(当前用户的主目录下)
            如果这些位置都没有找到,你可能需要检查 Homebrew 的安装日志或者使用 Homebrew 的命令来查找配置文件的位置
        d.一些可能的查找配置文件路径的方法
            brew info mysql
            -------------------------------------------------------------------------------------------------
            SHOW VARIABLES LIKE 'datadir'; # 数据目录的路径,但不会直接显示配置文件的路径。MySQL 的配置文件路径通常在数据目录的父目录中。
            SHOW VARIABLES LIKE 'myisam_base_dir'; # MyISAM 表的基目录,这通常是配置文件所在的目录
            -------------------------------------------------------------------------------------------------
            mysql --help|grep 'my.cnf'
            order of preference, my.cnf, $MYSQL_TCP_PORT,
            /etc/my.cnf /etc/mysql/my.cnf /opt/homebrew/etc/my.cnf ~/.my.cnf
            -------------------------------------------------------------------------------------------------
            ps aux | grep mysql
            # -a 显示所有用户正在运行的进程,但会忽略没有命令行终端控制的进程,除非指定 -x 选项
            # -u 显示特定用户用户的进程
    g.导入与导出
        a.sqldump备份工具
            a.说明
                mysqldump命令执行时,可以将数据库备份成一个文本文件,该文件中实际上包含多个create和insert语句,使用这些语句可以重新创建表和插入数据
                查出需要备份的标的结构,在文本文件中生成一个create语句
                将表中的所有记录转换成一条insert语句
            b.操作
                # 完整命令
                mysqldump -u 用户名称 -h 主机名称 -p密码 待备份的数据库名称[tbname,[tbname...]] > 备份文件名称.sql
                # 备份整个数据库
                mysqldump -u root -h host -p dbname > backdb.sql
                # 备份数据库中的某个表
                mysqldump -u root -h host -p dbname tbname1, tbname2 > backdb.sql
                # 备份多个数据库
                mysqldump -u root -h host -p --databases dbname1, dbname2 > backdb.sql
                # 备份系统中所有数据库
                mysqldump -u root -h host -p --all-databases > backdb.sql
        b.sqldump数据恢复
            a.说明
                使用mysqldump命令将数据库中的数据备份成一个文本文件,需要恢复时,可以使用mysql命令来恢复备份的数据。
                mysql命令可以执行备份文件中的create语句和insert语句,通过create语句来创建数据库和表,通过insert语句来插入备份的数据。
            b.注意
                因为有DROP TABLE IF EXISTS xxx;
                所以备份期间的数据都会成功删掉
                建议执行数据恢复前,可以先rename一下原先的数据表
                RENAME TABLE old_table_name TO new_table_name;
            c.操作
                # dbname参数表示数据库名称,该参数是可选参数。指定数据库名称时,表示还原该数据库下的表。此时需要确保MySQL服务器中已经创建了该名的数据库。不指定数据库名时,表示还原文件中所有的数据库。此时SQL文件中包含有create database语句,不需要MySQL服务器中已存在这些数据库。
                mysql -u 用户名 -p [dbname] < 备份文件.sql
    h.完美卸载
        a.命令
            su
            sudo rm /usr/local/mysql
            sudo rm -rf /usr/local/var/mysql
            sudo rm -rf /usr/local/mysql*
            sudo rm -rf /Library/StartupItems/MySQLCOM
            sudo rm -rf /Library/PreferencePanes/My*
            -------------------------------------------------------------------------------------------------
            # 有就删除,没有就算
            sudo vim /etc/hostconfig  (removed the line MYSQLCOM=-YES-)
            -------------------------------------------------------------------------------------------------
            sudo rm -rf ~/Library/PreferencePanes/My*
            sudo rm -rf /Library/Receipts/mysql*
            sudo rm -rf /Library/Receipts/MySQL*
            sudo rm -rf /var/db/receipts/com.mysql.*
        b.检查
            /usr/local/Cellar 里的mysql文件
            /usr/local/var 里的mysql文件
            /tmp 里的mysql.sock, mysql.sock.lock, my.cnf文件
            pid文件和err文件都在/usr/local/var/mysql里确保删除了
        c.brew
            brew安装的安装包存储在/usr/local/Library/Cache/Homebrew也可以一并删除

8.4 oracle

01.下载
    https://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html
    instantclient-basic-win32-11.2.0.1.0.zip
    instantclient-sqlplus-win32-11.2.0.1.0.zip

02.instantclient-basic和instantclient-sqlplus两个安装包放在同一个目录下,解压。
    在这里,我们放在C:\software下,解压到当前文件夹,最后会自动生成一个新的文件夹instantclient_11_2,
    两个安装包的文件都会放到该文件夹下,即C:\software\instantclient_11_2,重命名为C:\software\Oracle11g_client

03.修改系统变量(不要添加)
    +代表添加,*代表追加
    [+] NLS_LANG => SIMPLIFIED CHINESE_CHINA.ZHS16GBK
    [+] TNS_ADMIN => C:\software\Oracle11g_client\network\admin
    [*] Path => C:\software\Oracle11g_client
    ---------------------------------------------------------------------------------------------------------
    echo %path%                                                                        --刷新环境变量

04.在C:\software\Oracle11g_client\network\admin下新建tnsnames.ora配置文件,内容如下:
    ORCL =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = orcl)
        )
      )

05.用SQL*Plus登陆测试
    C:\Users\mysla> sqlplus scott/tiger@orcl
    SQL>

06.解决cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found"
    将C:\software\Oracle11g_client下的全部*.dll,复制到C:\software\pyenv\versions\3.9.6\Lib\site-packages根目录下
    oci.dll
    ocijdbc11.dll
    ociw32.dll
    orannzsbb11.dll
    oraocci11.dll
    oraociei11.dll
    orasql11.dll
    Orasqlplusic11.dll
    ---------------------------------------------------------------------------------------------------------
    +代表添加,*代表追加
    [+] NLS_LANG => SIMPLIFIED CHINESE_CHINA.ZHS16GBK
    [+] TNS_ADMIN => C:\software\Oracle11g_client\network\admin
    [*] Path => C:\software\Oracle11g_client
    经测试,修改系统变量后,会造成服务(OracleServiceORCL)报错,故不添加。
    如果报错,重启服务(OracleServiceORCL),使用navicat尝试连接

07.解决navicat报错 ORA-28040:没有匹配的验证协议
    navicat -> 工具 -> 选项
    C:\software\Oracle11g\product\11.2.0\dbhome_1\bin\oci.dll
    C:\software\Oracle11g_client\oci.dll

08.附:oracle表
    ANONYMOUS
    APEX_030200
    APEX_PUBLIC_USER
    APPQOSSYS
    BI
    CTXSYS
    DBSNMP
    DIP
    EXFSYS
    FLOWS FILES
    HR
    Ix
    MDDATA
    MDSYS
    MGMT_VIEW
    OE
    OLAPSYS
    ORACLE_OCM
    ORDDATA
    ORDPLUGINS
    ORDSYS
    OUTLN
    OWBSYS
    OWBSYS_AUDIT
    PM
    SCOTT
    SH
    SI INFORMTN_SCHEMA
    SPATIAL_CSW_ADMIN_USR
    SPATIAL_WFS_ADMIN_USR
    SYS
    SYSMAN
    SYSTEM
    WMSYS
    XDB
    XS$NULL

8.5 redis

01.环境变量
    path:C:\software\Redis-3.2.1
    path:C:\software\Redis-5.0.14

02.配置(redis.windows.conf)
    port 6389
    requirepass myslayers

03.服务
    redis-server --service-install "C:\software\Redis-3.2.1\redis.windows.conf" --service-name redis6379
    net start redis6379
    redis-server --service-install "C:\software\Redis-5.0.14\redis.windows.conf" --service-name redis6389
    net start redis6389

04.测试
    redis-cli.exe -h 127.0.0.1 -p 6379 -a myslayers                     --登录
    127.0.0.1:6379> info                                                --版本

05.脚本
    redis-server.exe redis.windows.conf                                 --redis-server.bat
    redis-cli.exe -h 127.0.0.1 -p 6379 -a myslayers                     --redis-cli.bat

8.6 mongodb

01.MongoDB-3.4.24
    a.环境变量
        C:\software\SQL\MongoDB-3.4.24\bin
    b.配置(mongodb.conf)
        dbpath=C:\software\MongoDB-3.4.24\data
        logpath=C:\software\MongoDB-3.4.24\logs\mongo.log
        port=27017
        logappend=true
    c.服务
        mongod --config "C:\software\MongoDB-3.4.24\mongodb.conf" --install --serviceName "MongoDB"
        net start MongoDB2
        db.version();
    d.配置用户
        mongo
        db.createUser({ user:'root',pwd:'123456',roles:[ { role:'userAdminAnyDatabase', db: 'admin'}]});
        db.auth('root', '123456')
    e.Navicat连接
        连接名:MongoDB
        连接:Standalone
        主机:localhost
        端口:27017
        验证数据库:test
        用户名:root
        密码:123456

02.MongoDB-8.0.3
    a.位置
        C:\Program Files\MongoDB\Server\8.0
    b.端口说明
        27017   mongod 和 mongos 实例的默认端口。您可以使用 port 或 --port 更改此端口。
        27018   使用 --shardsvr 命令行选项运行时 mongod 的默认端口,或配置文件中 clusterRole 设置的 shardsvr 值。
        27019   使用 --configsvr 命令行选项运行时 mongod 的默认端口,或配置文件中 clusterRole 设置的 configsvr 值。
        27020   mongocryptd 从中侦听消息的默认端口。mongocryptd 与 MongoDB Enterprise Server 一起安装,并支持自动加密操作。
    c.查看版本
        db.version();
    d.配置用户
        打开MongoDB Compass
        db.createUser({ user:'root',pwd:'123456',roles:[ { role:'userAdminAnyDatabase', db: 'admin'}]});
        db.auth('root', '123456')
    e.配置用户结束,才可以Navicat连接
        连接名:MongoDB
        连接:Standalone
        主机:localhost
        端口:27017
        验证数据库:test
        用户名:root
        密码:123456
    f.配置用户结束,才可以mongosh连接
        d:
        cd C:\software\mongosh-2.3.2\bin
        mongosh mongodb://localhost:27017

03.MongoDB连接
    a.连接
        mongo ip:port/数据库名 -u user -p password
        mongo -u root -p 123456
        mongo 127.0.0.1:27017/test -u root -p 123456
    b.命令
        show dbs                                                            --显示数据库列表
        show collections                                                    --显示当前数据库中的集合
        show users                                                          --显示用户
        use <db name>                                                       --切换当前数据库
        db.help()                                                           --显示数据库操作命令
        db.foo.help()                                                       --显示集合操作命令,foo代指当前数据库
        db.foo.find()                                                       --当前集合数据查找
        db.foo.find({a:1})                                                  --当前集合数据查找,条件查询
        db.foo.find({a:1},{column:0})                                       --当前集合数据查找,条件查询
    c.增删改查
        db.foo.insert({ "userId" : "testcustomer"})                         --增
        -----------------------------------------------------------------------------------------------------
        db.foo.remove({"userId" : "testcustomer"})                          --删除指定条件的数据
        db.foo.remove({})                                                   --清空表
        db.foo.drop()                                                       --删除表
        db.dropDatabase()                                                   --删除数据库
        -----------------------------------------------------------------------------------------------------
        db.foo.update({"userId" : "1"},{'$set':{"mail" : "[email protected]"}})    --改
        -----------------------------------------------------------------------------------------------------
        $gt                                                                 --查:>
        $lt                                                                 --查:<
        $gte                                                                --查:>=
        $lte                                                                --查:<=
        db.collection.find({age:{$gt:18}});                                 --示例
        SELECT * FROM Collection WHERE age>18                               --示例
        -----------------------------------------------------------------------------------------------------
        $ne                                                                 --查:no eequals
        db.collection.find({age:{$ne:18}});                                 --示例
        -----------------------------------------------------------------------------------------------------
        $in                                                                 --查:in
        $nin                                                                --查:not in
        db.collection.find({field:{$in:array}});                            --示例
        db.collection.find({field:{$nin:array}});                           --示例
        -----------------------------------------------------------------------------------------------------
        $exists                                                             --查:is exist
        db.collection.find({title:{$exists:true}});                         --示例
        -----------------------------------------------------------------------------------------------------
        *corp/i                                                             --查:reg
        db.collection.find( { name : /acme.*corp/i } );                     --示例
        -----------------------------------------------------------------------------------------------------
        $not                                                                --查:not
        db.collection.find( { name : { $not : /acme.*corp/i } } );          --示例

04.MongoDB在线版
    a.网址
        https://cloud.mongodb.com/
        US East(N.Virginia)   us-east-1
        US East(Ohio)         us-east-2
        US West(N.California) us-west-1
        US West(Oregon)       us-west-2
    b.说明
        MongoDB 500MB共享
        区域一定要选择 AWS / N. Virginia (us-east-1) 在 Clusters 页面点击 CONNECT,
        按步骤设置允许所有 IP 地址的连接),创建数据库用户,并记录数据库连接信息,密码即为你所设置的值
    c.Java连接
        mongodb+srv://troyesivens:<db_password>@halavah.sbfgy.mongodb.net/?retryWrites=true&w=majority&appName=halavah
    d.Node连接
        mongodb+srv://troyesivens:<db_password>@halavah.sbfgy.mongodb.net/?retryWrites=true&w=majority&appName=halavah
    e.设置用户、网络权限
        左下角 -> SECURITY -> Database Access -> troyesivens、xxxxxxxxxx
        左下角 -> SECURITY -> Network Access -> 0.0.0.0

8.7 sqlite3

01.安装
    http://www.sqlite.org/download.html

02.服务
    无

03.路径
    C:\software\sqlite3

04.环境变量
    C:\software\sqlite3

05.命令行连接
    C:\software\sqlite3> sqlite3
    SQLite version 3.39.2 2022-07-21 15:24:47
    Enter ".help" for usage hints.
    Connected to a transient in-memory database.
    Use ".open FILENAME" to reopen on a persistent database.
    sqlite>

06.Navicat连接
    连接名:SQLite3
    类型:新建SQLite3
    数据库文件:C:\software\sqlite3\demo01.db

8.8 mariadb

01.安装
    https://mariadb.org/download

02.服务
    MariaDB

03.路径
    C:\Program Files\MariaDB 10.8\
    C:\Program Files\MariaDB 10.8\data\

04.环境变量
    C:\Program Files\MariaDB 10.8\bin

05.命令行连接
    C:\Program Files\MariaDB 10.8\bin> mysql -uroot -p
    Enter password: ******
    Welcome to the MariaDB monitor.  Commands end with ; or \g.

06.Navicat连接
    连接名:MariaDB
    主机:localhost
    端口:3309
    用户名:root
    密码:123456

8.9 postgre

01.安装
    https://www.postgresql.org/download/

02.服务
    postgresql-x64-14

03.路径
    C:\Program Files\PostgreSQL\14
    C:\Program Files\PostgreSQL\14\data

04.环境变量
    C:\Program Files\PostgreSQL\14\bin
    C:\Program Files\PostgreSQL\14\scripts
    C:\Program Files\PostgreSQL\14\pgAdmin 4\bin

05.命令行连接
    a.连接1
        psql postgres://username:password@host:port/dbname
            username:连接数据的用户名,默认值是postgres
            password:密码,默认值是postgres
            host:主机名,默认值是localhost
            port:端口,默认值是5432
            dbname:要连接的数据库名,默认值是postgres
    b.连接2
        psql -U username -h hostname -p port -d dbname
        psql  -U postgres -h localhost -p 5432 -d postgres
            -U username 用户名,默认值postgres
            -h hostname 主机名,默认值localhost
            -p port 端口号,默认值5432
            -d dbname 要连接的数据库名,默认值postgres

06.Navicat连接
    连接名:PostgreSQL
    主机:localhost
    端口:5432
    初始数据库:postgres
    用户名:postgres
    密码:123456

8.10 sql server

01.安装
    https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads

02.服务
    SQL Server (MSSQLSERVER)                                                 --必须启动(数据库引擎服务)
    SQL Server 代理 (MSSQLSERVER)                                            --必须启动(代理服务)
    SQL Server CEIP 服务 (MSSQLSERVER)                                       --必须启动
    SQL Server VSS Writer                                                    --必须启动(SQL编写器服务)
    -----------------------------------------------------------------------------------------------------
    SQL Server Browser                                                       --非必须启动

03.路径
    实例名称:MSSQLSERVER
    连接字符串:Server=localhost;Database=master;Trusted_Connection=True;
    -----------------------------------------------------------------------------------------------------
    SQL管理员:DESKTOP-NTRUK8V\TroyeKK
    SQL SERVER安装日志文件夹:C:\Program Files\Microsoft SQL Server\150\Setup Bootstrap\Log\20220817_003145
    -----------------------------------------------------------------------------------------------------
    已安装的功能:SQLENGINE
    安装媒体文件夹:C:\SQL2019\Developer_CHS
    -----------------------------------------------------------------------------------------------------
    版本:15.0.2000.5,RTM
    安装资源文件夹:C:\Program Files\Microsoft SQL Server\150\SSEI\Resources

04.环境变量
    C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
    C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\
    C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
    C:\Program Files\Microsoft SQL Server\150\DTS\Binn\

05.命令行连接
    C:\Users\mysla> sqlcmd -U sa -P 123456                                     --本地数据库:sqlcmd
    1> use testdb;
    2> go
    -----------------------------------------------------------------------------------------------------
    C:\Users\mysla> osql -S localhost -U sa                                    --远程数据库:osql
    密码: 123456
    1> quit

06.配置sa用户对应的密码
    SQL Server 2019 配置管理器 -> 【SQL Server服务】 -> 【SQL Server (MSSQLSERVER)】   -> 【启动:自动】
    SQL Server 2019 配置管理器 -> 【SQL Server服务】 -> 【SQL Server Browser】         -> 【启动:自动】
    SQL Server 2019 配置管理器 -> 【SQL Server服务】 -> 【SQL Server代理(MSSQLSERVER)】-> 【启动:自动】
    SQL Server 2019 配置管理器 -> 【SQL Server网络配置(32位)】        -> 【默认】
    SQL Server 2019 配置管理器 -> 【SQL Native Client11.0配置(32位)】 -> 【客户端协议】 -> 【全部开启】
    SQL Server 2019 配置管理器 -> 【SQL Native Client11.0配置(32位)】 -> 【别名】       -> 【全部开启】
    SQL Server 2019 配置管理器 -> 【SQL Server网络配置】 -> 【MSSQLSERVER的协议】       -> 【全部开启】
    SQL Server 2019 配置管理器 -> 【SQL Native Client11.0配置      】 -> 【客户端协议】 -> 【全部开启】
    SQL Server 2019 配置管理器 -> 【SQL Native Client11.0配置      】 -> 【别名】       -> 【全部开启】
    -----------------------------------------------------------------------------------------------------
    第1步:DESKTOP-NTRUK8V -> 属性 -> 【安全性:SQL Server 和 Windows身份验证模式】 -> 勾选
    第2步:DESKTOP-NTRUK8V -> 属性 -> 【重新启动】
    第3步:DESKTOP-NTRUK8V -> 属性 -> 【新建查询:alter login sa with password='123456';】
    第4步:DESKTOP-NTRUK8V -> 安全性 -> 登录名 -> sa -> 属性 -> 【常规:123456,强制实施密码策略(不勾选)】
    第5步:DESKTOP-NTRUK8V -> 安全性 -> 登录名 -> sa -> 属性 -> 【服务器角色:public、sysadmin】
    第6步:DESKTOP-NTRUK8V -> 安全性 -> 登录名 -> sa -> 属性 -> 【状态:登录(启动)】
    第7步:DESKTOP-NTRUK8V -> 属性 -> 【重新启动】
    -----------------------------------------------------------------------------------------------------
    测试:文件 -> 连接对象资源管理器 -> 【SQL Server身份验证、root、123456】

07.Navicat连接
    C:\software\Navicat Premium 15\sqlncli_x64.msi -> 默认Navicat没有安装SQL Server驱动,需要手动安装
    -----------------------------------------------------------------------------------------------------
    连接名:SQL Server
    主机:127.0.0.1,1433
    初始数据库:master
    验证:SQL Server验证
    用户名:sa
    密码:123456

8.11 memcached

01.下载
    https://www.runoob.com/memcached/window-install-memcached.html

02.安装
    c:\memcached\memcached.exe -d install                                       --安装
    c:\memcached\memcached.exe -d start                                         --开始
    c:\memcached\memcached.exe -d stop                                          --停止
    c:\memcached\memcached.exe -d runservice -m 512                             --配置缓存大小为512M
    c:\memcached\memcached.exe -d uninstall                                     --卸载

8.12 dameng

01.下载
    https://eco.dameng.com/download/
    数据库名  DAMENG
    实例名    DMSERVER
    端口号    5236
    ---------------------------------------------------------------------------------------------------------
    服务名    DmServiceDMSERVER
    key文件   跳过,直接下一步

02.登录
    DM服务查看器
    DM管理工具
    ---------------------------------------------------------------------------------------------------------
    jdbc:dm://127.0.0.1:5236/DAMENG
    ---------------------------------------------------------------------------------------------------------
    SYSDBA
    SYSDBA(默认)、123456789(更新)
    ---------------------------------------------------------------------------------------------------------
    SYSAUDITOR
    SYSAUDITOR(默认)、123456789(更新)

8.13 kingbase

01.下载
    https://www.kingbase.com.cn/rjcxxz/index.htm

02.登录
    jdbc:kingbase://127.0.0.1:54321/TEST
    ---------------------------------------------------------------------------------------------------------
    54321
    system
    123456

8.14 pt-query-digest

01.介绍
    pt-query-digest 是 Percona Toolkit 中的一个工具,用于分析 MySQL 查询日志(包括慢查询日志、通用查询日志和二进制日志)。
    它可以帮助用户识别性能瓶颈、优化查询和生成报告,提供详细的查询统计信息。

02.Windows安装
    a.安装Perl
        pt-query-digest 是用 Perl 编写的,因此需要先安装 Perl。
        可以从 Strawberry Perl 或 ActivePerl 下载并安装 Perl。
    b.下载 Percona Toolkit:
        访问 Percona Toolkit 的 GitHub 页面。
        下载最新版本的 Percona Toolkit 压缩包(通常是 .zip 文件)。
    c.解压缩
        将下载的压缩包解压到你希望安装的目录,例如 C:\percona-toolkit。
    d.配置环境变量(可选):
        为了方便在命令行中使用 pt-query-digest,可以将 Perl 和 Percona Toolkit 的路径添加到系统的环境变量中。
        右键点击“此电脑”或“计算机”,选择“属性” -> “高级系统设置” -> “环境变量”。
        在“系统变量”中找到 Path,点击“编辑”,然后添加 Perl 的安装路径(例如 C:\Strawberry\perl\bin)和 Percona Toolkit 的路径(例如 C:\percona-toolkit)。
    e.测试安装:
        perl -v
        pt-query-digest --version

03.使用
    a.第一步
        首先需要安装Perl,在windows下安装Perl,安装过程很简单,
        从官网http://strawberryperl.com/下载windows安装包,
        安装好之后,测试perl -v,如果能显示版本号,表示安装成功。
    b.第二步
        从https://raw.githubusercontent.com/percona/percona-toolkit/3.0/bin/pt-query-digest上获取脚本,
        并保存到MySQL的bin目录下文件名为:pt-query-digest.pl即可
    c.第三步
        a.第一种方式是在命令行下直接设置
            set global slow_query_log = on
            set global slow_query_log_file ='D:\logs\mysql\sql_log'
            set global long_query_time = 1
        b.在MySQL的配置文件my.cnf中添加如下
            slow_query_log = 1
            slow_query_log_file = /data/log/mysql/slow_query.log
            long_query_time = 1
    d.常用命令
        a.直接分析慢查询文件
            perl pt-query-digest.pl “D:\software\MySQL\MySQL Server 5.7\Data\WIN-1OU3SGBLNIN-slow.log” > slow_report1.log
        b.只分析最近12小时的日志
            perl pt-query-digest.pl --since=12h “D:\software\MySQL\MySQL Server 5.7\Data\WIN-1OU3SGBLNIN-slow.log” > slow_report2.log
        c.分析某段时间的日志
            perl pt-query-digest.pl –since ‘2019-10-01 00:00:00.000’ --until ‘2019-12-31 08:00:00.000’ “D:\software\MySQL\MySQL Server 5.7\Data\WIN-1OU3SGBLNIN-slow.log” > slow_report3.log
        d.分析select语句的日志
            perl pt-query-digest.pl --filter ‘$event->{fingerprint} =~ m/^select/i’ “D:\software\MySQL\MySQL Server 5.7\Data\WIN-1OU3SGBLNIN-slow.log” > slow_report4.log

9 project

9.1 lang

01.gin-vue-admin
    a.地址
        https://github.com/flipped-aurora/gin-vue-admin
    b.后端
        cd server
        go mod tidy / go generate -x                                                     --使用 go mod 并安装go依赖包
        go build -o server.exe main.go                                                   --编译
        server.exe                                                                       --运行二进制
    c.前端
        cd web
        npm install
        npm run serve
    d.运行
        server.exe
        npm run serve
        -----------------------------------------------------------------------------------------------------
        http://127.0.0.1:8080/
        admin
        123456

9.2 web1

01.abc
    项目截图

02.ant-design-vue
    https://github.com/vueComponent/ant-design-vue                                       --node 20.10.0
    Ant Design Vue
    ---------------------------------------------------------------------------------------------------------
    yarn install
    npm run dev

03.ant-design-vue-pro
    https://github.com/vueComponent/ant-design-vue-pro                                   --node 20.10.0
    Ant Design Vue
    ---------------------------------------------------------------------------------------------------------
    yarn install
    npm run serve
    ---------------------------------------------------------------------------------------------------------
    http://localhost:8000/
    admin
    admin

04.bootstrap-admin
    https://github.com/bopoda/ace                                                        --ace
    https://gitee.com/showMyCode123/boot-strap-web-page                                  --adshow
    https://github.com/wowthemesnet/Anchor-Bootstrap-UI-Kit                              --anchor
    https://github.com/webpixels/boomerang-free-bootstrap-ui-kit                         --boomerang
    https://github.com/creativetimofficial/light-bootstrap-dashboard                     --light
    https://github.com/luqiu/bootstrap                                                   --luqiu
    https://github.com/BootstrapDash/MajesticAdmin-Free-Bootstrap-Admin-Template         --majestic
    https://github.com/creativetimofficial/material-dashboard                            --material
    https://github.com/wowthemesnet/template-mundana-bootstrap-html                      --mundana
    https://gitee.com/ctmwow/qifeiye                                                     --qifeiye
    https://github.com/webpixels/quick-free-bootstrap-theme                              --quick
    https://github.com/YoLinDeng/Bootstrap                                               --yolindeng

05.bootstrap-admin2
    https://gitee.com/yinqi/Light-Year-Blog
    https://gitee.com/yinqi/Light-Year-Admin-Template
    https://gitee.com/yinqi/Light-Year-Admin-Using-Iframe
    https://gitee.com/yinqi/Light-Year-Admin-Template-v4
    https://gitee.com/yinqi/Light-Year-Admin-Using-Iframe-v4
    https://gitee.com/yinqi/Light-Year-Admin-Template-v5
    https://gitee.com/yinqi/Light-Year-Admin-Using-Iframe-v5

06.go-view
    https://gitee.com/dromara/go-view
    Vue3 + TypeScript
    GoView 是一个高效的拖拽式低代码数据可视化开发平台,将图表或页面元素封装为基础组件,无需编写代码即可制作数据大屏
    ---------------------------------------------------------------------------------------------------------
    pnpm install
    pnpm dev

07.layui-admin
    https://layui.dev/                                                                   --静态资源

08.layui-vue-admin
    https://gitee.com/layui-vue/layui-vue-admin                                          --node 20.10.0
    ---------------------------------------------------------------------------------------------------------
    pnpm install
    npm run dev

09.nova-admin
    https://github.com/chansee97/nova-admin                                              --node 20.10.0
    Vue3、Vite5、Typescript、Naive UI
    ---------------------------------------------------------------------------------------------------------
    pnpm install
    npm run dev

10.vben-admin(推荐学习)
    https://github.com/vbenjs/vue-vben-admin                                             --node 20.10.0
    vue3、vite2、TypeScript、Ant-Design-Vue
    ---------------------------------------------------------------------------------------------------------
    pnpm install
    pnpm serve
    ---------------------------------------------------------------------------------------------------------
    http://localhost:5173/
    vben
    123456

11.vben-admin-thin-next(推荐学习)
    https://github.com/vbenjs/vben-admin-thin-next                                       --node 20.10.0
    vue3、vite2、TypeScript、Ant-Design-Vue
    ---------------------------------------------------------------------------------------------------------
    yarn install
    npm run dev
    ---------------------------------------------------------------------------------------------------------
    http://localhost:3100/
    vben
    123456

12.vue-admin-arco(推荐学习)
    https://github.com/zxwk1998/vue-admin-arco                                           --node 20.10.0
    Arco Design、TypeScript
    ---------------------------------------------------------------------------------------------------------
    pnpm install
    npm run dev
    ---------------------------------------------------------------------------------------------------------
    http://localhost:5173/
    admin
    admin

13.vue-element-admin
    https://github.com/PanJiaChen/vue-element-admin/tree/master                          --node 20.10.0
    vue2 + vuex + vue-router + webpack + ES6/7 + axios + elementUI + 阿里图标iconfont
    ---------------------------------------------------------------------------------------------------------
    npm install
    npm run dev

14.vue-element-plus-admin(推荐学习)
    https://github.com/kailong321200875/vue-element-plus-admin                           --node 20.10.0
    Vue3、 Vite、Element-Plus、TypeScript
    ---------------------------------------------------------------------------------------------------------
    pnpm install
    npm run dev
    ---------------------------------------------------------------------------------------------------------
    http://localhost:4000/
    admin
    admin

15.vue-pure-admin(推荐学习)
    a.前端
        https://github.com/pure-admin/vue-pure-admin                                     --node 20.10.0
        Vue3、 Vite、Element-Plus、TypeScript、Pinia、Tailwindcss
        -----------------------------------------------------------------------------------------------------
        pnpm install
        pnpm dev
    b.后端
        https://github.com/pure-admin/pure-admin-backend
        nodejs、mysql
        -----------------------------------------------------------------------------------------------------
        pnpm install
        pnpm start
    c.运行
        http://localhost:8888/
        admin
        admin123

9.3 web2

01.elm(外卖点餐)(不能启动)
    a.elm-manage
        https://github.com/bailicangdu/vue2-manage
        vue + element-ui
        -----------------------------------------------------------------------------------------------------
        npm install
        npm run dev
    b.elm-node
        https://github.com/bailicangdu/node-elm
        nodejs + express + mongodb + mongoose + es6/7 + vue + element-ui
        -----------------------------------------------------------------------------------------------------
        npm install
        npm run dev
    c.elm-vue
        https://github.com/bailicangdu/vue2-elm
        vue2 + vuex + vue-router + webpack + ES6/7 + fetch + sass + flex + svg
        -----------------------------------------------------------------------------------------------------
        npm install
        npm run local

02.nuxt-elm(外卖点餐)(不能启动)
    a.nuxt-elm
        https://github.com/EasyTuan/nuxt-elm                                             --node 14.16.1
        nuxt2 + vue + vuex + vue-router + mint-ui
        -----------------------------------------------------------------------------------------------------
        npm install
        npm run dev
    b.node-elm-api
        https://github.com/EasyTuan/node-elm-api                                         --node 14.16.1
        nodejs + express + mongodb + mongoose + pm2
        -----------------------------------------------------------------------------------------------------
        npm install
        npm run dev

02.sharing(博客)(不能启动)
    a.sharing-back
        https://github.com/nonhana/littleSharing-Frontend                                --node 14.16.1
        vue3.0 + TS + ElementPlus + Pinia + Vite
        -----------------------------------------------------------------------------------------------------
        pnpm install
        npm run dev
    b.sharing-front
        https://github.com/nonhana/littleSharing-Backend-TS                              --node 14.16.1
        Node.js+Express+TypeScript+MySQL
        -----------------------------------------------------------------------------------------------------
        npm install
        npm run dev

03.todo(User模型)(不能启动)
    a.todo-admin
        https://github.com/jackchen0120/todo-vue-admin                                   --node 14.16.1
        vue2.6 + axios + webpack + ES6/7 + flex + iViewUI
        -----------------------------------------------------------------------------------------------------
        npm install
        npm run serve
    b.todo-node
        https://github.com/jackchen0120/todo-nodejs-api                                  --node 14.16.1
        NodeJS v10 + express + mysql v5.7 + jwt + nodemon + cors + boom + pm2
        -----------------------------------------------------------------------------------------------------
        npm install
        npm run dev

04.restapi(User模型)(不能启动)
    a.地址
        https://gitee.com/Z568_568/ZY.Node.Mysql                                         --node 14.16.1
        express
    b.运行
        1、进入到目录底下,安装插件,例如 express_project 目录底下
        $ npm install
        2、配置 sql,需要进入目录 /express_project/config/db.config.js
        module.exports = {
            HOST: "localhost",
            USER: "root",
            PASSWORD: "123456",

            DB: "restapi",
            dialect: "mysql",
            pool: {
                max: 5,
                min: 0,
                acquire: 30000,
                idle: 10000
            },
        };
        2、初始化 sql,需要进入目录 /express_project/sql/
        $ restapi.sql
        3、开发环境启动项目
        $ nodemon app.js (热加载)
        $ node app.js
        4、浏览器打开
        项目启动成功: http://localhost:3001
        接口文档地址: http://localhost:3001/swagger

05.research(考试系统)
    a.地址
        https://github.com/fengshi123/express_project                                    --node 14.16.1
        express
    b.运行
        1、进入到目录底下,安装插件,例如 express_project 目录底下
        $ npm install
        2、配置 sql,需要进入目录 /express_project/conf/db.js
        module.exports = {
          mysql: {
            host: '127.0.0.1',
            user: 'root',
            password: '123456',
            database: 'research',
            port: 3306
          }
        };
        2、初始化 sql,需要进入目录 /express_project/bin/db/
        $ t_app_version.sql
        $ t_exam.sql
        $ t_system.sql
        $ t_user.sql
        $ t_video.sql
        3、开发环境启动项目
        $ npm run dev
        4、正式环境启动项目
        $ npm run start
        5、浏览器打开
        http://localhost:3000

06.koa-admin(MongoDB示例)(推荐学习)
    a.地址
        https://github.com/bayi-lzp/koa-template                                         --node 20.10.0
        Koa、Logger、Router、JWT、Mongoose、PM2
    b.运行
        npm install
        npm start koa

07.nest-admin(权限管理系统)(推荐学习)
    a.地址
        https://gitee.com/wenqiyun/nest-admin                                            --node 20.10.0
        nestjs
    b.运行
        a.前端
            cd nest-admin/client
            npm install
            npm run dev
        b.后端
            pnpm install
            npm run start:dev
        c.网址
            http://localhost:5173
            admin
            admin

08.nest-admin2(中后台管理系统)(推荐学习)
    a.地址
        https://github.com/buqiyuan/nest-admin                                           --node 20.10.0
        nestjs
    b.运行
        a.前端
            pnpm install
            pnpm dev
        b.后端
            sql文件:/deploy/sql/nest_admin.sql 用于数据库初始化
            公共配置: .env
            开发环境: .env.development
            生产环境: .env.production
            -------------------------------------------------------------------------------------------------
            pnpm install
            pnpm dev
        c.网址
            https://localhost:8088/
            admin
            a123456

09.nest-admin3(中后台管理系统)(推荐学习)
    a.地址
        https://gitee.com/tao-zhi/nest-admin                                             --node 20.10.0
        nestjs
    b.运行
        a.前端
            pnpm install
            pnpm dev
        b.后端
            sql文件:/deploy/sql/nest_admin.sql 用于数据库初始化
            公共配置: .env
            开发环境: .env.development
            生产环境: .env.production
            -------------------------------------------------------------------------------------------------
            pnpm install
            pnpm dev
        c.网址
            https://localhost:8088/
            admin
            a123456

10.nest-carole(中后台管理系统)(推荐学习)
    a.地址
        https://github.com/Carole007/carole-admin                                        --node 20.10.0
        nestjs
    b.运行
        a.前端
            pnpm install
            pnpm dev
        b.后端
            sql文件:/deploy/sql/nest_admin.sql 用于数据库初始化
            公共配置: .env
            开发环境: .env.development
            生产环境: .env.production
            -------------------------------------------------------------------------------------------------
            pnpm install
            pnpm dev
        c.网址
            https://localhost:8088/
            admin
            a123456

11.nest-sblog(博客)(推荐学习)
    a.地址
        https://github.com/1Telescope1/sishi-personal-blog                               --node 20.10.0
        nestjs
    b.运行
        a.前端
            pnpm install
            pnpm dev
        b.后端
            sql文件:/deploy/sql/nest_admin.sql 用于数据库初始化
            公共配置: .env
            开发环境: .env.development
            生产环境: .env.production
            -------------------------------------------------------------------------------------------------
            pnpm install
            pnpm dev
        c.网址
            https://localhost:8088/
            admin
            a123456

12.tauri-linyu
    a.地址
        https://github.com/DWHengr/linyu-client                                          --node 20.12.2、tauri、react
        https://github.com/DWHengr/linyu-server                                          --jdk1.8、mysql8、redis5、minio
    b.运行
        a.前端
            npm install
            npm run tauri dev
            npm run tauri build                                                          --生成.msi
        b.后端
            sql文件:linyu.sql 用于数据库初始化
            修改application.yml内,mysql、minio、redis相关地址

13.omsh(node 20.10.0)
    a.Nestjs
        npm run start
    b.Koa
        SET DEBUG=koa* & npm start koa
    c.Express
        SET DEBUG=project:* & npm start

9.4 web3

00.bio
    a.best
        uni-best-uview-pro(推荐学习)
    b.plus
        uni-plus-demo(推荐学习)
    c.snail
        uni-snail-uv(推荐学习)
    d.mini
        vue-mini-cli(推荐学习)

01.h5
    a.h5-mobvue
        a.版本
            node v22.19.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm run dev                                                                --启动项目
            pnpm run build                                                              --打包项目
    b.h5-vite-template
        a.版本
            node v22.19.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm run dev                                                                --启动项目
            pnpm run build                                                              --打包项目
    c.h5-vue3-template
        a.版本
            node v22.19.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm run dev                                                                --启动项目
            pnpm run build                                                              --打包项目

02.best
    a.uni-best-demo,默认v-ui
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,H5,http://localhost:9000/
            pnpm dev:mp                                                                 --微信小程序,导入dist/dev/mp-weixin
            pnpm dev:app                                                                --HBuilderX,导入dist/dev/app
        c.构建
            pnpm build                                                                  --默认,H5,http://localhost:9000/
            pnpm build:mp                                                               --微信小程序,导入dist/dev/mp-weixin
            pnpm build:app                                                              --HBuilderX,导入dist/dev/app
    b.uni-best-i18n
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,H5,http://localhost:9000/
            pnpm dev:mp                                                                 --微信小程序,导入dist/dev/mp-weixin
            pnpm dev:app                                                                --HBuilderX,导入dist/dev/app
        c.构建
            pnpm build                                                                  --默认,H5,http://localhost:9000/
            pnpm build:mp                                                               --微信小程序,导入dist/dev/mp-weixin
            pnpm build:app                                                              --HBuilderX,导入dist/dev/app
    c.uni-best-sard
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,H5,http://localhost:9000/
            pnpm dev:mp                                                                 --微信小程序,导入dist/dev/mp-weixin
            pnpm dev:app                                                                --HBuilderX,导入dist/dev/app
        c.构建
            pnpm build                                                                  --默认,H5,http://localhost:9000/
            pnpm build:mp                                                               --微信小程序,导入dist/dev/mp-weixin
            pnpm build:app                                                              --HBuilderX,导入dist/dev/app
    d.uni-best-skiyee
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,H5,http://localhost:9000/
            pnpm dev:mp                                                                 --微信小程序,导入dist/dev/mp-weixin
            pnpm dev:app                                                                --HBuilderX,导入dist/dev/app
        c.构建
            pnpm build                                                                  --默认,H5,http://localhost:9000/
            pnpm build:mp                                                               --微信小程序,导入dist/dev/mp-weixin
            pnpm build:app                                                              --HBuilderX,导入dist/dev/app
        d.报错
            src/store/index.ts:17:0
            Failed to resolve import "./theme" from "src/store/index.ts". Does the file exist?
            -------------------------------------------------------------------------------------------------
            // 模块统一导出
            // export * from './theme'                                                  --注释掉
            export * from './token'
            export * from './user'
    e.uni-best-uv
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,H5,http://localhost:9000/
            pnpm dev:mp                                                                 --微信小程序,导入dist/dev/mp-weixin
            pnpm dev:app                                                                --HBuilderX,导入dist/dev/app
        c.构建
            pnpm build                                                                  --默认,H5,http://localhost:9000/
            pnpm build:mp                                                               --微信小程序,导入dist/dev/mp-weixin
            pnpm build:app                                                              --HBuilderX,导入dist/dev/app
    f.uni-best-uview-plus
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,H5,http://localhost:9000/
            pnpm dev:mp                                                                 --微信小程序,导入dist/dev/mp-weixin
            pnpm dev:app                                                                --HBuilderX,导入dist/dev/app
        c.构建
            pnpm build                                                                  --默认,H5,http://localhost:9000/
            pnpm build:mp                                                               --微信小程序,导入dist/dev/mp-weixin
            pnpm build:app                                                              --HBuilderX,导入dist/dev/app
        d.报错
            src/store/index.ts:17:0
            Failed to resolve import "./theme" from "src/store/index.ts". Does the file exist?
            -------------------------------------------------------------------------------------------------
            // 模块统一导出
            // export * from './theme'                                                  --注释掉
            export * from './token'
            export * from './user'
    g.uni-best-uview-pro(推荐学习)
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,H5,http://localhost:9000/
            pnpm dev:mp                                                                 --微信小程序,导入dist/dev/mp-weixin
            pnpm dev:app                                                                --HBuilderX,导入dist/dev/app
        c.构建
            pnpm build                                                                  --默认,H5,http://localhost:9000/
            pnpm build:mp                                                               --微信小程序,导入dist/dev/mp-weixin
            pnpm build:app                                                              --HBuilderX,导入dist/dev/app
    h.uni-best-wot
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,H5,http://localhost:9000/
            pnpm dev:mp                                                                 --微信小程序,导入dist/dev/mp-weixin
            pnpm dev:app                                                                --HBuilderX,导入dist/dev/app
        c.构建
            pnpm build                                                                  --默认,H5,http://localhost:9000/
            pnpm build:mp                                                               --微信小程序,导入dist/dev/mp-weixin
            pnpm build:app                                                              --HBuilderX,导入dist/dev/app

03.plus
    a.uni-plus-base
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev:h5                                                                 --默认,H5,http://localhost:9000/
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
        c.构建
            pnpm build:h5                                                               --默认,H5,http://localhost:9000/
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
    b.uni-plus-demo(推荐学习)
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev:h5                                                                 --默认,H5,http://localhost:9000/
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
        c.构建
            pnpm build:h5                                                               --默认,H5,http://localhost:9000/
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
    c.uni-plus-mock
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm start:dev                                                              --开启mock服务,后端

04.snail
    a.uni-snail-nut
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,微信小程序
            pnpm dev:h5                                                                 --h5,导入dist/build/h5
            pnpm dev:app                                                                --App,导入dist/build/app
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
        c.构建
            pnpm build                                                                  --默认,微信小程序
            pnpm build:h5                                                               --h5,导入dist/build/h5
            pnpm build:app                                                              --App,导入dist/build/app
            pnpm build:mp-weixin                                                        --微信小程序,导入dist/build/mp-weixin
            pnpm build:quickapp-webview                                                 --商店轻应用,导入dist/build/quickapp-webview
    b.uni-snail-tuniao
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,微信小程序
            pnpm dev:h5                                                                 --h5,导入dist/build/h5
            pnpm dev:app                                                                --App,导入dist/build/app
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
        c.构建
            pnpm build                                                                  --默认,微信小程序
            pnpm build:h5                                                               --h5,导入dist/build/h5
            pnpm build:app                                                              --App,导入dist/build/app
            pnpm build:mp-weixin                                                        --微信小程序,导入dist/build/mp-weixin
            pnpm build:quickapp-webview                                                 --商店轻应用,导入dist/build/quickapp-webview
    c.uni-snail-uni
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,微信小程序
            pnpm dev:h5                                                                 --h5,导入dist/build/h5
            pnpm dev:app                                                                --App,导入dist/build/app
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
        c.构建
            pnpm build                                                                  --默认,微信小程序
            pnpm build:h5                                                               --h5,导入dist/build/h5
            pnpm build:app                                                              --App,导入dist/build/app
            pnpm build:mp-weixin                                                        --微信小程序,导入dist/build/mp-weixin
            pnpm build:quickapp-webview                                                 --商店轻应用,导入dist/build/quickapp-webview
    d.uni-snail-uv(推荐学习)
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,微信小程序
            pnpm dev:h5                                                                 --h5,导入dist/build/h5
            pnpm dev:app                                                                --App,导入dist/build/app
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
        c.构建
            pnpm build                                                                  --默认,微信小程序
            pnpm build:h5                                                               --h5,导入dist/build/h5
            pnpm build:app                                                              --App,导入dist/build/app
            pnpm build:mp-weixin                                                        --微信小程序,导入dist/build/mp-weixin
            pnpm build:quickapp-webview                                                 --商店轻应用,导入dist/build/quickapp-webview
    e.uni-snail-uview-plus
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,微信小程序
            pnpm dev:h5                                                                 --h5,导入dist/build/h5
            pnpm dev:app                                                                --App,导入dist/build/app
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
        c.构建
            pnpm build                                                                  --默认,微信小程序
            pnpm build:h5                                                               --h5,导入dist/build/h5
            pnpm build:app                                                              --App,导入dist/build/app
            pnpm build:mp-weixin                                                        --微信小程序,导入dist/build/mp-weixin
            pnpm build:quickapp-webview                                                 --商店轻应用,导入dist/build/quickapp-webview
    f.uni-snail-wot
        a.版本
            node v20.10.0
        b.运行
            pnpm i --registry https://registry.npmmirror.com
            pnpm dev                                                                    --默认,微信小程序
            pnpm dev:h5                                                                 --h5,导入dist/build/h5
            pnpm dev:app                                                                --App,导入dist/build/app
            pnpm dev:mp-weixin                                                          --微信小程序,导入dist/build/mp-weixin
            pnpm dev:quickapp-webview                                                   --商店轻应用,导入dist/build/quickapp-webview
        c.构建
            pnpm build                                                                  --默认,微信小程序
            pnpm build:h5                                                               --h5,导入dist/build/h5
            pnpm build:app                                                              --App,导入dist/build/app
            pnpm build:mp-weixin                                                        --微信小程序,导入dist/build/mp-weixin
            pnpm build:quickapp-webview                                                 --商店轻应用,导入dist/build/quickapp-webview

05.vant
    a.vant
        a.cdn
            cdn 目录下包含了通过 CDN 引入 Vant 的示例,在浏览器内打开 cdn/index.html 文件即可查看效果
        b.rsbuild (推荐)
            rsbuild 目录示范了如何用 https://github.com/web-infra-dev/rsbuild 搭建工程
        c.vite
            vite 目录示范了如何用 Vite 搭建工程
        d.nuxt3
            基于 nuxt 3 的示例工程
        e.vue3-ts
            vue3-ts 目录示范了如何用 Vue 3 + ts 和 Vant 4 搭建工程
            npm install
            npm run dev
            http://localhost:4200/
        f.vue2(废弃)
            vue2 目录示范了如何用 Vue 2 和 Vant 2 搭建几个简单的电商页面
        g.rem(废弃)
            rem 工程在 vue2 工程的基础上增加了移动端 rem 适配的配置
        h.viewport(废弃)
            viewport 工程在 vue2 工程的基础上增加了移动端 vw/vh 适配的配置
    b.vant-cli
        a.说明
            Vant Cli 的基础示例工程,示范通过 Vant Cli 快速搭建一套组件库。
        b.使用
            npm install
            npm run dev
        c.运行
            http://localhost:8080/
    c.vant-weapp,启动失败
        a.说明
            用 Vant Weapp 搭建几个简单的电商小程序页面
        b.使用
            npm install
            运行:使用【微信开发者工具】
        c.微信开发者工具
            导入示例工程,点击工具 -> 构建 npm,并勾选使用 npm 模块选项即可
    d.vue-mini-cli(推荐学习)
        a.使用
            pnpm install
            pnpm dev
            pnpm build
        b.微信开发者工具
            导入示例工程,位置为/dist

9.5 idea1

01.xblog
    a.配置
        a.后端
            url: jdbc:p6spy:mysql://127.0.0.1:3306/xblog                              --JDK8/MySQL5.7.25
            username: root
            password: 123456
            -------------------------------------------------------------------------------------------------
            redis:
                database: 0
                host: localhost
                port: 6379
                password: myslayers
        b.前端
            layui
    b.运行
        a.后端
            无
        b.前端
            http://localhost:8080/                                                    --页面:后台
            admin
            123456

02.xblog-tiny
    a.配置
        a.后端
            url: jdbc:p6spy:mysql://127.0.0.1:3306/xblog_tiny                         --JDK8/MySQL5.7.25
            username: root
            password: 123456
            -------------------------------------------------------------------------------------------------
            shiro-redis:
              enabled: true
              redis-manager:
                host: 127.0.0.1:6379
                password: myslayers
        b.前端
            axios.defaults.baseURL = "http://localhost:8520"                          --axios.js
            -------------------------------------------------------------------------------------------------
            proxyObj['/'] = {                                                         --vue.config.js
              ws: false,
              target: 'http://localhost:8765',
              changeOrigin: true,
              pathRewrite: {
                '^/': '',
              },
            }
    b.运行
        a.后端
            http://localhost:8520/                                                    --后端接口
        b.前端
            http://localhost:8080/                                                    --页面:后台
            admin
            123456

03.vue-admin
    a.配置
        a.后端
            url: jdbc:p6spy:mysql://127.0.0.1:3306/vue_admin                          --JDK8/MySQL5.7.25
            username: root
            password: 123456
            -------------------------------------------------------------------------------------------------
            redis:
                database: 0
                host: localhost
                port: 6379
                password: myslayers
        b.前端
            axios.defaults.baseURL = "http://localhost:8520"                          --axios.js
            -------------------------------------------------------------------------------------------------
            proxyObj['/'] = {                                                         --vue.config.js
              ws: false,
              target: 'http://localhost:8520',
              changeOrigin: true,
              pathRewrite: {
                '^/': '',
              },
            }
    b.运行
        a.后端
            http://localhost:8520/                                                    --后端接口
        b.前端
            http://localhost:8080/                                                    --页面:后台
            admin
            123456
        c.报错
            报错:登录失败处理器:用户名/密码/验证码有误!
            解决:清空MySQL库,重新导入vue_admin_20220331_163723.sql

04.vhr
    a.配置
        a.后端
            spring.datasource.url=jdbc:mysql://localhost:3307/vhr                     --JDK8/MySQL8.0.20
            spring.datasource.username=root
            spring.datasource.password=123456
        b.前端
            -------------------------------------------------------------------------------------------------
            proxyObj['/'] = {                                                         --vue.config.js
              ws: false,
              target: 'http://localhost:8081',
              changeOrigin: true,
              pathRewrite: {
                '^/': '',
              },
            }
    b.运行
        a.后端
            http://localhost:8081/                                                    --后端接口
        b.前端
            http://localhost:8888/                                                    --页面:后台
            amdin
            123456

05.clothsystem
    a.配置
        a.后端
            url: jdbc:mysql://localhost:3306/clothsystem                              --JDK8/MySQL5.7.25
            username: root
            password: 123456
        b.前端
            layui
    b.运行
        a.后端
            无
        b.前端
            http://localhost:8520/front/index.html                                    --页面:后台
            admin
            123456

06.yiblog(https://github.com/ZHENFENG13/My-Blog)
    a.配置
        a.后端
            url: jdbc:mysql://localhost:3306/yiblog                                   --JDK8/MySQL5.7.25
            username: root
            password: 123456
        b.前端
            html(手敲)
    b.运行
        a.后端
            无
        b.前端
            http://127.0.0.1:8520/admin                                               --页面:后台
            admin
            123456
            -------------------------------------------------------------------------------------------------
            http://localhost:8520/                                                    --页面:前台

07.forum(https://www.developers.pub/)(https://github.com/Qbian61/forum-java)
    a.配置
        a.后端
            url: jdbc:p6spy:mysql://127.0.0.1:3306/forum                              --JDK8/MySQL5.7.25
            username: root
            password: 123456
        b.前端
           dist(无法反编译)
    b.运行
        a.后端
            无
        b.前端
            http://127.0.0.1:8080/admin                                               --页面:后台
            [email protected]/123456
            [email protected]/123456
            -------------------------------------------------------------------------------------------------
            http://127.0.0.1:8080/                                                    --页面:前台

08.wetech-admin(https://github.com/cjbi/wetech-admin)(不可用)
    a.配置
        a.后端
            url: jdbc:p6spy:mysql://127.0.0.1:3306/wetech_admin                       --JDK8/MySQL8.0.20
            username: root
            password: 123456
        b.前端
           dist(无法反编译)
    b.运行
        a.后端
            无
        b.前端
            http://127.0.0.1:8080/
            admin/123456
            guest/123456                                                              --页面:后台
            -------------------------------------------------------------------------------------------------
            http://localhost:8080/swagger-ui/                                         --页面:文档

09.renren-fast、renren-fast-vue
    a.renren-fast
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://localhost:3306/renren_fast?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
        username: root
        password: 123456
    b.renren-fast-vue
        http://127.0.0.1:8081
        admin
        admin

10.vueshop
    a.api
        driver-class-name: com.p6spy.engine.spy.P6SpyDriver
        url: jdbc:p6spy:mysql://localhost:3306/vueshop?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai
        username: root
        password: 123456
    b.vue-admin
        http://127.0.0.1:5173/
        admin
        123456
    c.vue-app
        http://127.0.0.1:5173/
        test
        888888

9.6 idea2

00.修改端口
    原因:Clash占用9000端口
    解决:后端(port: 9095)、前端(request.js:9095)

01.体检预约小程序(Springboot+Vue+Uniapp)
    a.前端
        http://localhost:8081/
        zhang
        123
    b.后端
        http://127.0.0.1:8080/
        admin
        admin

02.宠物领养系统
    a.前端
        http://localhost:8080/front/
    b.后端
        http://localhost:8080/
        admin
        admin

03.懒人存钱小项目
    a.前端
        http://localhost:8080/front/
    b.后端
        http://localhost:8080/
        admin
        admin

04.公益托管系统
    a.前端
        无
    b.后端
        http://localhost:9528/
        admin
        admin

05.疫情管理系统
    a.前端
        无
    b.后端
        http://localhost:8080/
        admin
        admin

06.影视评论系统
    a.前端
        http://localhost:9876/front/home
    b.后端
        http://localhost:9876/movie
        admin
        admin

07.在线考试系统
    a.前端
        http://localhost:8088/
        20154084
        123456
    b.后端
        http://localhost:8088/
        20154084
        9527
        123456

08.舒乐美食系统
    a.前端
        http://127.0.0.1:8888/front/index.html
    b.后端
        http://127.0.0.1:8888/end/page/index.html
        admin
        123456

09.员工管理系统(vhr)
    a.前端
        无
    b.后端
        http://127.0.0.1:8080
        admin
        123

10.在线博客系统
    a.前端
        http://localhost:9999/page/front/index.html
    b.后端
        http://localhost:9999/page/end/login.html
        admin
        admin

11.在线电商平台
    a.前端
        http://localhost:8001/front/home
    b.后端
        http://localhost:8001/manage/home
        admin
        admin

12.在线活动预约
    a.前端
        小程序
    b.后端
        http://localhost:8080
        admin
        admin

13.在线音乐平台
    a.前端
        http://localhost:8001/front/home
    b.后端
        http://localhost:8001/manage/home
        admin
        admin

07.在线考试系统
    a.前端
        http://localhost:8080/front
    b.后端
        http://localhost:8088/
        admin
        admin

9.7 python

01.auth(flask框架)
    a.地址
        https://gitee.com/zhujf21st/authbase
    b.前端
        D:\software_xare\workspace_pycharm\auth\ui
        npm install
        npm run dev
    c.后端
        mysql创建名为authbase的数据库
        导入根目录下db.sql数据库脚本到authbase数据库中
        -----------------------------------------------------------------------------------------------------
        更改config.py DevelopmentConfig类下的数据库连接,提供用户名密码
        class DevelopmentConfig(Config):
            DEBUG = True
            MAIL_SERVER = 'smtp.qq.com'
            MAIL_PORT = 587
            MAIL_USE_TLS = True
            MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
            MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
            SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URI') or \ 'mysql+mysqlconnector://root:[email protected]/auth?charset=utf8&auth_plugin=mysql_native_password'
        -----------------------------------------------------------------------------------------------------
        安装依赖
        pip install -r requirements.txt
        -----------------------------------------------------------------------------------------------------
        pipenv run python -m flask --app start run -h 0.0.0.0 -p 5000
    d.启动
        npm run dev
        pipenv run python -m flask --app start run -h 0.0.0.0 -p 5000
        -----------------------------------------------------------------------------------------------------
        http://localhost:80/
        admin
        123456

02.pear(flask框架)
    a.地址
        https://gitee.com/pear-admin/pear-admin-flask
    b.前端
        普通html文件,无需安装依赖
    c.后端
        mysql创建名为pear的数据库
        导入根目录下pear.sql数据库脚本到authbase数据库中
        -----------------------------------------------------------------------------------------------------
        更改config.py BaseConfig类下的数据库连接,提供用户名密码
        class BaseConfig:
            # mysql 配置
            MYSQL_USERNAME = "root"
            MYSQL_PASSWORD = "123456"
            MYSQL_HOST = "127.0.0.1"
            MYSQL_PORT = 3306
            MYSQL_DATABASE = "pear"
        -----------------------------------------------------------------------------------------------------
        # 使用 pip 安装
        pip install -r requirements.txt
        -----------------------------------------------------------------------------------------------------
        # 初始化数据库
        flask db init
        flask db migrate
        flask db upgrade
        flask admin init
        # 运行项目
        flask --app app.py run -h 0.0.0.0 -p 8000 --debug
    d.启动
        pipenv run flask  --app app.py run -h 0.0.0.0 -p 8000 --debug
        -----------------------------------------------------------------------------------------------------
        http://127.0.0.1:8000/
        admin
        123456

03.huge(Django框架)
    a.地址
        https://gitee.com/huge-dream/django-vue3-admin
    b.前端
        D:\software_xare\workspace_pycharm\huge\web
        npm install
        npm run dev
    c.后端
        1.进入项目目录 cd backend
        2.在项目根目录中,复制 ./conf/env.example.py 文件为一份新的到 ./conf 文件夹下,并重命名为 env.py
        3.在 env.py 中配置数据库信息
            DATABASE_NAME = 'huge'
            DATABASE_HOST = '127.0.0.1'
            DATABASE_PORT = 3307
            DATABASE_USER = "root"
            DATABASE_PASSWORD = '123456'
        4.安装依赖环境
            pip install -r requirements.txt
        5.执行迁移命令:
            python manage.py makemigrations
            python manage.py migrate
        6.初始化数据
            python manage.py init
        7.初始化省市县数据:
            python manage.py init_area
        8.启动项目
            python manage.py runserver 0.0.0.0:8000
    d.启动
        npm run dev
        python manage.py runserver 0.0.0.0:8000
        -----------------------------------------------------------------------------------------------------
        http://127.0.0.1:8000/
        superadmin
        admin123456

04.erp(Django框架)
    a.地址
        https://gitee.com/himool/erp
    b.前端
        D:\software_xare\workspace_pycharm\erp\frontend
        npm install
        npm run serve
    c.后端
        数据库字符集设置为 utf8mb4
        创建 erp-db 数据库(先设置字符集, 再创建数据库) CREATE DATABASE erp_db;
        -----------------------------------------------------------------------------------------------------
        创建配置文件
        python tools/create_configs.py
        迁移数据库
        python manage.py makemigrations
        python manage.py migrate
        -----------------------------------------------------------------------------------------------------
        创建用户
        python manage.py runscript create_user
        编号: 256
        用户名: admin
        密码: 123456
        激活天数: 999999
    d.启动
        npm run serve
        python manage.py runserver
        -----------------------------------------------------------------------------------------------------
        http://localhost:8080/
        编号: 256
        用户名: admin
        密码: 123456

05.lyadmin(Django框架)
    a.地址
        https://gitee.com/lybbn/django-vue-lyadmin
    b.前端
        D:\software_xare\workspace_pycharm\lyadmin\frontend
        npm install
        npm run dev
    c.后端
        1.进入项目目录
        2.在 config.py 中配置数据库信息
            mysql数据库版本建议:8.0(django4.2版本要求mysql8.x以上)
            mysql数据库字符集:utf8mb4(mysql8.x排序规则选择:utf8mb4_0900_ai_ci、mysql5.7.x选择utf8mb4_general_ci)
            mysql数据库对应的表关于事务处理的确保是:innodb引擎(能回滚)
        3.设置数据库隔离级别(悲观锁、乐观锁)
            全局设置mysql数据库隔离级别为READ-COMMITTED(临时生效,重启就没了):SET GLOBAL tx_isolation='READ-COMMITTED';
            全局设置mysql数据库隔离级别为READ-COMMITTED(永久有效):修改配置文件my.cnf 的[mysqld]中增加 transaction-isolation=Read-Committed
            当数据库当前会话的隔离级别:set tx_isolation='READ-COMMITTED';
            查询当前会话的数据库隔离级别:select @@tx_isolation;
            查询数据库mysql的隔离级别:select @@global.tx_isolation;
        4. 安装依赖环境
            pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
        5. 执行迁移命令(数据初始化):(此步骤可省略,直接导入sql脚本即可)
            python manage.py makemigrations
            python manage.py migrate
        6. 初始化数据(数据初始化):(此步骤可省略,直接导入sql脚本即可)
            python manage.py init
        7. 启动项目(初始账号:superadmin 密码:123456)
            python manage.py runserver 127.0.0.1:8000
    d.启动
        npm start
        python manage.py runserver 127.0.0.1:8000
        -----------------------------------------------------------------------------------------------------
        http://localhost:8000/
        superadmin
        123456

10 project

10.1 bio

00.介绍
    jar包打不开,需要重新下载
    cnpm下载的node_modules无法压缩,而npm可以
    BCrypt不支持解密哈希值以获取原始密码。验证用户的密码正确性是通过比较哈希值而不是解密来完成的,这有助于保护用户密码的安全性

01.验证123456
    public static void main(String[] args) {
        String hashedPassword = "$2a$10$MO5ADspSOEYpYQGrHxYlXu0gaY/XnZctsdKBPeGflrQ4OiS.yInVG";
        String rawPassword = "123456";
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        if (encoder.matches(rawPassword, hashedPassword)) {
            System.out.println("Password matches!");
        } else {
            System.out.println("Password does not match!");
        }
    }
    ---------------------------------------------------------------------------------------------------------
    public static void main(String[] args) {
        String hashedPassword = "$2a$10$MO5ADspSOEYpYQGrHxYlXu0gaY/XnZctsdKBPeGflrQ4OiS.yInVG";
        String rawPassword = "123456";
        if (BCrypt.checkpw(rawPassword, hashedPassword)) {
            System.out.println("Password matches!");
        } else {
            System.out.println("Password does not match!");
        }
    }

02.加密123456
    public static void main(String[] args) {
        String rawPassword = "123456";
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        String hashedPassword = encoder.encode(rawPassword);
        System.out.println("Hashed Password: " + hashedPassword);
    }
    ---------------------------------------------------------------------------------------------------------
    public static void main(String[] args) {
        String rawPassword = "123456";
        String hashedPassword = BCrypt.hashpw(rawPassword);
        System.out.println("Hashed Password: " + hashedPassword);
    }

03.MD5
    public static void main(String[] args) {
        String md5Str = DigestUtils.md5DigestAsHex("abc".getBytes());
        System.out.println(md5Str); //900150983cd24fb0d6963f7d28e17f72
    }
    ---------------------------------------------------------------------------------------------------------
    public static void main(String[] args) {
        String md5Str = SecureUtil.md5("abc");
        System.out.println(md5Str); // 900150983cd24fb0d6963f7d28e17f72
    }

04.MD5+salt
    public static void main(String[] args) {
        String salt = "abc";
        String password = "123456";
        String pdmd5 = DigestUtils.md5DigestAsHex((password + salt).getBytes());
        System.out.println(pdmd5); // df10ef8509dc176d733d59549e7dbfaf
    }
    ---------------------------------------------------------------------------------------------------------
    public static void main(String[] args) {
        String salt = "abc";
        String password = "123456";
        String pdmd5 = SecureUtil.md5(password + salt);
        System.out.println(pdmd5); // df10ef8509dc176d733d59549e7dbfaf
    }

05.Md5Hash(password , mobile , 3),调试接口:/login
    /**
     * 用户登录
     */
    @PostMapping(value = "/login")
    public Result login(@RequestBody Map<String,Object> loginMap){
        String mobile = (String) loginMap.get("mobile");
        String password = (String) loginMap.get("password");
        try {

            //如果该公司被禁止登录,直接返回
            User user = userService.findByMobile(mobile);
            if (!Constant.UserLevel.SAASADMIN.equals(user.getLevel())){
                //返回时List<LinkedHashMap> ,需要对其解析
                LinkedHashMap linkedHashMap
                        = (LinkedHashMap) companyFeignClient.findCompanyById(user.getCompanyId()).getData();
                Company company = JSON.parseObject(JSON.toJSONString(linkedHashMap), new TypeReference<Company>() {
                });
                if (!ObjectUtils.isEmpty(company)){
                    if (Constant.Company.COMPANY_DISABLE.equals(String.valueOf(company.getState()))){
                        return new Result(ResultCode.UNAUTHORISE);
                    }
                }
            }
            //构造登录令牌
            password = new Md5Hash(password , mobile , 3).toString();
            UsernamePasswordToken upToken = new UsernamePasswordToken(mobile , password);
            //获取subject
            Subject subject = SecurityUtils.getSubject();
            //调用login方法,进入realm完成认证
            subject.login(upToken);
            //获取sessionId
            String sessionId = (String) subject.getSession().getId();
            //构造返回结果
            return new Result(ResultCode.SUCCESS , sessionId);
        }catch (Exception e){
            System.out.println("error : " + e);
            return new Result(ResultCode.MOBILEORPASSWORDERROR);
        }
    }

10.2 guigu

01.gulimall(mysql、redis、rabbitmq、es)
    a.配置
        a.后端
            nacos
        b.前端
            无
    b.运行
        GulimallAuthServerApplication  8150
        GulimallCartApplication        40001
        GulimallCouponApplication      6000
        GulimallGatewayApplication     88
        GulimallMemberApplication      8000
        GulimallOrderApplication       9095
        GulimallProductApplication     19956
        GulimallSearchApplication      12001
        GulimallSeckillApplication     25000
        GulimallThirdPartyApplication  30000
        GulimallWareApplication        7000
        RenrenApplication              18080

02.shangyouxuan、guigu-ssyx-parent(mysql、redis、rabbitmq、es)
    a.配置
        a.后端
            nacos
        b.前端
            无
    b.运行
        ServicePaymentApplication    8210
        ServiceAclApplication        8211
        -----------------------------------------------------------------------------------------------------
        ServiceGatewayApplication    8201
        ServiceSysApplication        8202
        ServiceProductApplication    8203
        ServiceSearchApplication     8204
        ServiceActivityApplication   8205
        ServiceUserApplication       8206
        ServiceHomeApplication       8207
        ServiceCartApplication       8208
        ServiceOrderApplication      8209

10.3 guns

01.guns_8.3.0
    a.前端
        nvm use 20.10.0
        yarn
        yarn run dev
        -----------------------------------------------------------------------------------------------------
        http://localhost:9000/
        admin
        123456
    b.后端
        # Mysql数据库
        spring:
          datasource:
            driver-class-name: com.mysql.cj.jdbc.Driver
            url: jdbc:mysql://localhost:3306/guns?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
            username: root
            password: 123456

            # 连接池大小根据实际情况调整
            max-active: 100
            max-pool-prepared-statement-per-connection-size: 100

02.初始化
    a.说明
        第一次进入Guns系统会配置系统的一些秘钥和部署的url信息,这些秘钥均为随机生成,以确保系统的安全性
    b.系统参数
        服务部署的访问地址:http://localhost:9000/api
        websocket的ws-url:ws://localhost:9000/api/ws/message/{token}
        auth认证用的jwt秘钥:QZwCQtvtT2Jq0JZTn19hqJC7L1QZzO
        Druid控制台账号:admingZ2ue0aCo1zdDVyieAEv
        session过期时间:3600
        账号单端登录限制:false
        系统默认密码:123456
        系统发布版本:20241201
        数据库加密AES秘钥:2FrpYU7OjQiZDpsCbPcZN7HGA0MMmNcK
        SSO服务端加密Token信息秘钥:yDicvuttYlSn3HKYAN1MHlfeqm7VFHNr
        文件存储类型:10
        Windows本地文件保存路径:D:\software_zare\workspace_guns\guns_8.3.0\guns-server\target
    b.国密算法配置
        国密算法SM2-公钥:040df43725a8bdaf3a070403faf8011705b38459380953f3bf67d6b6c22215c5887feeb43010c589214c4854214fd88ef9f26e901cb7951686b8f9b5388144194b
        国密算法SM2-私钥:008d87210907b710f02c194da0c4b6cae455f258f7445241e5d25d0990a27b3b0e
        国密算法SM4-对称秘钥:iwkbsx/Zg88YfcFha7yQkQ==

10.4 heima

01.cangqiong、sky-take-out_refer(mysql、reids)
    a.配置
        a.后端
            sky:
              datasource:
                driver-class-name: com.mysql.cj.jdbc.Driver
                host: localhost
                port: 3306
                database: sky_take_out
                username: root
                password: 123456
        b.前端
            无
    b.运行
        a.后端
            http://127.0.0.1:8080/                                                  --后端接口
            http://127.0.0.1:8080/doc.html                                          --Knife4j
        b.前端
            http://localhost:80                                                     --管理端:nginx-1.20.2/nginx.exe
            admin / 123456
            -------------------------------------------------------------------------------------------------
            mp-weixin                                                               --用户端:微信小程序

02.ruijiwaimai、reggie_take_out_refer(mysql、reids)
    a.配置
        a.后端
            spring:
              datasource:
                druid:
                  driver-class-name: com.mysql.cj.jdbc.Driver
                  url: jdbc:mysql://localhost:3306/reggie_take_out?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
                  username: root
                  password: 123456
        b.前端
            无
    b.运行
        a.后端
            http://127.0.0.1:8080/                                                  --后端接口
        b.前端
            http://localhost:8080/backend/page/login/login.html                     --管理端
            admin / 123456
            -------------------------------------------------------------------------------------------------
            http://localhost:8080/front/index.html                                  --用户端:首页
            http://localhost:8080/front/page/login.html                             --用户端:登录
            15135890769 / 控制台:code=6516

03.jiankang、health_parent_refer(mysql、reids)
    a.配置
        a.后端
            <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
                <property name="username" value="root" />
                <property name="password" value="123456" />
                <property name="driverClassName" value="com.mysql.jdbc.Driver" />
                <property name="url" value="jdbc:mysql://localhost:3306/health?characterEncoding=UTF-8" />
            </bean>
        b.前端
            无
    b.运行
        a.模块
            health_parent
            ├── health_common -- 工具类及通用代码
            ├── health_backend -- 后台管理系统模块
            ├── health_mobile -- 前台预约系统模块
            ├── health_interface -- 服务接口模块
            ├── health_service_provider -- 服务提供模块
            └── health_jobs -- 系统任务模块
        b.模块
            health_backend             controller                         webapp         tomcat7:82         消费方
            health_common              constant、entity、pojo、utils
            health_interface           service
            health_jobs                                                                  tomcat7:83         job
            health_mobile              controller                         webapp         tomcat7:80         消费方
            health_service_provider    service.impl、mapper                              tomcat7:81         提供方
        c.模块
            health_backend             redis、zookeeper                   http://localhost:82/pages/main.html     http://localhost:82/login.html          admin / 123456
            health_common
            health_interface
            health_jobs                redis、jobs
            health_mobile              redis、zookeeper                   http://localhost:80/pages/index.html    http://localhost:80/pages/login.html
            health_service_provider    mysql、redis、zookeeper

04.renliziyuan、ihrm_parent_refer(mysql、reids)
    a.配置
        a.后端
            无
        b.前端
            无
    b.顺序
        ihrm_eureka            6868
        ihrm_gate              9091
        ihrm_company           9001
        ihrm_system            9002
        ihrm_attendance        9005
        ihrm_social_securitys  9004
        ihrm_salarys           9006
        ihrm_employee          9003
        ihrm_audit             10888
        -----------------------------------------------------------------------------------------------------
        因为所有模块都注册到了Eureka中,故最先启动Eureka模块
        因为在gate模块后面都是业务模块,所以网关模块放在第二位启动
        因为system模块通过feign调用了company模块的接口,所以company要在system模块之前启动
        因为salarys模块通过feign调用了attendance和social_securitys模块的接口,所以salarys在其之后启动
        后面两个顺序可以打乱
        服务调用了其他服务的接口,最好是先去启动被调用的模块
        当然,也可以不分前后顺序,同时启动全部服务,让其自行调整
    c.运行
        nginx-1.13.12           http://localhost:801/         API文档
        -----------------------------------------------------------------------------------------------------
        http://localhost:8080/
        13800000001 / 123456    SaaS管理员
        13800000002 / 123456    企业管理员
        13800000003 / 123456    员工

05.tianjixuetang、tianji_refer
    a.配置
        a.后端
            nacos
        b.前端
            无
    b.运行
        tj-api
        tj-auth         http://127.0.0.1:8081
        tj-common
        tj-course       http://127.0.0.1:8086
        tj-data         http://127.0.0.1:8093
        tj-exam         http://127.0.0.1:8089
        tj-gateway      http://127.0.0.1:10010
        tj-learning     http://127.0.0.1:8090
        tj-media        http://127.0.0.1:8084
        tj-message      http://127.0.0.1:8085
        tj-pay          http://127.0.0.1:8087
        tj-promotion    http://127.0.0.1:8092
        tj-remark       http://127.0.0.1:8091
        tj-search       http://127.0.0.1:8083
        tj-trade        http://127.0.0.1:8088
        tj-user         http://127.0.0.1:8082
        -----------------------------------------------------------------------------------------------------
        tj-admin        http://127.0.0.1:18081
        tj-protal       http://127.0.0.1:18082

06.toutiao、heima-leadnews(mysql、reids、mongodb、minio、kafka/kafkaStream、es7、xxl-job)
    a.配置
        a.后端
            无
        b.前端
            无
    b.运行
        a.前端
            虚拟机      root   / itcast
            虚拟机      itcast / itcast
            ---------------------------------------------------------------------------------------------------------
            app端       http://127.0.0.1:8801                         13511223456 / admin
            自媒体      http://127.0.0.1:8802                         admin       / admin
            平台管理    http://127.0.0.1:8803                         guest       / guest
            ---------------------------------------------------------------------------------------------------------
            xxl-job    http://127.0.0.1:8888/xxl-job-admin/           admin       / 123456
        b.后端
            AppGatewayApplication           51601
            WemediaGatewayAplication        51602
            AdminGatewayApplication         51603
            -------------------------------------------------------------------------------------------------------------
            UserApplication                 51801                    http://localhost:51801/swagger-ui.html          http://localhost:51801/doc.html
            ArticleApplication              51802
            WemediaApplication              51803
            SearchApplication               51804
            BehaviorApplication             51805
            CommentApplication              51806
            AdminApplication                51809
            ScheduleApplication             51701
            ---------------------------------------------------------------------------------------------------------
            FreemarkerApplication           8881                     http://127.0.0.1:8881/basic                     http://127.0.0.1:8881/list

10.5 jeecg

00.克隆JeecgBoot_20241120_init
    a.第1处
        jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml
        -----------------------------------------------------------------------------------------------------
        datasource:
          master:
            url: jdbc:mysql://127.0.0.1:3307/jeecg-boot_20241201_online?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
            username: root
            password: 123456
            driver-class-name: com.mysql.cj.jdbc.Driver
        -----------------------------------------------------------------------------------------------------
        #redis 配置
        redis:
          database: 0
          host: 127.0.0.1
          port: 6379
          password: myslayers
        #分布式锁
        redisson:
          address: 127.0.0.1:6379
          password: myslayers
          type: STANDALONE
          enabled: true
    b.第2处
        系统监控 -> 数据库管理
        -----------------------------------------------------------------------------------------------------
        数据源名称:本地测试库
        数据库类型:MySQL5.5
        驱动类:com.mysql.jdbc.Driver
        数据源地址:jdbc:mysql://127.0.0.1:3307/jeecg-boot_20241201_online?characterEncoding=UTF-8&useUnicode=true&useSSL=false
        用户名:root
        密码:123456
    c.第3处
        低代码开发 -> 积木报表设计 -> 任意报表 -> 数据集管理 -> 维护数据源
        -----------------------------------------------------------------------------------------------------
        数据源名称:本地测试库
        数据库类型:MySQL5.5
        驱动类:com.mysql.jdbc.Driver
        数据源地址:jdbc:mysql://127.0.0.1:3307/jeecg-boot_20241201_online?characterEncoding=UTF-8&useUnicode=true&useSSL=false
        用户名:root
        密码:123456
    d.第4处
        低代码开发 -> 仪表盘设计器 -> 任意仪表盘 -> 数据源头
        -----------------------------------------------------------------------------------------------------
        数据源名称:本地测试库
        数据库类型:MySQL5.5
        驱动类:com.mysql.jdbc.Driver
        数据源地址:jdbc:mysql://127.0.0.1:3307/jeecg-boot_20241201_online?characterEncoding=UTF-8&useUnicode=true&useSSL=false
        用户名:root
        密码:123456

01.环境搭建
    a.前端环境
        node v20.15.0
        pnpm store prune
        pnpm install
    b.后端环境
        JDK17
        maven3.9.8
        Mysql8.0
        Redis 3.0.504
    c.开发工具
        IDEA后端开发工具
        Webstorm前端开发工具
        Navicat数据库连接工具

02.启动JAVA项目:jeecg-boot
    a.初始化数据库,要求 mysql5.7+
        执行Sql脚本: jeecg-boot/db/jeecgboot-mysql-5.7.sql
        脚本作用:会自动创建库jeecg-boot, 并初始化数据
    b.安装Maven依赖
        通过右侧父POM进行install(下载依赖和打包)
    c.修改配置文件
        jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml
        -----------------------------------------------------------------------------------------------------
        datasource:
          master:
            url: jdbc:mysql://127.0.0.1:3307/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
            username: root
            password: 123456
            driver-class-name: com.mysql.cj.jdbc.Driver
        -----------------------------------------------------------------------------------------------------
        #redis 配置
        redis:
          database: 0
          host: 127.0.0.1
          port: 6379
          password: myslayers
        #分布式锁
        redisson:
          address: 127.0.0.1:6379
          password: myslayers
          type: STANDALONE
          enabled: true
    d.启动项目
        jeecg-system-start/src/main/java/org/jeecg/JeecgSystemApplication.java
    e.接口文档
        http://localhost:8080/jeecg-boot/doc.html

03.启动VUE项目:jeecgboot-vue3
    a.下载前端依赖
        pnpm store prune
        执行命令 pnpm install 或者双击 pinstall
    b.配置后台接口
        修改接口地址 .env.development
        -----------------------------------------------------------------------------------------------------
        # 跨域代理,您可以配置多个, 请注意没有换行符
        #后台接口全路径地址(必填)
        VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
        VITE_GLOB_DOMAIN_URL=http://localhost:8080/jeecg-boot
    c.启动前端项目
        npm run dev
    d.访问
        http://localhost:3100
        admin/123456

04.MongoDB配置
    a.MongoDB的yml配置
        spring:
          data:
            mongodb:
              uri: mongodb://账号:密码@127.0.0.1:27017/数据库名称?readPreference=secondaryPreferred&maxIdleTimeMS=60000&waitQueueTimeoutMS=2000&minPoolSize=5&maxPoolSize=100&maxLifeTimeMS=0&connectTimeoutMS=2000&socketTimeoutMS=2000
              print: true
              slowQuery: true
              slowTime: 1000
    b.配置MongoDB连接池
        spring.data.mongodb.uri=mongodb://username:[email protected]:27017,192.168.1.2:27017,192.168.1.3:27017/jeecg?readPreference=secondaryPreferred&maxIdleTimeMS=60000&waitQueueTimeoutMS=2000&minPoolSize=5&maxPoolSize=100&maxLifeTimeMS=0&connectTimeoutMS=2000&socketTimeoutMS=2000

10.6 macro

00.汇总
    mall                           一个电商后台管理系统的后端项目,基于SpringBoot+MyBatis实现,采用Docker容器化部署。前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。
    mall-admin-web                 一个电商后台管理系统的前端项目,基于Vue+Element实现。主要包括商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等功能。
    mall-app-web                   基于uni-app实现。主要包括首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等功能。
    ---------------------------------------------------------------------------------------------------------
    mall-tiny                      一款基于SpringBoot+MyBatis-Plus的快速开发脚手架,拥有完整的权限管理功能,可对接Vue前端,开箱即用。
    mall-swarm                     mall-swarm是一套微服务商城系统,采用了 Spring Cloud 2021 & Alibaba、Spring Boot 2.7、Oauth2、MyBatis、Elasticsearch、Docker、Kubernetes等核心技术,同时提供了基于Vue的管理后台方便快速搭建系统。

01.mall、mall-admin-web、mall-app-web(Mysql、Redis、Elasticsearch、Kibana、Logstash、MongoDB、RabbitMQ、MinIO、OSS)
    a.mall
        mall-admin
        启动项目:直接运行com.macro.mall.MallAdminApplication的main方法即可;
        接口文档地址:http://localhost:8080/swagger-ui/
        -----------------------------------------------------------------------------------------------------
        mall-search
        启动项目:直接运行com.macro.mall.search.MallSearchApplication的main方法即可;
        接口文档地址:http://localhost:8081/swagger-ui/
        使用前需要先调用接口导入数据;http://localhost:8081/esProduct/importAll
        如出现无法启动的问题,可以先删除Elasticsearch里面的数据再启动
        -----------------------------------------------------------------------------------------------------
        mall-portal
        启动mall-portal项目:直接运行com.macro.mall.portal.MallPortalApplication的main方法即可;
        接口文档地址:http://localhost:8085/swagger-ui/
    b.mall-admin-web
        http://localhost:8090
        admin
        macro123
    c.mall-app-web
        http://localhost:8060
        member
        member123

02.mall-swarm、mall-admin-web、mall-app-web(Mysql、Redis、Elasticsearch、Kibana、Logstash、MongoDB、RabbitMQ、MinIO、OSS)
    a.mall-swarm
        mall-swarm项目启动有先后顺序,大家可以按照以下顺序启动。
        启动网关服务mall-gateway,直接运行MallGatewayApplication的main函数即可;
        启动认证中心mall-auth,直接运行MallAuthApplication的main函数即可;
        启动后台管理服务mall-admin,直接运行MallAdminApplication的main函数即可;
        启动前台服务mall-portal,直接运行MallPortalApplication的main函数即可;
        启动搜索服务mall-search,直接运行MallSearchApplication的main函数即可;
        启动监控中心mall-monitor,直接运行MallMonitorApplication的main函数即可;
        -----------------------------------------------------------------------------------------------------
        运行完成后可以通过监控中心查看监控信息,账号密码为macro:123456:http://localhost:8101
        运行完成后可以直接通过如下地址访问API文档:http://localhost:8201/doc.html
        -----------------------------------------------------------------------------------------------------
        如何访问需要登录的接口,先调用认证中心接口获取token,后台管理client_id和client_secret为admin-app:123456,前台系统为portal-app:123456
        然后将token添加到请求头中,即可访问需要权限的接口了。
        -----------------------------------------------------------------------------------------------------
        注册中心服务信息,访问地址:http://localhost:8848/nacos/
        监控中心服务概览信息,访问地址:http://localhost:8101
        日志收集系统信息,访问地址:http://localhost:5601
    b.mall-admin-web
        访问在线接口无需搭建后台环境,只需将config/dev.env.js文件中的BASE_API改为https://admin-api.macrozheng.com即可
        如果你对接的是mall-swarm 微服务后台的话,所有接口都需要通过网关访问,需要将config/dev.env.js文件中的BASE_API改为 http://localhost:8201/mall-admin
        -----------------------------------------------------------------------------------------------------
        http://localhost:8090
        admin
        macro123
    c.mall-app-web
        http://localhost:8060
        member
        member123

03.mall-tiny、mall-admin-web(Mysql、Redis、Elasticsearch、Kibana、Logstash、MongoDB、RabbitMQ、MinIO、OSS)
    a.mall-tiny
        mall-tiny
        启动项目:直接运行com.macro.mall.tiny.MallTinyApplication的main方法即可;
        接口文档地址:http://localhost:8080/swagger-ui/
    b.mall-admin-web
        访问在线接口无需搭建后台环境,只需将config/dev.env.js文件中的BASE_API改为https://admin-api.macrozheng.com即可
        如果你对接的是mall-swarm 微服务后台的话,所有接口都需要通过网关访问,需要将config/dev.env.js文件中的BASE_API改为 http://localhost:8201/mall-admin
        -----------------------------------------------------------------------------------------------------
        http://localhost:8090
        admin
        macro123

10.7 maku

01.maku-admin-4.3.0
    # 克隆项目
    git clone https://gitee.com/makunet/maku-admin.git
    # 进入项目
    cd maku-admin
    # 安装依赖
    npm install
    # 运行项目
    npm run dev
    # 打包发布
    npm run build

02.maku-boot-4.3.0
    spring:
      data:
        redis:
          database: 1
          host: localhost
          port: 6379
          password: myslayers
          #timeout: 6000ms  # 连接超时时长(毫秒)
      datasource:
        dynamic:
          hikari: # Hikari 连接池全局配置
            connection-timeout: 30000     # 等待连接池分配链接的最大时长(毫秒),超过这个时长还没有可用的连接则发生 SQLException,默认:30 秒
            minimum-idle: 2               # 最小空闲连接数
            maximum-pool-size: 10         # 最大连接数
            idle-timeout: 600000          # 连接超时的最大时长(毫秒),超时则被释放(retired),默认:10 分钟
            max-lifetime: 1800000         # 连接的生命时长(毫秒),超时而且没被使用则被释放(retired),默认: 30 分钟
            connection-test-query: SELECT 1
          primary: master
          datasource:
            master:
              # MySQL8
              driver-class-name: com.mysql.cj.jdbc.Driver
              url: jdbc:mysql://localhost:3307/maku_boot?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
              username: root
              password: 123456

10.8 newbee

00.汇总
    newbee-mall                    初始版本、Spring Boot、Thymeleaf、MyBatis、MySQL                                  从0开始动手搭建企业级项目
    newbee-mall-plus               升级版本、优惠券、秒杀、支付、Spring Boot、Thymeleaf、MyBatis、MySQL、Redis
    newbee-mall-cloud              微服务版本、分布式事务、Spring Cloud Alibaba、Nacos、Sentinel、OpenFeign、Seata
    ---------------------------------------------------------------------------------------------------------
    newbee-mall-api                前后端分离、Spring Boot、MyBatis、Swagger、MySQL                                  大型前后端分离项目实战
    newbee-mall-api-go             前后端分离、Go、Gin、MySQL
    newbee-mall-vue-app            前后端分离、Vue2、Vant
    newbee-mall-vue3-app           前后端分离、Vue3、Vue-Router4、Vuex4、Vant3
    vue3-admin                     前后端分离、Vue3、Element-Plus、Vue-Router4、Vite                                 大型前后端分离项目实战

01.newbee-mall(mysql)
    a.配置
        a.后端
            spring.datasource.url=jdbc:mysql://localhost:3306/newbee_mall?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&autoReconnect=true&useSSL=false&allowMultiQueries=true
            spring.datasource.username=root
            spring.datasource.password=123456
        b.前端
            无
    b.运行
        http://127.0.0.1:28089/login
        15135890769
        123456
        -----------------------------------------------------------------------------------------------------
        http://127.0.0.1:28089/admin
        admin
        123456

02.newbee-mall-api、vue3-admin(mysql)
    a.配置
        a.后端
            spring.datasource.url=jdbc:mysql://localhost:3306/newbee_mall_api?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&autoReconnect=true&useSSL=false&allowMultiQueries=true
            spring.datasource.username=root
            spring.datasource.password=123456
        b.前端
            无
    b.运行
        http://127.0.0.1:3000/admin
        admin
        123456

10.9 pig

01.pig-jdk17_3.8.2
    a.前端
        nvm use 20.10.0
        npm install
        npm run dev
        -----------------------------------------------------------------------------------------------------
        http://localhost:8888
        admin
        123456
    b.后端
        spring:
          cache:
            type: redis # 缓存类型 Redis
          data:
            redis:
              host: pig-redis  # Redis地址
              password: myslayers # Redis密码,没有留空
              port: 6379  # Redis端口
          # 数据库相关配置
          datasource:
            driver-class-name: com.mysql.cj.jdbc.Driver
            username: root
            password: 123456
            url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
        -----------------------------------------------------------------------------------------------------
        IDEA -> maven -> 配置文件:选择boot
        PigAdminApplication
        PigAuthApplication
        PigBootApplication:端口9999
        PigCodeGenApplication
        PigGatewayApplication
        PigMonitorApplication
        PigNacosApplication
        PigQuartzApplication

10.10 qing

01.pure-boot-vue3
    a.配置
        a.后端
            url: jdbc:mysql://localhost:3306/pure-boot-vue3?serverTimezone=GMT%2b8
            username: root
            password: 123456
            -------------------------------------------------------------------------------------------------
            file:
              download:
                ip: localhost
        b.前端
            const request = axios.create({                                            --request.js
                baseURL: 'http://localhost:8765',
                timeout: 5000
            })
    b.运行
        a.后端
            http://localhost:8765                                                     --后端接口
        b.前端
            http://localhost:7000/                                                    --页面:后台
            admin
            admin

02.pure-design-vip
    a.配置
        a.后端
            url: jdbc:mysql://localhost:3306/pure-design-vip?serverTimezone=GMT%2b8   --JDK8/MySQL5.7.25
            username: root
            password: 123456
            -------------------------------------------------------------------------------------------------
            files:
              upload:
                path: C:/files/
        b.前端
            const request = axios.create({                                            --request.js
                baseURL: 'http://localhost:9090',
                timeout: 5000
            })
        c.数据库-示例
            CREATE TABLE `book` (
              `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',                     --字段固定
              `name` varchar(255) DEFAULT NULL COMMENT '名称',                       --字段固定
              `time` varchar(50) DEFAULT NULL COMMENT '生产时间',                    --字段固定
              `date` varchar(50) DEFAULT NULL COMMENT '出版日期',                    --字段固定
              `img` varchar(255) DEFAULT NULL COMMENT '图片',                        --字段固定
              `file` varchar(255) DEFAULT NULL COMMENT '文件',                       --字段固定
              PRIMARY KEY (`id`) USING BTREE
            ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
    b.运行
        a.后端
            http://localhost:8765                                                   --后端接口
        b.前端
            http://localhost:8080/                                                  --页面:后台
            admin
            admin
            -------------------------------------------------------------------------------------------------
            http://localhost:8080/front/                                            --页面:前台

03.x-admin-vue
    a.配置
        a.后端
            url: jdbc:mysql://localhost:3306/x-admin-vue?serverTimezone=GMT%2b8     --JDK8/MySQL5.7.25
            username: root
            password: 123456
        b.前端
            const BASE_URL = "http://localhost:9999/"                               --request.js
            -------------------------------------------------------------------------------------------------
            module.exports = {                                                      --vue.config.js
                publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
                outputDir: 'dist',
                devServer: {
                    host: '0.0.0.0',
                    port: 8001,
                    open: true,
                    proxy: {
                        "/api": {
                            target: 'http://localhost:9999',
                            secure: false,
                            changeOrigin: true,
                            pathRewrite: {
                                '^/api': ''
                            },
                        }
                    },
                    disableHostCheck: true
                },
            }
        c.数据库-示例
            CREATE TABLE `words` (
              `id` bigint(20) NOT NULL COMMENT 'id',                                --字段固定
              `name` varchar(255) DEFAULT NULL COMMENT '名称',                      --字段固定
              `date` varchar(255) DEFAULT NULL COMMENT '日期',                      --字段固定
              `time` varchar(255) DEFAULT NULL COMMENT '时间',                      --字段固定
              `sex_radio` varchar(1) DEFAULT NULL COMMENT '男,女',                 --字段固定
              `user_rel` varchar(255) DEFAULT NULL COMMENT '用户',                  --字段固定
              `file` varchar(255) DEFAULT NULL COMMENT '文件',                      --字段固定
              `img` varchar(255) DEFAULT NULL COMMENT '图片',                       --字段固定
              PRIMARY KEY (`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    b.运行
        a.后端
            http://localhost:9999                                                   --后端接口
        b.前端
            http://localhost:8001/manage/                                           --页面:后台
            admin
            admin
            -------------------------------------------------------------------------------------------------
            http://localhost:8001/front/                                            --页面:前台

04.audit
    a.后端
        url: jdbc:mysql://localhost:3306/audit?serverTimezone=GMT%2b8
        username: root
        password: 123456
    b.运行
        a.后端
            http://localhost:8765                                                   --后端接口
        b.前端
            http://localhost:8080/                                                  --页面:后台
            admin
            admin
            -------------------------------------------------------------------------------------------------
            http://localhost:8080/front/                                            --页面:前台

05.cart-order
    a.后端
        url: jdbc:mysql://localhost:3306/cart-order?serverTimezone=GMT%2b8
        username: root
        password: 123456
    b.运行
        a.后端
            http://localhost:8765                                                   --后端接口
        b.前端
            http://localhost:8080/                                                  --页面:后台
            admin
            admin
            -------------------------------------------------------------------------------------------------
            http://localhost:8080/front/                                            --页面:前台

06.mall-order
    a.后端
        url: jdbc:mysql://localhost:3306/mall-order?serverTimezone=GMT%2b8
        username: root
        password: 123456
    b.运行
        a.后端
            http://localhost:8765                                                   --后端接口
        b.前端
            http://localhost:8080/                                                  --页面:后台
            admin
            admin
            -------------------------------------------------------------------------------------------------
            http://localhost:8080/front/                                            --页面:前台

10.11 resuse

01.reuse
    spring:
      application:
        name: reuse_market
      datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://127.0.0.1:3307/reuse?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
        username: root
        password: 123456
      redis:
        host: 127.0.0.1
        port: 6379
        lettuce:
          pool:
            max-active: 8
            min-idle: 0
            max-wait: 100
        password: myslayers
      servlet:
        multipart:
          max-file-size: 10MB
          max-request-size: 10MB

02.reuse-admin
    # 克隆项目
    git clone https://gitee.com/zyh0525/reuse_market_admin.git
    # 进入项目
    cd reuse-admin
    # 安装依赖
    npm install
    # 运行项目
    npm run dev
    # 打包发布
    npm run build

10.12 ruoyi

01.RuoYi-v4.7.5(JDK8)
    a.配置
        a.后端
            datasource:
                master:
                  url: jdbc:mysql://localhost:3306/ruoyi-v4.7.5?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                  username: root
                  password: 123456

        b.前端
            无
    b.运行
        a.后端
            http://127.0.0.1:8080/                                                  --后端接口
        b.前端
            http://localhost:80                                                     --页面:后台
            admin / admin123
            ry    / admin123

02.RuoYi-Vue-v3.8.4(JDK8)
    a.配置
        a.后端
            datasource:
                master:
                  name: tent
                  # MySQL Connector/J 8.X 连接的示例
                  url: jdbc:mysql://127.0.0.1:3307/ry-vue?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true
                  username: root
                  password: 123456

                  # MySQL Connector/J 5.X 连接的示例1
                  url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                  username: root
                  password: 123456

                  # MySQL Connector/J 5.X 连接的示例2
                  # url: jdbc:mysql://127.0.0.1:3306/ry-vue?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
                  username: root
                  password: 123456

                  # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name}
                  # url: jdbc:oracle:thin:@127.0.0.1:1521:xe
                  # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name}
                  username: root
                  password: 123456
            redis:
                host: 127.0.0.1
                port: 6379
                database: 0
                password: myslayers
        b.前端
            无
    b.运行
        a.后端
            http://127.0.0.1:8080/                                                  --后端接口
        b.前端
            http://localhost:80                                                     --页面:后台
            admin / admin123
            ry    / admin123

03.RuoYi-Cloud-v3.6.1(JDK8)
    a.数据库
        创建数据库ry-cloud,并导入数据脚本【ry_2021xxxx.sql(必须),quartz.sql(可选)】
        创建数据库ry-config,并导入数据脚本【ry_config_2021xxxx.sql(必须)】
        -----------------------------------------------------------------------------------------------------
        配置nacos持久化,修改conf/application.properties文件,增加支持mysql数据源配置
        spring.datasource.platform=mysql
        db.num=1
        db.url.0=jdbc:mysql://localhost:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
        db.user=root
        db.password=123456
        -----------------------------------------------------------------------------------------------------
        集成seata分布式事务(可选配置,默认不启用)
        创建数据库ry-seata并导入数据脚本ry_seata_2021xxxx.sql
    b.nacos
        a.conf目录
            nacos-mysql.sql                                                         --初始化SQL
            application.properties                                                  --配置数据库
        b.配置conf
            spring.datasource.platform=mysql
            db.num=1
            db.url.0=jdbc:mysql://localhost:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
            db.user=root
            db.password=123456
        c.启动并访问
            C:\software\nacos\bin\startup.cmd -m standalone                         --standalone指定为单机模式,否则以cluster集群模式启动
            -------------------------------------------------------------------------------------------------
            http://localhost:8848/nacos
            nacos/nacos
    c.运行
        a.后端
            RuoYiGatewayApplication (网关模块 必须)       8080
            RuoYiAuthApplication    (认证模块 必须)       9200
            RuoYiSystemApplication  (系统模块 必须)       9201
            -------------------------------------------------------------------------------------------------
            RuoYiMonitorApplication (监控中心 可选)       9100
            RuoYiGenApplication     (代码生成 可选)       9202
            RuoYiJobApplication     (定时任务 可选)       9203
            RuoYFileApplication     (文件服务 可选)       9300
        b.前端
            http://localhost:80                                                     --页面:后台
            admin / admin123
            ry    / admin123
            -------------------------------------------------------------------------------------------------
            http://localhost:8848/                                                  --NACOS
            nacos
            nacos
            -------------------------------------------------------------------------------------------------
            http://localhost:9100/                                                  --若依服务状态监控
            ruoyi
            123456
            -------------------------------------------------------------------------------------------------
            http://localhost:8080/swagger-ui/index.html                             --代码生成接口文档

04.RuoYi-Vue-Plus-5.X(JDK17)
    a.配置
        a.后端
            master:
              type: ${spring.datasource.type}
              driverClassName: com.mysql.cj.jdbc.Driver
              # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
              # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
              url: jdbc:mysql://localhost:3306/ruoyi-vue-plus-5?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
              username: root
              password: 123456
            spring.data:
              redis:
                # 地址
                host: localhost
                # 端口,默认为6379
                port: 6379
                # 数据库索引
                database: 0
                # redis 密码必须配置
                password: myslayers
                # 连接超时时间
                timeout: 10s
                # 是否开启ssl
                ssl.enabled: false
        b.前端
            无
    b.运行
        a.后端
            http://127.0.0.1:8080/                                                  --后端接口
        b.前端
            http://localhost:80                                                     --页面:后台
            admin / admin123
            test  / 666666

05.ruoyi-vue-pro(JDK8)
    a.配置
        a.后端
            master:
              url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
              #          url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
              #          url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
              #          url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
              #          url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true;useUnicode=true;characterEncoding=utf-8 # SQLServer 连接的示例
              #          url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
              #          url: jdbc:kingbase8://127.0.0.1:54321/test  # 人大金仓 KingbaseES 连接的示例
              #          url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
              username: root
              password: 123456
              #          username: sa # SQL Server 连接的示例
              #          password: Yudao@2024 # SQL Server 连接的示例
              #          username: SYSDBA # DM 连接的示例
              #          password: SYSDBA001 # DM 连接的示例
              #          username: root # OpenGauss 连接的示例
              #          password: Yudao@2024 # OpenGauss 连接的示例
            slave: # 模拟从库,可根据自己需要修改
              lazy: true # 开启懒加载,保证启动速度
              url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
              username: root
              password: 123456
            redis:
              host: 127.0.0.1 # 地址
              port: 6379 # 端口
              database: 0 # 数据库索引
              password: myslayers # 密码,建议生产环境开启
        b.前端
            yudao-demo:经添加src文件夹后,项目可以运行
            yudao-mall-uniapp:基于 uni-app 实现的商城小程序
            yudao-ui-admin-uniapp:基于 Vue2 + element-ui 实现的管理后台
            yudao-ui-admin-vben:基于 Vue3 + vben(ant-design-vue) 实现的管理后台
            yudao-ui-admin-vue2:基于 Vue2 + element-ui 实现的管理后台
            yudao-ui-admin-vue3:基于 Vue3 + element-plus 实现的管理后台
            yudao-ui-go-vie:基于 Vue3 + naive-ui 实现的大屏报表
        c.说明2.1.0
            工作流模块 yudao-module-bpm     bpm-2024-03-24.sql
            报表模块   yudao-module-report  jimureport.mysql5.7.create.sql(报表设计器)
                                           报错(已解决):Lost connection to MySQL server during query         https://developer.aliyun.com/article/1371311,选中数据库 -> 右键编辑连接 ->选择高级,配置限制连接会话和保持连接间隔(秒)均为2400,建议1000。
                                           报错(已解决):Got a packet bigger than ‘max_allowed_packet‘ bytes  https://blog.csdn.net/qq_31083947/article/details/127666353,执行 set global max_allowed_packet = 1048576*10;
            报表模块   yudao-module-report  go-view.sql(大屏设计器)
            支付系统   yudao-module-pay     pay-2024-01-05.sql
            会员模块   yudao-module-member  member-2024-01-18.sql(公众号登录、小程序登录)
            商城系统   yudao-module-mall    mall-2024-07-22-芋道版权所有.sql
            ERP 系统   yudao-module-erp     erp-2024-05-03.sql
            CRM 系统   yudao-module-crm     crm-2024-02-26.sql
                                           报错(已解决):utf8mb4_0900_ai_ci,打开sql文件,将全部utf8mb4_0900_ai_ci变为utf8mb4_unicode_ci
            AI 大模型  yudao-module-ai      ai-2024-07-07.sql,ai 需要使用 master-jdk17 分支
                                           报错(已解决):utf8mb4_0900_ai_ci,打开sql文件,将全部utf8mb4_0900_ai_ci变为utf8mb4_unicode_ci
            公众号模块 yudao-module-mp      mp-2024-05-29.sql(公众号)
            -------------------------------------------------------------------------------------------------
            一次不能启动太多模块,莫名原因,导致无法启动
            -------------------------------------------------------------------------------------------------
            下面说明,废弃,仅保存历史问题
            商城系统   yudao-module-mall    无法启动该模块,java: No target bean properties found: can't map Collection element "BrokerageWithdrawDO list" to "AppBrokerageWithdrawRespVO list".
            AI 大模型  yudao-module-ai      无法启动该模块,因为org.springframework.ai:spring-ai-zhipuai-spring-boot-starter:1.0.0-M1无法下载
            CRM 系统   yudao-module-crm     无法启动该模块,程序包cn.iocoder.yudao.module.bpm.api.task不存在
    b.运行
        a.后端
            http://127.0.0.1:8080/                                                  --后端接口
        b.前端:yudao-demo:经添加src文件夹后,项目可以运行
            http://localhost:80                                                     --页面:后台
            admin / admin123
        c.前端:yudao-mall-uniapp
            npm install
            运行 -> 运行到内置浏览器
        d.前端:yudao-ui-admin-uniapp
            npm install
            运行 -> 运行到内置浏览器
        e.前端:yudao-ui-admin-vben
            pnpm install
            npm run dev
            -------------------------------------------------------------------------------------------------
            pnpm install
            pnpm dev
        f.前端:yudao-ui-admin-vue2
            yarn install
            npm run local
        g.前端:yudao-ui-admin-vue3(定)
            pnpm install
            npm run dev
            -------------------------------------------------------------------------------------------------
            pnpm store prune
            pnpm install
            npm run dev
            pnpm add @babel/plugin-transform-typescript
        h.前端:yudao-ui-go-view
            pnpm install
            npm run dev
    c.JDK
        jdk1.6.0_45
        jdk1.7.0_80
        jdk1.8.0_172
        jdk-1.8.0_281
        jdk-1.8.0_291
        jdk-11.0.11
        jdk-17.0.5
        -----------------------------------------------------------------------------------------------------
        yudao-demo_2.3.0              汇总                                             分类1
        yudao-mall-uniapp_2.3.0       基于 uni-app 实现的商城小程序                     分类2
        yudao-ui-admin-uniapp_2.3.0   基于 Vue2 + element-ui 实现的管理后台             分类3
        yudao-ui-admin-vben_2.3.0     基于 Vue3 + vben(ant-design-vue) 实现的管理后台   分类3
        yudao-ui-admin-vue2_2.3.0     基于 Vue2 + element-ui 实现的管理后台             分类3
        yudao-ui-admin-vue3_2.3.0     基于 Vue3 + element-plus 实现的管理后台           分类3
        yudao-ui-go-view_2.3.0        基于 Vue3 + naive-ui 实现的大屏报表               分类4  大屏报表
        -----------------------------------------------------------------------------------------------------
        Java 后端:master 分支为 JDK 8 + Spring Boot 2.7,master-jdk17 分支为 JDK 17/21 + Spring Boot 3.2
        管理后台的电脑端:Vue3 提供 element-plus、vben(ant-design-vue)两个版本,Vue2 提供 element-ui版本
        管理后台的移动端:采用 uni-app方案,一份代码多终端适配,同时支持 APP、小程序、H5!
        -----------------------------------------------------------------------------------------------------
        help -> Show Log in Explorer -> C:\Users\mysla\AppData\Local\JetBrains\IntelliJIdea2024.2\log\idea.log
        文件扩展名太长:编辑器 -> 修改选项 -> Java -> 缩短命令行:类路径文件
        若启动报Application错误,maven使用clear后,compile编译,然后启动
        -----------------------------------------------------------------------------------------------------
        yudao-ui-admin-vue3_2.3.0
        目前位于D:\software_zare\workspace_ruoyi下,
        测试后,发行放到D:\software_zare\workspace_ruoyi\ruoyi-vue-pro_2.3.0_ui下,多了一层文件夹,启动报错
    d.ruoyi-vue-pro_2.3.0
        ruoyi-vue-pro_2.3.0_abc              abc代表全部功能开启,即ai、bpm、crm、erp、member、pay、mall、mp、report
        ruoyi-vue-pro_2.3.0_ai_17            + yudao-ui-admin-vue3
        ruoyi-vue-pro_2.3.0_bpm_crm          + yudao-ui-admin-vue3
        ruoyi-vue-pro_2.3.0_erp              + yudao-ui-admin-vue3
        ruoyi-vue-pro_2.3.0_member_pay_mall  + yudao-ui-admin-vue3 + yudao-mall-uniapp_2.3.0
        ruoyi-vue-pro_2.3.0_mp               + yudao-ui-admin-vue3
        ruoyi-vue-pro_2.3.0_report           + yudao-ui-admin-vue3 + yudao-ui-go-view
        -----------------------------------------------------------------------------------------------------
        经测试,JDK8推荐jdk-1.8.0_291,JDK17推荐jdk-11.0.11。其中JDK11不能替代JDK8,必须特定JDK版本
    e.ruoyi-vue-cloud_2.3.0
        第1步:gateway、system、infra
        第2步:bpm、crm
        第2步:erp
        第2步:member、pay、mall ->  ProductServerApplication、 TradeServerApplication、PromotionServerApplication、StatisticsServerApplication
        第2步:mp
        第2步:report
        -----------------------------------------------------------------------------------------------------
        经测试,JDK8推荐jdk-1.8.0_291,JDK17推荐jdk-11.0.11。其中JDK11不能替代JDK8,必须特定JDK版本
        -----------------------------------------------------------------------------------------------------
        README.md同级的pom.xml,添加如下内容。
        添加原因:jdk-1.8.0_291移除了下述jar包,故有此补丁。
        也可更换除jdk-1.8.0_291外的JDK8版本
        <dependencies>
          <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
          </dependency>
          <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <version>3.0.2</version>
          </dependency>
          <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>2.1.1</version>
          </dependency>
          <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version> <!-- 检查最新版本 -->
          </dependency>
        </dependencies>

06.RuoYi-Vue-Oracle-3.8.4
    a.启动
        RuoYiApplication
        -----------------------------------------------------------------------------------------------------
        nvm use 14.16.1
        npm install
        npm run dev
    b.访问
        http://127.0.0.1:80
        admin
        123456
        -----------------------------------------------------------------------------------------------------
        http://127.0.0.1:8080/demo01/index.html
        http://127.0.0.1:8080/demo02/index.html
        -----------------------------------------------------------------------------------------------------
        http://localhost:3100/vilgo/demo21
        http://localhost:3100/vilgo/demo22
    c.其他命令
        vue inspect > output.js
        npm run build

07.ruoyi-vue-aidex-sharp
    a.启动
        RuoYiApplication
        -----------------------------------------------------------------------------------------------------
        nvm use 14.16.1
        npm install
        npm run dev
    b.访问
        http://127.0.0.1:80
        admin
        123456
        -----------------------------------------------------------------------------------------------------
        http://127.0.0.1:8080/demo01/index.html
        http://127.0.0.1:8080/demo02/index.html
        -----------------------------------------------------------------------------------------------------
        http://localhost:3100/vilgo/demo21
        http://localhost:3100/vilgo/demo22

10.13 smallc

01.介绍
    Sword                    前端框架Sword(基于React)
    Saber                    前端框架Saber(基于Vue2)
    Saber-3.x                前端框架Saber3(基于Vue3)
    SpringBootBlade          后端SpringBoot版
    SpringCloudBlade         后端SpringCloud版

02.快速开始
    a.Sword
        npm install
        npm start
        npm run start:mock
        npm run start:no-mock
        -----------------------------------------------------------------------------------------------------
        http://localhost:1888/
        admin
        admin
    b.Saber-3.x
        npm install
        npm dev
        -----------------------------------------------------------------------------------------------------
        http://localhost:2888/
        admin
        admin
    c.SpringBootBlade
        由于升级了JDK17,Java 模块化系统(Java Module System)的安全限制导致的针对反射等场景有可能会出现如下错误:
        Cause: java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h accessible: module java.base does not "opens java.lang.reflect" to unnamed module @223aa2f7
        -----------------------------------------------------------------------------------------------------
        这种情况,我们需要在启动时增加对应配置:
        --add-opens java.base/java.lang.reflect=ALL-UNNAMED