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