RuoYi-v4.2 前缀

00x0 目录结构

固定模块生效子pom.xml引用插件,子pom.xml中的东西只有这个模块能用。

在子模块的 pom.xml 里声明的依赖(<dependencies>)或插件(<plugins>),默认只对当前模块自己生效。其他模块如果也想用,必须显式地在自己的 pom.xml 里也写一遍,或者依赖于当前模块。

00x1 数据库连接

复制代码
# 数据源配置
spring:
    datasource:
#阿里druid作为数据库连接池
        type: com.alibaba.druid.pool.DruidDataSource
#数据库驱动类
        driverClassName: com.mysql.cj.jdbc.Driver
        druid:
            # 主库数据源
            master:
                url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                username: root
                password: 123456
            # 从库数据源
            #关闭读写分离
            slave:
                # 从数据源开关/默认关闭
                enabled: false
                url: 
                username: 
                password: 
            # 初始连接数
            initialSize: 5
            # 最小连接池数量
            minIdle: 10
            # 最大连接池数量
            maxActive: 20
            # 配置获取连接等待超时的时间
            maxWait: 60000
            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
            timeBetweenEvictionRunsMillis: 60000
            # 配置一个连接在池中最小生存的时间,单位是毫秒
            minEvictableIdleTimeMillis: 300000
            # 配置一个连接在池中最大生存的时间,单位是毫秒
            maxEvictableIdleTimeMillis: 900000
            # 配置检测连接是否有效
            validationQuery: SELECT 1 FROM DUAL
            testWhileIdle: true
            testOnBorrow: false
            testOnReturn: false
#统计url访问
            webStatFilter: 
                enabled: true
#数据可视化
            statViewServlet:
#自动注册加载功能
                enabled: true
                # 设置白名单,不填则允许所有访问
                allow:
