A much simpler way would be to end your integration tests in IT instead of
Test and then have failsafe run the tests for you. Much less hacky

On 1 January 2015 at 19:40, Ole Ersoy <ole.er...@gmail.com> wrote:

> Hi,
>
> I'm attempting to separate my integration and unit tests using profiles
> and the maven build helper plugin.  I have unit tests in the standard
> directory and integration tests in `src/integration-test/java`.  When I run
> the default profile, I expect integration tests to be skipped and unit
> tests to be executed.  When I run the `integration-test` profile with `mvn
> clean test -Pintegration-test` I expect the integration tests to be run and
> the unit tests to be skipped.  Right now Maven is just ignoring the profile
> test settings:
> `skip.integration.tests`
> `skip.unit.tests`
> and it just runs all the tests regardless of which profile is active.
>
> My POM looks like this:
>
> <project xmlns="http://maven.apache.org/POM/4.0.0";
>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd";
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>     <modelVersion>4.0.0</modelVersion>
>
>     <groupId>com.example.maven</groupId>
> <artifactId>separating-integration-and-unit-test-execution</artifactId>
>     <version>1.0.0</version>
>
>     <profiles>
>         <profile>
>             <id>unit-test</id>
>             <activation>
>                 <activeByDefault>true</activeByDefault>
>             </activation>
>             <properties>
> <skip.integration.tests>true</skip.integration.tests>
>                 <skip.unit.tests>false</skip.unit.tests>
>             </properties>
>         </profile>
>         <profile>
>             <id>integration-test</id>
>             <properties>
> <skip.integration.tests>false</skip.integration.tests>
>                 <skip.unit.tests>true</skip.unit.tests>
>             </properties>
>         </profile>
>     </profiles>
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.codehaus.mojo</groupId>
> <artifactId>build-helper-maven-plugin</artifactId>
>                 <version>1.9.1</version>
>                 <executions>
>                     <!-- Add the integration-test source directory -->
>                     <execution>
> <id>add-integration-test-sources</id>
> <phase>generate-test-sources</phase>
>                         <goals>
>                             <goal>add-test-source</goal>
>                         </goals>
>                         <configuration>
>                             <sources>
> <source>src/integration-test/java</source>
>                             </sources>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>     </build>
> </project>
>
> Thoughts?
>
> TIA,
> - Ole
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to