| <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> |
| <groupId>com.example</groupId> |
| <artifactId>simple-maven-project</artifactId> |
| <version>1.0-SNAPSHOT</version> |
| |
| <!-- 指定 Java 版本 --> |
| <properties> |
| <!-- 使用 Java 9,以支持接口中的 private 方法 --> |
| <maven.compiler.source>9</maven.compiler.source> |
| <maven.compiler.target>9</maven.compiler.target> |
| <!-- 推荐使用 release 模式,自动设置 source/target --> |
| <maven.compiler.release>9</maven.compiler.release> |
| </properties> |
| |
| <!-- 添加依赖 --> |
| <dependencies> |
| <!-- Apache Commons Lang3,用于 Pair 等工具类 --> |
| <dependency> |
| <groupId>org.apache.commons</groupId> |
| <artifactId>commons-lang3</artifactId> |
| <version>3.12.0</version> |
| </dependency> |
| <dependency> |
| <groupId>javax.persistence</groupId> |
| <artifactId>javax.persistence-api</artifactId> |
| <version>2.2</version> |
| </dependency> |
| <dependency> |
| <groupId>org.hibernate</groupId> |
| <artifactId>hibernate-core</artifactId> |
| <version>5.6.14.Final</version> |
| </dependency> |
| <dependency> |
| <groupId>mysql</groupId> |
| <artifactId>mysql-connector-java</artifactId> |
| <version>8.0.32</version> |
| </dependency> |
| <dependency> |
| <groupId>org.slf4j</groupId> |
| <artifactId>slf4j-api</artifactId> |
| <version>1.7.36</version> |
| </dependency> |
| <dependency> |
| <groupId>org.slf4j</groupId> |
| <artifactId>slf4j-simple</artifactId> |
| <version>1.7.36</version> |
| </dependency> |
| </dependencies> |
| |
| <!-- 构建配置 --> |
| <build> |
| <plugins> |
| <!-- 编译插件,设定 Java 9 编译 --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-compiler-plugin</artifactId> |
| <version>3.8.1</version> |
| <configuration> |
| <release>9</release> |
| </configuration> |
| </plugin> |
| <!-- 执行插件,方便 mvn exec:java 直接运行 --> |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>exec-maven-plugin</artifactId> |
| <version>3.1.0</version> |
| <configuration> |
| <mainClass>api.ApiMain</mainClass> |
| </configuration> |
| </plugin> |
| </plugins> |
| </build> |
| |
| </project> |