I've set true in pom.xml but I want to be able to run tests when I wish to run them. I've tried mvn -Prun-its clean verify
and mvn verify -DskipITs=false
but they're not working, the tests are skipped still.
The added plugin in the pom.xml is as follows:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skipITs>true</skipITs>
<parallel>methods</parallel>
<useUnlimitedThreads>true</useUnlimitedThreads>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${surefire-version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter-version}</version>
</dependency>
</dependencies>
</plugin>
In the output of mvn verify -DskipITs=false
I can see the following:
[INFO] --- maven-failsafe-plugin:2.22.2:verify (default) @ redis-service-integration-tests ---
[INFO] Tests are skipped.
CodePudding user response:
You must change the plugin configuration to be like this:
<skipITs>${skipITs}</skipITs>
Explanation:
to make the property mechanism work, you should use the project properties <properties>
to set the skipITs instead of the plugin configuration, otherwise it can't be easily overridden from outside.