gpt4 book ai didi

java - 我的配置 pom.xml 已跳过测试。但现在我想用命令行运行一次测试。命令如何?

转载 作者:行者123 更新时间:2023-12-01 11:08:24 25 4
gpt4 key购买 nike

我的配置 pom.xml 已跳过 maven-surefire-plugin 的测试,如下所示。我通常会跳过这些测试,因为它们不陈旧。

 <build> 
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>

但现在我想使用命令行运行一次测试以尝试查看测试结果。我认为 mvn 命令行应该可以是 -DvarNewValue 来覆盖 pom.xml 中配置为 ANT 的 var 旧值。所以我尝试“mvn test -DskipTests = false”。但测试仍然被跳过。

D:\GIT_Work\iVIEW8.5\oss\xml\xmlservice\api>mvn test -DskipTests=false
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xmlservice-api 8.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ xmlservice-api ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ xmlservice-api ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- native2ascii-maven-plugin:1.0-beta-1:native2ascii (native2ascii) @ xmlservice-api ---
[INFO] Includes: [*.properties]
[INFO] Excludes: []
[INFO] Processing D:\GIT_Work\iVIEW8.5\oss\xml\xmlservice\api\target\classes\xmlservicebiz.properties
[INFO] Processing D:\GIT_Work\iVIEW8.5\oss\xml\xmlservice\api\target\classes\xmlservicebiz_zh_CN.properties
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ xmlservice-api ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ xmlservice-api ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.7.1:test (default-test) @ xmlservice-api ---
[INFO] Tests are skipped.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.939s
[INFO] Finished at: Fri Sep 18 17:47:24 CST 2015
[INFO] Final Memory: 11M/371M
[INFO] ------------------------------------------------------------------------

运行测试的正确命令行如何在 pom.xml 中配置为跳过一次来尝试?

最佳答案

如果你想从命令行覆盖插件的行为,你必须定义一个属性:

<properties>
<skipTests>true</skipTests>
</properties>

并在插件中使用它:

  <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>

来源: http://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-test.html

关于java - 我的配置 pom.xml 已跳过测试。但现在我想用命令行运行一次测试。命令如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32671740/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com