Cloning Projects

By default the projects will be executed in the same directory where they are found. This means that build output will be generated with the project files. It may be helpful to copy the projects to another directory before running them, for example target/it. This will allow mvn clean to remove the output generated by all of the test projects.

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-invoker-plugin</artifactId>
        <version>1.2.1</version>
        <configuration>
          <projectsDirectory>src/it</projectsDirectory>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>