Search code examples
mavenhudsontestngmaven-failsafe-plugin

exclude TestNG-Groups on maven build in hudson


I want to use hudson to build a maven-java project. Some of my integration tests use servers which are not reachable from the hudson-server. So i want to exclude them using a special profile.

  <profile>
    <id>hudson</id>
    <build>
      <pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>         
            <configuration>
             <excludedGroups>ticketserver,print</excludedGroups>
            </configuration>
          </plugin>
        </plugins>
      </pluginManagement>
    </build>
  </profile> 

</profile

Unfortunatly i am already excluding a group in my general pom.

   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-failsafe-plugin</artifactId>
     <version>2.10</version>

     <configuration>
      <excludedGroups>manual</excludedGroups>
     </configuration>

Using mvn help:effective-pom i found out, that this setting overrides the one from my profile. Is there are way exclude all three test-classes when running in the hudson profile?

I though about putting the failsage-configuration in to every profile i have and removing it from the general pom but that does seem right, as i would need to repeat it for every profile i have.

Any help is greatly appreciated


Solution

  • Solved this by defining a property "testGroupsToSkip", which is set in the main-pom. it is then used as the value for excludedGroups. In my Profile i overwrite the property with the new value.