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 | |
| 6 | <!-- 基本坐标 --> |
| 7 | <modelVersion>4.0.0</modelVersion> |
| 8 | <groupId>com.example</groupId> |
| 9 | <artifactId>simple-maven-project</artifactId> |
| 10 | <version>1.0-SNAPSHOT</version> |
| 11 | |
| 12 | <!-- 指定 Java 版本 --> |
| 13 | <properties> |
root | cd43656 | 2025-05-08 14:09:19 +0000 | [diff] [blame] | 14 | <!-- 使用 Java 9,以支持接口中的 private 方法 --> |
| 15 | <maven.compiler.source>9</maven.compiler.source> |
| 16 | <maven.compiler.target>9</maven.compiler.target> |
| 17 | <!-- 推荐使用 release 模式,自动设置 source/target --> |
| 18 | <maven.compiler.release>9</maven.compiler.release> |
root | db0b96f | 2025-04-20 06:46:16 +0000 | [diff] [blame] | 19 | </properties> |
| 20 | |
root | cd43656 | 2025-05-08 14:09:19 +0000 | [diff] [blame] | 21 | <!-- 添加依赖 --> |
| 22 | <dependencies> |
| 23 | <!-- Apache Commons Lang3,用于 Pair 等工具类 --> |
| 24 | <dependency> |
| 25 | <groupId>org.apache.commons</groupId> |
| 26 | <artifactId>commons-lang3</artifactId> |
| 27 | <version>3.12.0</version> |
| 28 | </dependency> |
| 29 | </dependencies> |
| 30 | |
| 31 | <!-- 构建配置 --> |
root | db0b96f | 2025-04-20 06:46:16 +0000 | [diff] [blame] | 32 | <build> |
| 33 | <plugins> |
root | cd43656 | 2025-05-08 14:09:19 +0000 | [diff] [blame] | 34 | <!-- 编译插件,设定 Java 9 编译 --> |
| 35 | <plugin> |
| 36 | <groupId>org.apache.maven.plugins</groupId> |
| 37 | <artifactId>maven-compiler-plugin</artifactId> |
| 38 | <version>3.8.1</version> |
| 39 | <configuration> |
| 40 | <release>9</release> |
| 41 | </configuration> |
| 42 | </plugin> |
| 43 | <!-- 执行插件,方便 mvn exec:java 直接运行 --> |
root | db0b96f | 2025-04-20 06:46:16 +0000 | [diff] [blame] | 44 | <plugin> |
| 45 | <groupId>org.codehaus.mojo</groupId> |
| 46 | <artifactId>exec-maven-plugin</artifactId> |
| 47 | <version>3.1.0</version> |
| 48 | <configuration> |
| 49 | <mainClass>api.ApiMain</mainClass> |
| 50 | </configuration> |
| 51 | </plugin> |
| 52 | </plugins> |
| 53 | </build> |
| 54 | |
root | cd43656 | 2025-05-08 14:09:19 +0000 | [diff] [blame] | 55 | </project> |