Run maven test not in default src/test/java folder

maven, unit-testing

Solution

It is enough to add this part to your pom:

<project>
    ...
    <build>
        <testSourceDirectory>src/int-test/java</testSourceDirectory>
    </build>
    ...
</project>

The test sources will be compiled during the `test-compile` phase and the `maven-surefire-plugin` will find the test classes too.

Problem

I have a project containing `pom.xml` and some `JUnit` tests. Both `pom.xml` and unit tests are corrects. But problem is that tests are not in src/test/java folder (I cannot use this folder). Is it possible to tell maven to execute tests from another source folder (which is also in this project)?

Original source