Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to skip integration tests with maven release plugin

I want to skip integration tests while running maven release plugin with command

mvn -B -DskipITs release:prepare release:perform

It does not seem to work this way. The same option -DskipITs works for mvn install/deploy. I don't want to use -Dmaven.test.skip=true since only integration tests need to be ignored, not unit tests. What is the best way to accomplish this?

EDIT: -Darguments=-DskipITs works for release:prepare, but surprising it does NOT work for release:perform. Tried -Darguments=-Dmaven.test.skip=true, does not work either.

Tried to add <arguments>skipITs</arguments> for release plugin in the pom, but it would ignore all other -Darguments provided in command line. I can't have everything configured in plugin config, since some of the options takes environment variables on the fly.

like image 899
ddd Avatar asked Mar 10 '23 00:03

ddd


2 Answers

According to how to make maven release plugin skip tests, it seems you need both -DskipITs and -Darguments=-DskipITs. One is to skip compiling ITs the other is for skipping running ITs.

like image 118
ddd Avatar answered Mar 24 '23 12:03

ddd


Use Maven Profiles.

Add the following to your pom:

<profiles>
    <profile>
        <id>ItsReleaseTime</id>
        <build>
        <plugins>
        <build> 
            <plugins> 
               <plugin>          
                   <groupId>org.apache.maven.plugins</groupId> 
                   <artifactId>maven-surefire-plugin</artifactId>
                   <version>2.20</version>    
                   <configuration>
                        <excludes>    
                              <exclude>**/*IT.java</exclude> 
                        </excludes> 
                   </configuration> 
               </plugin>
            </plugins>       
        </build>
    </profile>
</profiles>

And invoke the command :

mvn -B -P ItsReleaseTime release:prepare release:perform
like image 30
CourseTriangle Avatar answered Mar 24 '23 11:03

CourseTriangle