Les*_*ter 3 java maven maven-surefire-plugin
为什么这个pom.xml可以mvn test在没有指定maven Surefire插件的情况下运行?
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lester</groupId>
<artifactId>junit-basics</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>junit-basics</name>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<junit.jupiter.version>5.4.0</junit.jupiter.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
把插件放在pom.xml中和不放有什么区别?
如果您没有在 pom 中指定 maven-surefire-plugin,您的构建将采用 Maven 中指定的版本,请参阅https://maven.apache.org/ref/3.6.3/maven-core/default -bindings.html 这些版本已经有一段时间没有更新了,以确保 Maven 的升级不会因为不同的插件版本而影响您的构建。这些版本很可能会随着 Maven 的下一个主要版本而更新。因此,这完全取决于您的项目的生命周期以及它是否是私人项目。如果它的生命周期很长,最好将这些插件锁定到特定版本,这样您就不会依赖任何人用来构建项目的 Maven 版本。
| 归档时间: |
|
| 查看次数: |
1242 次 |
| 最近记录: |