user2325154 user2325154 - 6 months ago 18
Java Question

Unit tests getting executed during integration test phase even after excluding them

I have a a unit test (
) and an integration test (
) in my maven application.

I would like to execute only the integration test during the
mvn verify
command call but the unit test also gets executed even after excluding it using the
tag in the

How can I fix this problem?



In Maven, test step is before verify step in the lifecycle.
So it you don't skip this step, it is bound to execute.

If you want to skip test , either use -Dmaven.test.skip=tr‌​ue as khmarbaise suggested, either create a dedicated Maven profile for IT where you will ignore unit-tests in this way :


Generally, you create a Maven profile for integration tests, so if it is the case, gathering all the configuration in a place is better that scattering it.