title: Howto add another test source folder to Maven and compile it to a separate folder?
body: <p>I have the default <code>src/test/java</code> folder for our unit tests. A separate folder <code>src/integration/java</code> is available for the integration tests.</p>
  
  <p>I configured the <code>maven-surefire-plugin</code> to execute the unit/integration tests in their respective phases. This works great when the compiled classes are in the correct directory. Unfortunately Maven only supports one test source folder and one test output folder.</p>
  
  <p>With mavens build-helper plugin I could add another test-source folder but the compiled classes will be generated into <code>test-classes</code> but I want to compile the classes from  <code>src/integration/java</code> into <code>target/integration-test-classes</code>. Is this possible?</p>
  
  <pre><code>src/test/java &gt; target/test-classes
  src/integration/java &gt; target/integration-test-classes
  </code></pre>
  
  <p>PS: I don't like this exclude/include on package base solution (exclude all <code>**/it/**</code> files from the default test phase, and exclude all <code>**/unit/**</code> from the integration phase.</p>