Reputation: 2279
Using Maven build configuration, we can configure it to skip test execution while building the source file. In eclipse we can check the checkbox labeled as 'Skip Test` and from command line we can use
mvn clean install -Dmaven.test.skip=true
The Skip test doesn't even compile the unit test source codes.
Is there any way to configure maven such that it will compile the unit test classes but doesn't execute it?
Upvotes: 13
Views: 26524
Reputation: 1560
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
Add this code in your pom.xml
file.
Upvotes: 0
Reputation: 16384
When runnig a mvn install
, you can either:
-Dmaven.test.skip=true
-DskipTests=true
Note that those properties defaults to false
when not explicitelly specified.
Upvotes: -1
Reputation: 312267
-Dmaven.test.skip=true
is designed not to even compile the unit tests. If you want to build them but not run them, you could use the skipTests
flag:
mvn clean install -DskipTests=true
or in its shorthand version:
mvn clean install -DskipTests
See also maven's documentation on skipping tests for the full details.
Upvotes: 7
Reputation: 240996
It compiles test classes when you specify -DskipTests
it just skips execution of tests
maven.test.skip
stops compilation of test classes
Documentation
Upvotes: 21