mardi 4 septembre 2018

How to disable specific tests for mvn package command?

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.

Aucun commentaire:

Enregistrer un commentaire