refactor(build): centralize surefire config in parent POM and default to running tests

This commit is contained in:
2026-03-26 16:44:21 +08:00
parent 5219142b5c
commit 201addbc64
2 changed files with 22 additions and 16 deletions

View File

@@ -100,13 +100,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId> <artifactId>kotlin-maven-plugin</artifactId>

29
pom.xml
View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -8,6 +7,7 @@
<artifactId>Partner</artifactId> <artifactId>Partner</artifactId>
<version>0.5.0</version> <version>0.5.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>Partner-Core</module> <module>Partner-Core</module>
<module>Partner-Framework</module> <module>Partner-Framework</module>
@@ -19,7 +19,12 @@
<maven.compiler.source>21</maven.compiler.source> <maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target> <maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>2.2.0</kotlin.version> <kotlin.version>2.2.0</kotlin.version>
<surefire.version>3.5.5</surefire.version>
<!-- 推荐仓库默认不跳测试;本地需要时再 -DskipTests=true -->
<skipTests>false</skipTests>
</properties> </properties>
<dependencies> <dependencies>
@@ -39,6 +44,15 @@
<build> <build>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
@@ -60,16 +74,16 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- 如果这些子模块都要跑单测,就在父 POM 启用它 -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin> </plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin> <plugin>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId> <artifactId>kotlin-maven-plugin</artifactId>
@@ -96,5 +110,4 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>