#访问路由,自动注册的路由
#自动把url-pattern里面的注册
                url-pattern: /druid/*
                # 控制台管理用户名和密码,默认空
                login-username: 
                login-password:
#日志记录,他是记录到某个日志中, 日志文件路径:默认输出到项目根目录下的 logs/ 文件夹中,文件名通常为 ruoyi.log 或 sys-console.log。 
            filter:
                stat:
                    enabled: true
                    # 慢SQL记录
                    log-slow-sql: true
                    slow-sql-millis: 1000
                    merge-sql: true
#防火墙过滤,sql
                wall:
                    config:
#允许一次执行多个sql
                        multi-statement-allow: true

00x2 报错

复制代码
E:\IntelliJ IDEA 2025.3.1\plugins\maven\lib\maven3\bin\mvn.cmd -Didea.version=2025.3.1 -Dmaven.ext.class.path=E:\IntelliJ IDEA 2025.3.1\plugins\maven\lib\maven-event-listener.jar -Djansi.passthrough=true -Dstyle.color=always -Dmaven.repo.local=C:\Users\jc\.m2\repository org.springframework.boot:spring-boot-maven-plugin:2.1.1.RELEASE:run -f pom.xml
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=GBK
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::staticFieldBase has been called by com.google.inject.internal.aop.HiddenClassDefiner (file:/E:/IntelliJ%20IDEA%202025.3.1/plugins/maven/lib/maven3/lib/guice-5.1.0-classes.jar)
WARNING: Please consider reporting this to the maintainers of class com.google.inject.internal.aop.HiddenClassDefiner
WARNING: sun.misc.Unsafe::staticFieldBase will be removed in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< com.ruoyi:ruoyi-admin >------------------------
[INFO] Building ruoyi-admin 4.2.0
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> spring-boot:2.1.1.RELEASE:run (default-cli) > test-compile @ ruoyi-admin >>>
[WARNING] 1 problem was encountered while building the effective model for org.javassist:javassist:jar:3.20.0-GA during dependency collection step for project (use -X to see details)
Downloading from central: https://repo.maven.apache.org/maven2/com/ruoyi/ruoyi-framework/4.2.0/ruoyi-framework-4.2.0.pom
Downloading from central: https://repo.maven.apache.org/maven2/com/ruoyi/ruoyi-quartz/4.2.0/ruoyi-quartz-4.2.0.pom
Downloading from central: https://repo.maven.apache.org/maven2/com/ruoyi/ruoyi-generator/4.2.0/ruoyi-generator-4.2.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.580 s
[INFO] Finished at: 2026-04-14T14:14:08+08:00
[INFO] ------------------------------------------------------------------------






[ERROR] Failed to execute goal on project ruoyi-admin: Could not collect dependencies for project com.ruoyi:ruoyi-admin:jar:4.2.0

[ERROR] Failed to read artifact descriptor for com.ruoyi:ruoyi-framework:jar:4.2.0

Blocked mirror 镜像被拦截
拦截http://maven.aliyun.com/nexus/content/groups/public/

[ERROR] 	Caused by: The following artifacts could not be resolved: com.ruoyi:ruoyi-framework:pom:4.2.0 (absent): Could not transfer artifact com.ruoyi:ruoyi-framework:pom:4.2.0 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [public (http://maven.aliyun.com/nexus/content/groups/public/, default, releases+snapshots)]

[ERROR] Failed to read artifact descriptor for com.ruoyi:ruoyi-quartz:jar:4.2.0
[ERROR] 	Caused by: The following artifacts could not be resolved: com.ruoyi:ruoyi-quartz:pom:4.2.0 (absent): Could not transfer artifact com.ruoyi:ruoyi-quartz:pom:4.2.0 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [public (http://maven.aliyun.com/nexus/content/groups/public/, default, releases+snapshots)]
[ERROR] Failed to read artifact descriptor for com.ruoyi:ruoyi-generator:jar:4.2.0
[ERROR] 	Caused by: The following artifacts could not be resolved: com.ruoyi:ruoyi-generator:pom:4.2.0 (absent): Could not transfer artifact com.ruoyi:ruoyi-generator:pom:4.2.0 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [public (http://maven.aliyun.com/nexus/content/groups/public/, default, releases+snapshots)]
[ERROR] 
[ERROR] -> [Help 1]
[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/DependencyResolutionException

mvn clean install

00x3 改数据库

复制代码
没有指定自动8.0
 <!-- Mysql驱动包 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

<properties>
	    <ruoyi.version>4.2.0</ruoyi.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
		<shiro.version>1.4.2</shiro.version>
		<thymeleaf.extras.shiro.version>2.0.0</thymeleaf.extras.shiro.version>
		<mybatis.boot.version>1.3.2</mybatis.boot.version>
		<druid.version>1.1.14</druid.version>
		<bitwalker.version>1.19</bitwalker.version>
		<kaptcha.version>2.3.2</kaptcha.version>
		<swagger.version>2.9.2</swagger.version>
		<pagehelper.boot.version>1.2.5</pagehelper.boot.version>
		<fastjson.version>1.2.60</fastjson.version>
		<oshi.version>3.9.1</oshi.version>
		<commons.io.version>2.5</commons.io.version>
		<commons.fileupload.version>1.3.3</commons.fileupload.version>
		<poi.version>3.17</poi.version>
		<velocity.version>1.7</velocity.version>
指定版本号
		<mysql-connector.version>5.1.47</mysql-connector.version>
	</properties>

<dependency>
				<groupId>mysql</groupId>
				<artifactId>mysql-connector-java</artifactId>
				<version>${mysql-connector.version}</version>
			</dependency>

自动8.0

这里我们父类重写了

00x4 启动成功

相关推荐
光影少年2 小时前
开发RN项目时,如何调试iOS真机、Android真机?常见调试问题排查?
android·前端·react native·react.js·ios
十六年开源服务商2 小时前
WordPress并发量优化实战:2026运维指南
android·运维
黄林晴2 小时前
Compose跨平台新版本来了!测试 API 全废弃,iOS 崩溃集中修复
android
Kapaseker2 小时前
Compose 响应式布局的最后一块拼图—Grid
android·kotlin
我命由我123452 小时前
Android buildSrc 模块问题:Gradle 的类 DefaultProject 被错误地尝试转换成 Apache Ant 的 Project 类
android·java·java-ee·kotlin·android jetpack·android-studio·android runtime
张风捷特烈3 小时前
GetX 之死 | 8 年从未用过,以后将不会再用
android·前端·flutter
黑牛儿3 小时前
2026 MySQL 面试 100 题: 索引 / 事务 / 锁(答案 + 原理)
android·mysql·面试
励志的小陈3 小时前
数据结构--堆(C语言实现)
android·c语言·数据结构
习惯就好zz3 小时前
RK3588 Android 12 修改 NTP 服务器:从资源覆盖到时间同步验证
android·运维·服务器·aosp·ntp