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

<skip>true</skip> cannot be overridden using mvn -Dmaven.test.skip=false test

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7.2
    • Component/s: Maven Surefire Plugin
    • Labels:
      None
    • Environment:
      java version "1.5.0_09"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b01)
      Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_09-b01, mixed mode)

      Description

      If the pom file is configured to skip tests using <skip>true</skip>, and an attempt is made to override this on the command line using mvn -Dmaven.test.skip=false test, the attempt does not work (the test is still skipped).

      In theory, the command line flag should override the pom setting.

        Issue Links

          Activity

          Hide
          krosenvold Kristian Rosenvold added a comment -
          Show
          krosenvold Kristian Rosenvold added a comment - Fixed with a documentation update in r1061478. WIll appear at http://maven.apache.org/plugins/maven-surefire-plugin/examples/skipping-test.html once 2.7.2 is released, in the mean time it can be seen here http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt.vm?view=markup
          Hide
          mail@stefan-birkner.de Stefan Birkner added a comment -

          It's a special case of bug MNG-4979.

          Show
          mail@stefan-birkner.de Stefan Birkner added a comment - It's a special case of bug MNG-4979 .
          Hide
          dantran Dan Tran added a comment -

          mvn -DskipTests=false should work

          Show
          dantran Dan Tran added a comment - mvn -DskipTests=false should work
          Hide
          jialu Jia Lu added a comment - - edited

          We expereience same issue. It would be very useful if the "skip" values in pom.xml can be overridden in command line.
          e.g pom.xml
          <configuration>
          <skip>true</skip>
          </configuration>

          Developers can simply build without junit test by just using "mvn install" . And "mvn install -Dmaven.test.skip=false" will build and run JUnit tests.

          Show
          jialu Jia Lu added a comment - - edited We expereience same issue. It would be very useful if the "skip" values in pom.xml can be overridden in command line. e.g pom.xml <configuration> <skip>true</skip> </configuration> Developers can simply build without junit test by just using "mvn install" . And "mvn install -Dmaven.test.skip=false" will build and run JUnit tests.
          Hide
          jan.palmquist Jan Palmquist added a comment -

          Corresponding behavior is true for configuration <testFailureIgnore>false</testFailureIgnore> and -Dmaven.test.failure.ignore=true

          Thanks for the workaround!

          It seems like that the following also works:

          <properties>
          <maven.test.skip>true</maven.test.skip>
          <maven.test.failure.ignore>true</maven.test.failure.ignore>
          </properties>

          <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
          <skip>$

          {maven.test.skip}

          </skip>
          <testFailureIgnore>$

          {maven.test.failure.ignore}

          </testFailureIgnore>
          </configuration>
          </plugin>

          Hence, you can specify a different default value for you test behaviour and also override the values using the command line...

          Show
          jan.palmquist Jan Palmquist added a comment - Corresponding behavior is true for configuration <testFailureIgnore>false</testFailureIgnore> and -Dmaven.test.failure.ignore=true Thanks for the workaround! It seems like that the following also works: <properties> <maven.test.skip>true</maven.test.skip> <maven.test.failure.ignore>true</maven.test.failure.ignore> </properties> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>$ {maven.test.skip} </skip> <testFailureIgnore>$ {maven.test.failure.ignore} </testFailureIgnore> </configuration> </plugin> Hence, you can specify a different default value for you test behaviour and also override the values using the command line...
          Hide
          mjmcvey Mike McVey added a comment -

          maven.test.skip is a setting from maven 1. You can do something like the following in your pom.xml and then override it in command line with mvn goal -Dvar.name=value

          <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
          <skip>$

          {test.skip}

          </skip>
          </configuration>
          </plugin>
          ...

          <properties>
          <test.skip>true</test.skip>
          </properties>

          Show
          mjmcvey Mike McVey added a comment - maven.test.skip is a setting from maven 1. You can do something like the following in your pom.xml and then override it in command line with mvn goal -Dvar.name=value <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>$ {test.skip} </skip> </configuration> </plugin> ... <properties> <test.skip>true</test.skip> </properties>

            People

            • Assignee:
              krosenvold Kristian Rosenvold
              Reporter:
              minfrin Graham Leggett
            • Votes:
              4 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development