312 lines
13 KiB
XML
312 lines
13 KiB
XML
<?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>ruoyi</artifactId>
|
||
<groupId>com.ruoyi</groupId>
|
||
<version>4.7.5</version>
|
||
</parent>
|
||
<modelVersion>4.0.0</modelVersion>
|
||
<packaging>jar</packaging>
|
||
<artifactId>ruoyi-admin</artifactId>
|
||
|
||
<description>
|
||
web服务入口
|
||
</description>
|
||
|
||
<!--
|
||
分离打包(thin jar)所需的输出目录配置:
|
||
将最终可运行的应用 jar 输出到模块的 target/dist 目录;
|
||
依赖库(lib)将被复制到 target/dist/lib 下,部署时只需更新变更的 app.jar。
|
||
说明:使用 ${project.build.directory} 保证路径在当前模块下(Windows/Linux 通用)。
|
||
-->
|
||
<properties>
|
||
<outDir>${project.build.directory}/dist</outDir>
|
||
</properties>
|
||
|
||
<dependencies>
|
||
|
||
<!-- SpringBoot集成thymeleaf模板 -->
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||
</dependency>
|
||
|
||
<!-- spring-boot-devtools -->
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-devtools</artifactId>
|
||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||
</dependency>
|
||
|
||
<!-- swagger3-->
|
||
<dependency>
|
||
<groupId>io.springfox</groupId>
|
||
<artifactId>springfox-boot-starter</artifactId>
|
||
</dependency>
|
||
|
||
<dependency>
|
||
<groupId>com.google.code.gson</groupId>
|
||
<artifactId>gson</artifactId>
|
||
<version>2.8.0</version>
|
||
</dependency>
|
||
|
||
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||
<dependency>
|
||
<groupId>io.swagger</groupId>
|
||
<artifactId>swagger-models</artifactId>
|
||
<version>1.6.2</version>
|
||
</dependency>
|
||
|
||
<!-- Mysql驱动包 -->
|
||
<dependency>
|
||
<groupId>mysql</groupId>
|
||
<artifactId>mysql-connector-java</artifactId>
|
||
</dependency>
|
||
<!-- sqlservice -->
|
||
<dependency>
|
||
<groupId>com.microsoft.sqlserver</groupId>
|
||
<artifactId>mssql-jdbc</artifactId>
|
||
<version>8.2.2.jre8</version>
|
||
</dependency>
|
||
<!-- 使用Orcale 导入的两个jar包-->
|
||
<dependency>
|
||
<groupId>com.oracle</groupId>
|
||
<artifactId>ojdbc6</artifactId>
|
||
<version>11.2.0.3</version>
|
||
</dependency>
|
||
<!-- 核心模块-->
|
||
<dependency>
|
||
<groupId>com.ruoyi</groupId>
|
||
<artifactId>ruoyi-framework</artifactId>
|
||
</dependency>
|
||
|
||
<!-- 引入 Spring Boot 测试起步依赖,提供 @SpringBootTest 等测试注解与上下文支持
|
||
说明:当前测试编译报错“程序包 org.springframework.boot.test.context 不存在”,
|
||
是因为缺少 spring-boot-test 相关依赖。starter 会自动引入 spring-boot-test、
|
||
spring-boot-test-autoconfigure、spring-test 等,解决无法识别 @SpringBootTest 的问题。 -->
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-test</artifactId>
|
||
<scope>test</scope>
|
||
<!-- 关闭 Vintage 引擎,避免与 JUnit5 冲突(仅运行 Jupiter 测试) -->
|
||
<exclusions>
|
||
<exclusion>
|
||
<groupId>org.junit.vintage</groupId>
|
||
<artifactId>junit-vintage-engine</artifactId>
|
||
</exclusion>
|
||
</exclusions>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.junit.jupiter</groupId>
|
||
<artifactId>junit-jupiter</artifactId>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
|
||
<!-- 单元测试依赖:JUnit5 API 与 Engine,确保测试可运行 -->
|
||
<dependency>
|
||
<groupId>org.junit.jupiter</groupId>
|
||
<artifactId>junit-jupiter-api</artifactId>
|
||
<version>5.8.2</version>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.junit.jupiter</groupId>
|
||
<artifactId>junit-jupiter-engine</artifactId>
|
||
<version>5.8.2</version>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
|
||
<!-- 引入 Mockito(Java 8 兼容版本 3.12.4),用于 Mock 依赖 -->
|
||
<dependency>
|
||
<groupId>org.mockito</groupId>
|
||
<artifactId>mockito-core</artifactId>
|
||
<version>3.12.4</version>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.mockito</groupId>
|
||
<artifactId>mockito-junit-jupiter</artifactId>
|
||
<version>3.12.4</version>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
|
||
<!-- 显式指定 JUnit Platform 1.8.2,避免 IDEA 运行器混用 1.7.x 导致 NoSuchMethodError -->
|
||
<dependency>
|
||
<groupId>org.junit.platform</groupId>
|
||
<artifactId>junit-platform-commons</artifactId>
|
||
<version>1.8.2</version>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.junit.platform</groupId>
|
||
<artifactId>junit-platform-engine</artifactId>
|
||
<version>1.8.2</version>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.junit.platform</groupId>
|
||
<artifactId>junit-platform-launcher</artifactId>
|
||
<version>1.8.2</version>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>junit</groupId>
|
||
<artifactId>junit</artifactId>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
|
||
<!-- <dependency>-->
|
||
<!-- <groupId>com.ruoyi</groupId>-->
|
||
<!-- <artifactId>ruoyi-common</artifactId>-->
|
||
<!-- </dependency>-->
|
||
|
||
<!-- <dependency>-->
|
||
<!-- <groupId>com.ruoyi</groupId>-->
|
||
<!-- <artifactId>ruoyi-system</artifactId>-->
|
||
<!-- </dependency>-->
|
||
|
||
|
||
<!-- <!– 定时任务–>-->
|
||
<!-- <dependency>-->
|
||
<!-- <groupId>com.ruoyi</groupId>-->
|
||
<!-- <artifactId>ruoyi-quartz</artifactId>-->
|
||
<!-- </dependency>-->
|
||
|
||
<!-- <!– 代码生成–>-->
|
||
<!-- <dependency>-->
|
||
<!-- <groupId>com.ruoyi</groupId>-->
|
||
<!-- <artifactId>ruoyi-generator</artifactId>-->
|
||
<!-- </dependency>-->
|
||
<!-- <dependency>-->
|
||
<!-- <groupId>jakarta.persistence</groupId>-->
|
||
<!-- <artifactId>jakarta.persistence-api</artifactId>-->
|
||
<!-- <version>2.2.3</version>-->
|
||
<!-- </dependency>-->
|
||
|
||
</dependencies>
|
||
|
||
<build>
|
||
<plugins>
|
||
<!--
|
||
1) 禁用 Spring Boot 的 repackage(fat jar),改由标准 jar + 外部依赖运行。
|
||
原因:fat jar 会将所有依赖打进 BOOT-INF/lib,包体大;分离后仅更新 app.jar 更高效。
|
||
配置:设置 skip=true 以跳过 repackage;保留 fork=true 以支持 devtools 热部署。
|
||
-->
|
||
<plugin>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||
<version>2.1.1.RELEASE</version>
|
||
<configuration>
|
||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||
<skip>true</skip> <!-- 跳过 repackage,避免生成 fat jar -->
|
||
</configuration>
|
||
</plugin>
|
||
|
||
<!--
|
||
2) 分离依赖:在 package 阶段复制运行时依赖到 outDir/lib 目录。
|
||
原因:将第三方依赖与应用 jar 解耦;首次部署上传完整包,后续仅替换 app.jar 即可。
|
||
关键点:includeScope=runtime 仅复制运行期所需依赖;excludeTransitive=false 保留传递依赖。
|
||
-->
|
||
<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>${outDir}/lib</outputDirectory> <!-- 依赖输出目录 -->
|
||
<excludeTransitive>false</excludeTransitive>
|
||
<stripVersion>false</stripVersion> <!-- 保留版本号,便于定位问题 -->
|
||
<includeScope>runtime</includeScope> <!-- 复制运行时依赖即可 -->
|
||
</configuration>
|
||
</execution>
|
||
</executions>
|
||
</plugin>
|
||
|
||
<!--
|
||
3) 生成可执行的“瘦身 jar”:
|
||
- 指定 Main-Class 为应用入口(RuoYiApplication),确保 java -jar 可直接启动。
|
||
- 在 Manifest 中开启 addClasspath,并设置 classpathPrefix=lib/,让 JVM 自动加载外部依赖。
|
||
- 将 jar 输出到 outDir 目录,和 lib 同级,便于部署:dist/app.jar + dist/lib/*。
|
||
运行方式(Windows):在 dist 目录执行 `java -jar ruoyi-admin.jar`。
|
||
-->
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-jar-plugin</artifactId>
|
||
<version>3.3.0</version>
|
||
<configuration>
|
||
<outputDirectory>${outDir}</outputDirectory> <!-- 应用 jar 输出目录 -->
|
||
<archive>
|
||
<manifest>
|
||
<mainClass>com.ruoyi.RuoYiApplication</mainClass> <!-- 应用入口类 -->
|
||
<addClasspath>true</addClasspath> <!-- 将依赖目录写入 Manifest Class-Path -->
|
||
<classpathPrefix>lib/</classpathPrefix> <!-- 依赖所在目录(相对 outDir) -->
|
||
</manifest>
|
||
</archive>
|
||
</configuration>
|
||
</plugin>
|
||
<!-- 使用 JUnit5 需要 surefire 2.22.0+,否则无法发现/运行测试 -->
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-surefire-plugin</artifactId>
|
||
<version>2.22.2</version>
|
||
<configuration>
|
||
<!-- 对 JDK8 无需特殊配置;保留默认测试命名匹配规则 -->
|
||
</configuration>
|
||
</plugin>
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-war-plugin</artifactId>
|
||
<version>3.0.0</version>
|
||
<configuration>
|
||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||
<warName>${project.artifactId}</warName>
|
||
</configuration>
|
||
</plugin>
|
||
<!-- YUI Compressor (CSS/JS压缩)
|
||
<plugin>
|
||
<groupId>net.alchim31.maven</groupId>
|
||
<artifactId>yuicompressor-maven-plugin</artifactId>
|
||
<version>1.5.1</version>
|
||
<executions>
|
||
<execution>
|
||
<phase>prepare-package</phase>
|
||
<goals>
|
||
<goal>compress</goal>
|
||
</goals>
|
||
</execution>
|
||
</executions>
|
||
<configuration>
|
||
<encoding>UTF-8</encoding>
|
||
<jswarn>false</jswarn>
|
||
<nosuffix>true</nosuffix>
|
||
<linebreakpos>50000</linebreakpos>
|
||
<sourceDirectory>src/main/resources/static</sourceDirectory>
|
||
<force>true</force>
|
||
<includes>
|
||
<include>**/*.js</include>
|
||
<include>**/*.css</include>
|
||
</includes>
|
||
<excludes>
|
||
<exclude>**/*.min.js</exclude>
|
||
<exclude>**/*.min.css</exclude>
|
||
<exclude>**/fileinput.js</exclude>
|
||
<exclude>**/bootstrap-table/**</exclude>
|
||
</excludes>
|
||
</configuration>
|
||
</plugin> -->
|
||
</plugins>
|
||
<!--
|
||
最终文件名保持默认(artifactId),jar 将输出到 outDir 下。
|
||
例如:target/dist/ruoyi-admin.jar 与 target/dist/lib/*。
|
||
-->
|
||
<finalName>${project.artifactId}</finalName>
|
||
</build>
|
||
|
||
</project> |