root | db0b96f | 2025-04-20 06:46:16 +0000 | [diff] [blame] | 1 | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| 2 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 3 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 |
| 4 | http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| 5 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 6 | <!-- 基本坐标 --> |
| 7 | <modelVersion>4.0.0</modelVersion> |
| 8 | <groupId>com.example</groupId> |
| 9 | <artifactId>simple-maven-project</artifactId> |
| 10 | <version>1.0-SNAPSHOT</version> |
root | db0b96f | 2025-04-20 06:46:16 +0000 | [diff] [blame] | 11 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 12 | <!-- 指定 Java 版本 --> |
| 13 | <properties> |
| 14 | <!-- 使用 Java 9,以支持接口中的 private 方法 --> |
| 15 | <maven.compiler.source>9</maven.compiler.source> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 16 | <maven.compiler.target>9</maven.compiler.target> |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 17 | <!-- 如果还没定义,请添加 QueryDSL 版本 --> |
| 18 | <querydsl.version>5.0.0</querydsl.version> |
| 19 | </properties> |
root | db0b96f | 2025-04-20 06:46:16 +0000 | [diff] [blame] | 20 | |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 21 | <!-- 不再需要额外的 simpleframework 仓库,所有依赖均可从 Central 获取 --> |
| 22 | <!-- |
| 23 | <repositories> |
| 24 | <repository> |
| 25 | <id>simpleframework-releases</id> |
| 26 | <url>https://repo.simpleframework.org/releases/</url> |
| 27 | </repository> |
| 28 | </repositories> |
| 29 | --> |
| 30 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 31 | <!-- 添加依赖 --> |
| 32 | <dependencies> |
| 33 | <!-- Apache Commons Lang3,用于 Pair 等工具类 --> |
| 34 | <dependency> |
| 35 | <groupId>org.apache.commons</groupId> |
| 36 | <artifactId>commons-lang3</artifactId> |
| 37 | <version>3.12.0</version> |
| 38 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 39 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 40 | <dependency> |
| 41 | <groupId>javax.persistence</groupId> |
| 42 | <artifactId>javax.persistence-api</artifactId> |
| 43 | <version>2.2</version> |
| 44 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 45 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 46 | <dependency> |
| 47 | <groupId>org.hibernate</groupId> |
| 48 | <artifactId>hibernate-core</artifactId> |
| 49 | <version>5.6.14.Final</version> |
| 50 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 51 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 52 | <dependency> |
| 53 | <groupId>com.mysql</groupId> |
| 54 | <artifactId>mysql-connector-j</artifactId> |
| 55 | <version>8.0.32</version> |
| 56 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 57 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 58 | <dependency> |
| 59 | <groupId>org.slf4j</groupId> |
| 60 | <artifactId>slf4j-api</artifactId> |
| 61 | <version>1.7.36</version> |
| 62 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 63 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 64 | <!-- QueryDSL --> |
| 65 | <dependency> |
| 66 | <groupId>com.querydsl</groupId> |
| 67 | <artifactId>querydsl-jpa</artifactId> |
| 68 | <version>${querydsl.version}</version> |
| 69 | </dependency> |
| 70 | <dependency> |
| 71 | <groupId>com.querydsl</groupId> |
| 72 | <artifactId>querydsl-apt</artifactId> |
| 73 | <version>${querydsl.version}</version> |
| 74 | <scope>provided</scope> |
| 75 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 76 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 77 | <dependency> |
| 78 | <groupId>javax.annotation</groupId> |
| 79 | <artifactId>javax.annotation-api</artifactId> |
| 80 | <version>1.3.2</version> |
| 81 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 82 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 83 | <!-- JUnit Jupiter API & Engine for writing and running tests --> |
| 84 | <dependency> |
| 85 | <groupId>org.junit.jupiter</groupId> |
| 86 | <artifactId>junit-jupiter</artifactId> |
| 87 | <version>5.9.1</version> |
| 88 | <scope>test</scope> |
| 89 | </dependency> |
| 90 | <!-- JUnit Jupiter Engine --> |
| 91 | <dependency> |
| 92 | <groupId>org.junit.jupiter</groupId> |
| 93 | <artifactId>junit-jupiter-engine</artifactId> |
| 94 | <version>5.9.1</version> |
| 95 | <scope>test</scope> |
| 96 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 97 | |
| 98 | <!-- 添加 QueryDSL 核心依赖 --> |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 99 | <dependency> |
| 100 | <groupId>com.querydsl</groupId> |
| 101 | <artifactId>querydsl-core</artifactId> |
| 102 | <version>5.0.0</version> |
| 103 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 104 | |
| 105 | <!-- 添加 QueryDSL APT,仅在编译时使用 --> |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 106 | <dependency> |
| 107 | <groupId>com.querydsl</groupId> |
| 108 | <artifactId>querydsl-apt</artifactId> |
| 109 | <version>5.0.0</version> |
| 110 | <scope>provided</scope> |
| 111 | </dependency> |
root | cd43656 | 2025-05-08 14:09:19 +0000 | [diff] [blame] | 112 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 113 | <dependency> |
| 114 | <groupId>org.springframework.boot</groupId> |
| 115 | <artifactId>spring-boot-starter-web</artifactId> |
| 116 | <version>2.5.6</version> <!-- 根据需要调整版本 --> |
| 117 | </dependency> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 118 | |
| 119 | <!-- SimpleFramework 整合包,5.1.6 版本可从 Maven Central 拉取,包含 HTTP 与 Transport 模块 --> |
| 120 | <dependency> |
| 121 | <groupId>org.simpleframework</groupId> |
| 122 | <artifactId>simple</artifactId> |
| 123 | <version>5.1.6</version> |
| 124 | </dependency> |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 125 | </dependencies> |
| 126 | |
| 127 | <!-- 构建配置 --> |
| 128 | <build> |
| 129 | <plugins> |
| 130 | <!-- 编译插件,设定 Java 9 编译 --> |
| 131 | <plugin> |
| 132 | <groupId>org.apache.maven.plugins</groupId> |
| 133 | <artifactId>maven-compiler-plugin</artifactId> |
| 134 | <version>3.8.1</version> |
| 135 | <configuration> |
| 136 | <release>9</release> |
| 137 | <compilerArgs> |
| 138 | <arg>--add-modules</arg> |
| 139 | <arg>java.xml.ws.annotation</arg> |
| 140 | </compilerArgs> |
| 141 | <annotationProcessorPaths> |
| 142 | <path> |
| 143 | <groupId>com.querydsl</groupId> |
| 144 | <artifactId>querydsl-apt</artifactId> |
| 145 | <version>${querydsl.version}</version> |
| 146 | <classifier>jpa</classifier> |
| 147 | </path> |
| 148 | <path> |
| 149 | <groupId>com.querydsl</groupId> |
| 150 | <artifactId>querydsl-jpa</artifactId> |
| 151 | <version>${querydsl.version}</version> |
| 152 | </path> |
| 153 | <path> |
| 154 | <groupId>javax.annotation</groupId> |
| 155 | <artifactId>javax.annotation-api</artifactId> |
| 156 | <version>1.3.2</version> |
| 157 | </path> |
| 158 | <path> |
| 159 | <groupId>javax.persistence</groupId> |
| 160 | <artifactId>javax.persistence-api</artifactId> |
| 161 | <version>2.2</version> |
| 162 | </path> |
| 163 | </annotationProcessorPaths> |
| 164 | <generatedSourcesDirectory>${project.build.directory}/generated-sources/java</generatedSourcesDirectory> |
| 165 | </configuration> |
| 166 | </plugin> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 167 | |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 168 | <!-- 执行插件,方便 mvn exec:java 直接运行 --> |
| 169 | <plugin> |
| 170 | <groupId>org.codehaus.mojo</groupId> |
| 171 | <artifactId>exec-maven-plugin</artifactId> |
| 172 | <version>3.1.0</version> |
| 173 | <configuration> |
| 174 | <mainClass>api.ApiMain</mainClass> |
| 175 | </configuration> |
| 176 | </plugin> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 177 | |
| 178 | <!-- QueryDSL APT 插件,用于生成 Q 类 --> |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 179 | <plugin> |
| 180 | <groupId>com.mysema.maven</groupId> |
| 181 | <artifactId>apt-maven-plugin</artifactId> |
| 182 | <version>1.1.3</version> |
| 183 | <executions> |
| 184 | <execution> |
| 185 | <goals> |
| 186 | <goal>process</goal> |
| 187 | </goals> |
| 188 | <configuration> |
| 189 | <outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory> |
| 190 | <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor> |
| 191 | </configuration> |
| 192 | </execution> |
| 193 | </executions> |
| 194 | </plugin> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 195 | |
| 196 | <!-- Surefire 插件,用于运行单元测试 --> |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 197 | <plugin> |
| 198 | <groupId>org.apache.maven.plugins</groupId> |
| 199 | <artifactId>maven-surefire-plugin</artifactId> |
| 200 | <version>2.22.2</version> |
| 201 | <configuration> |
| 202 | <includes> |
| 203 | <include>**/*Test.java</include> |
| 204 | </includes> |
| 205 | <!-- 确保 test 可以访问 main 的类 --> |
| 206 | <useSystemClassLoader>true</useSystemClassLoader> |
| 207 | <useManifestOnlyJar>false</useManifestOnlyJar> |
| 208 | </configuration> |
| 209 | </plugin> |
| 210 | |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 211 | <!-- Spring Boot Maven 插件 --> |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 212 | <plugin> |
| 213 | <groupId>org.springframework.boot</groupId> |
| 214 | <artifactId>spring-boot-maven-plugin</artifactId> |
| 215 | <version>2.5.6</version> |
| 216 | </plugin> |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 217 | |
| 218 | <!-- 将生成目录加入编译生命周期 --> |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 219 | <plugin> |
| 220 | <groupId>org.codehaus.mojo</groupId> |
| 221 | <artifactId>build-helper-maven-plugin</artifactId> |
| 222 | <version>3.2.0</version> |
| 223 | <executions> |
| 224 | <execution> |
| 225 | <id>add-source</id> |
| 226 | <phase>generate-sources</phase> |
| 227 | <goals> |
| 228 | <goal>add-source</goal> |
| 229 | </goals> |
| 230 | <configuration> |
| 231 | <sources> |
| 232 | <source>${project.build.directory}/generated-sources/java</source> |
| 233 | </sources> |
| 234 | </configuration> |
| 235 | </execution> |
| 236 | </executions> |
| 237 | </plugin> |
Raver | f79fdb6 | 2025-06-03 06:02:49 +0000 | [diff] [blame] | 238 | </plugins> |
| 239 | </build> |
root | db0b96f | 2025-04-20 06:46:16 +0000 | [diff] [blame] | 240 | |
root | 59a69f8 | 2025-06-05 08:35:22 +0000 | [diff] [blame] | 241 | </project> |