maven - 尽管在 pom 中排除条目,但 Maven 命令不排除任何内容
问题描述
尽管文件中的插件配置<exclude>
下有条目,但哪个 maven 命令可用于执行所有测试?surefire
pom.xml
例如 - 以下是来自pom.xml
但我不想排除的部分TestA.java
。可以使用哪个maven命令?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/TestA.java</exclude>
</excludes>
</configuration>
</plugin>
解决方案
将配置文件添加到您的 pom.xml
<profiles>
<profile>
<id>all-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude></exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
此配置文件会覆盖 surefire 插件的排除部分。只需通过以下方式激活配置文件:
mvn clean install -Pall-tests
推荐阅读
- python - ZeroDivisionError 即使在使用 try 和 except 之后
- error-handling - 如果没有结果,则从 for 循环返回结果或不返回任何内容
- python-3.x - 有没有一种方法可以遍历字典并在 while 循环中使用它?
- hashicorp-vault - 当以“没有已知的秘密 ID”开头时,hashicorp 保险库代理模板失败
- python - 在全球范围内设置 numpy.random.seed
- r - 用R提取字符串中间的字符串
- javascript - How to center a Scroll element with Overflow
- html - 301 将用户重定向到 https 协议,但前提是用户使用 http 协议
- reactjs - 如何在 Ubuntu 中使用 Shell 脚本从不同的目录启动 React 或 Node 应用程序
- python - Is there a way to have multiple instances of a model embedded into a single model field in Django?