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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With