Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-2106

[Maven-Failesafe-plugin] - Configurations not honoured when specified within <execution> tag

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • 3.0.0-M7
    • None
    • Maven Failsafe Plugin
    • None

    Description

      Failsafe plugin fails to honour the configuration specified within the 

      <execution>
      

      tag.

      For e.g., when I specify the configuration such as below

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.0.0-M7</version>
          <configuration>
              <useSystemClassLoader>false</useSystemClassLoader>
              <useManifestOnlyJar>false</useManifestOnlyJar>
              <additionalClasspathElements>
                  <additionalClasspathElement>src/main/resources</additionalClasspathElement>
                  <additionalClasspathElement>${project.build.outputDirectory}</additionalClasspathElement>
              </additionalClasspathElements>
              <classpathDependencyExcludes>
                  <classpathDependencyExclude>${groupId}:${artifactId}</classpathDependencyExclude>
              </classpathDependencyExcludes>
              <useModulePath>false</useModulePath>
          </configuration>
          <executions>
              <execution>
                  <phase>integration-test</phase>
                  <goals>
                      <goal>integration-test</goal>
                      <goal>verify</goal>
                  </goals>
                  <configuration>
                      <suiteXmlFiles>
                          <suiteXmlFile>src/test/resources/cricket.xml</suiteXmlFile>
                          <suiteXmlFile>src/test/resources/football.xml</suiteXmlFile>
                      </suiteXmlFiles>
                  </configuration>
              </execution>
          </executions>
          <dependencies>
      </dependencies>
      </plugin> 
      

      and then run 

      ./mvnw clean test-compile failsafe:integration-test failsafe:verify
      

      Failsafe does not execute any of the tests that are included in the suite xml files provided.

      But when the configuration section is housed outside of the execution tag, then it works fine.
       

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.0.0-M7</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>src/test/resources/cricket.xml</suiteXmlFile>
            <suiteXmlFile>src/test/resources/football.xml</suiteXmlFile>
          </suiteXmlFiles>
          <useSystemClassLoader>false</useSystemClassLoader>
          <useManifestOnlyJar>false</useManifestOnlyJar>
          <additionalClasspathElements>
            <additionalClasspathElement>src/main/resources</additionalClasspathElement>
            <additionalClasspathElement>${project.build.outputDirectory}</additionalClasspathElement>
          </additionalClasspathElements>
          <classpathDependencyExcludes>
            <classpathDependencyExclude>${groupId}:${artifactId}</classpathDependencyExclude>
          </classpathDependencyExcludes>
          <useModulePath>false</useModulePath>
        </configuration>
        <executions>
          <execution>
            <phase>integration-test</phase>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
        </dependencies>
      </plugin>
      

       

      Sample project that can be used to reproduce the problem is available in https://github.com/krmahadevan/failsafe_experiments and also attached here as a zip file.

       

      Attachments

        1. failsafe_experiments-main.zip
          13 kB
          Krishnan Mahadevan

        Activity

          tibordigana - Can you please help take a look at this issue ?

          krmahadevan Krishnan Mahadevan added a comment - tibordigana - Can you please help take a look at this issue ?

          Please read: https://maven.apache.org/guides/mini/guide-configuring-plugins.html#configuring-build-plugins

          Note: Configurations inside the <executions> element used to differ from those that are outside <executions> in that they could not be used from a direct command line invocation ...

           
          You don't need specific each phase, goals on command line, you can simply execute:

          ./mvn clean verify
          
          sjaranowski Slawomir Jaranowski added a comment - Please read: https://maven.apache.org/guides/mini/guide-configuring-plugins.html#configuring-build-plugins Note:  Configurations inside the  <executions>  element used to differ from those that are outside  <executions>  in that they could not be used from a direct command line invocation ...   You don't need specific each phase, goals on command line, you can simply execute: ./mvn clean verify

          sjaranowski - Thanks for the quick turnaround.

          You don't need specific each phase, goals on command line, you can simply execute:

          The only reason why I am explicitly invoking the goals prefixed with the plugin names is because in our Jenkins build pipeline, I would like to show explicitly the below stages

          • Unit test stage
          • Integration test stage

          If I use

          ./mvn clean verify
          

          then I wouldn't be able to do what I am looking for. If there are any other ways of doing it, please let me know.

          Please read: https://maven.apache.org/guides/mini/guide-configuring-plugins.html#configuring-build-plugins

          This helped

          ./mvnw clean test-compile failsafe:integration-test@football-test failsafe:integration-test@cricket-test failsafe:verify
          

           
          now runs both the executions.

           

          krmahadevan Krishnan Mahadevan added a comment - sjaranowski - Thanks for the quick turnaround. You don't need specific each phase, goals on command line, you can simply execute: The only reason why I am explicitly invoking the goals prefixed with the plugin names is because in our Jenkins build pipeline, I would like to show explicitly the below stages Unit test stage Integration test stage If I use ./mvn clean verify then I wouldn't be able to do what I am looking for. If there are any other ways of doing it, please let me know. Please read:  https://maven.apache.org/guides/mini/guide-configuring-plugins.html#configuring-build-plugins This helped ./mvnw clean test-compile failsafe:integration-test@football-test failsafe:integration-test@cricket-test failsafe:verify   now runs both the executions.  

          People

            Unassigned Unassigned
            krmahadevan Krishnan Mahadevan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: