Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 如何禁用mvn包命令的特定测试?_Maven_Unit Testing_Testing_Configuration_Pom.xml - Fatal编程技术网

Maven 如何禁用mvn包命令的特定测试?

Maven 如何禁用mvn包命令的特定测试?,maven,unit-testing,testing,configuration,pom.xml,Maven,Unit Testing,Testing,Configuration,Pom.xml,我在包中进行了集成测试: my.campaign.ololo.controller.external 我不想在mvn clean package期间运行该测试 所以我在我的pom.xml <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> &l

我在包中进行了集成测试:

my.campaign.ololo.controller.external
我不想在mvn clean package期间运行该测试

所以我在我的
pom.xml

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.21.0</version>
                <configuration>
                    <excludes>
                        <exclude>my.campaign.ololo.controller.external</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
看起来测试已经执行了,因为我现在项目中没有其他测试

如何在执行命令
mvn-package
mvn-install
等时禁用测试

附笔。
我知道maven有固定的构建阶段顺序,测试阶段在包之前执行

为什么您不喜欢执行测试?这些测试的真正问题是什么?@khmarbaise你想解释一下我不必禁用测试吗?这是环境部署配置问题首先,我想了解您为什么喜欢禁用测试?这通常是个坏主意…@khmarbaise这是环境部署配置问题,这意味着这些测试是集成测试,这意味着它们应该根据定义的模式进行相应命名
*Test.java
(单元测试)和
*IT.java
集成测试。此外,它应该由maven failsafe插件运行(使用配置文件来停用运行它的),此外,在maven构建中部署对我来说完全是错误的。。。。
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0