• Arthur Neudeck

Maven – Skip Tests But Remain Executable


Whenever you use the -DskipTests flag neither test classes will be compiled nor test resources will be copied. This can be rather annoying, especially whenever you want to execute the test cases in your IDE.


So, if you like to ensure that your tests and resources will be present, you will have to add the following plugin configurations to your Maven pom.xml:

<project> [...]   <build> [...] <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <executions> <execution> <id>add-test-resources</id> <phase>process-test-resources</phase> <goals> <goal>testResources</goal> </goals> <configuration> <skip>false</skip> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <executions> <execution> <id>default-testCompile</id> <phase>test-compile</phase> <goals> <goal>testCompile</goal> </goals> <configuration> <skip>false</skip> </configuration> </execution> </executions> </plugin> [...]

After having built with a -DskipTests now your test cases will still properly work executed from within your IDE.


#Maven, #unittest

0 Ansichten

©2020 Giniality AG      Datenschutzerklärung      Impressum      Disclaimer