I'm trying to add support to my M2 build for my integration tests, which ideally need to be run against the assembled webapp. To do this, I added a profile which, when enabled, will bind the compiler and surefire plugins to the integration-test lifecycle phase.

Everything seems to be working except that I can't figure out how to get the compiler plugin to compile the right set of sources and put the resulting classes where I want them, so integration tests remain separate from unit tests.

It seems that setting testSourceDirectory, testClassesDirectory or testOutputDirectory in the compiler plugin's configuration has no effect; trying to set compileSourceRoots or outputDirectory raises an error:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <executions>
    <execution>
      <id>itest:testCompile</id>
      <phase>integration-test</phase>
      <goals>
        <goal>testCompile</goal>
      </goals>
      <configuration>
<!--<compileSourceRoots>src/tests/integration</compileSourceRoots>-->
<!--<outputDirectory>target/test-classes-itest</outputDirectory>-->
<testSourceDirectory>src/tests/integration</testSourceDirectory>
<testClassesDirectory>target/test-classes-itest</testClassesDirectory>
<testOutputDirectory>target/test-classes-itest</testOutputDirectory>
      </configuration>
    </execution>
  </executions>
</plugin>

Is there a way to achieve this, short of reorganizing the source tree and/or breaking the project up into modules?

Thanks,

L.


        <profile>
            <id>itest</id>

            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>itest:testCompile</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>testCompile</goal>
                                </goals>
                                <configuration>

<!--<compileSourceRoots>src/tests/integration</compileSourceRoots>-->

<!--<outputDirectory>target/test-classes-itest</outputDirectory>-->

<testSourceDirectory>src/tests/integration</testSourceDirectory>

<testClassesDirectory>target/test-classes-itest</testClassesDirectory>

<testOutputDirectory>target/test-classes-itest</testOutputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>itest:test</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>

<testClassesDirectory>target/test-classes-itest</testClassesDirectory>

<reportsDirectory>target/surefire-reports-itest</reportsDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

            <dependencies>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-mock</artifactId>
                    <version>1.2.7</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to