How to disable specific tests for mvn package command?

六眼飞鱼酱① 提交于 2020-01-06 07:09:43

问题


I have integration tests in the package:

my.campaign.ololo.controller.external

I want to not run that tests during mvn clean package

So I wrote following in my 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>

Then I execute mvn clean package

and see in logs following:

[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0

So looks like tests were execute because I don't have another tests in the project now.

How can I disable test while executing command mvn package, mvn install and so on?

P.S.

I understand that maven has fixed build phase order and test phase executes before package.

来源:https://stackoverflow.com/questions/52162449/how-to-disable-specific-tests-for-mvn-package-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!