WebProject
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
4.8 KiB

2 weeks ago
<?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>
<!-- 项目基本信息(匹配项目名Web) -->
<groupId>com.Web</groupId>
<artifactId>Web-project</artifactId> <!-- 项目标识 -->
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging> <!-- Web项目打包为war -->
<name>Web</name> <!-- 项目名 -->
<description>基于Spring的Web项目(Java 24.0.2)</description>
<!-- 依赖管理 -->
<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>4.28.2</version>
</dependency>
<!-- 1. Spring核心模块 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>6.1.0</version> <!-- 稳定版本,兼容Java 17+ -->
</dependency>
<!-- Spring WebMVC(Web开发核心) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>6.1.0</version>
</dependency>
<!-- Spring JDBC(数据库操作) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>6.1.0</version> <!-- 替换为你项目中使用的 Spring 版本 -->
</dependency>
<!-- 视图解析器:Thymeleaf -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.1.3.RELEASE</version> <!-- 版本可根据需求调整 -->
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring6</artifactId>
<version>3.1.3.RELEASE</version> <!-- 需与核心版本一致 -->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.15.2</version> <!-- 版本可根据需求调整 -->
</dependency>
<!-- 2. Controller API(容器提供,避免打包冲突) -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0</version> <!-- 适配Java EE 10,兼容高版本Java -->
<scope>provided</scope>
</dependency>
<!-- 3. MySQL驱动 -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.4.0</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.0.1</version> <!-- 版本号请用最新稳定版 -->
</dependency>
<!-- 4. 日志依赖(Spring必需) -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<!-- SLF4J API + Logback 实现,供项目使用 org.slf4j Logger -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.11</version>
</dependency>
</dependencies>
<!-- 构建配置(将编译目标设置为 Java 17,以避免 Spring ASM 无法解析 Java 24 class 文件) -->
<build>
<finalName>Web</finalName> <!-- 打包后的war包名 -->
<plugins>
<!-- 编译插件:使用 release 17,保证生成 class 文件兼容性 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<release>17</release>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- Web项目打包插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml> <!-- 允许无web.xml -->
</configuration>
</plugin>
</plugins>
</build>
</project>