Hi Benson,

I got it working now.  I wanted to be able to run the build with an integration 
test profile that skips running the unit tests:
`mvn clean verify -P integration-test`

Its working now.  Thanks,
- Ole


On 01/01/2015 09:25 PM, Benson Margulies wrote:
I think that what you actually want is two executions of surefire (or
one of surefire and one of failsafe) with different test name
patterns.

On Thu, Jan 1, 2015 at 2:40 PM, 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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to