Maven Surefire
  1. Maven Surefire
  2. SUREFIRE-319

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

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major 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)
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      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

          Brett Porter made changes -
          Field Original Value New Value
          Fix Version/s 2.4 [ 13243 ]
          Hide
          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
          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>
          Dan Fabulich made changes -
          Fix Version/s 2.x [ 13647 ]
          Fix Version/s 2.4 [ 13243 ]
          Hide
          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 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
          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
          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
          Dan Tran added a comment -

          mvn -DskipTests=false should work

          Show
          Dan Tran added a comment - mvn -DskipTests=false should work
          Kristian Rosenvold made changes -
          Component/s Maven Surefire Plugin [ 12561 ]
          Stefan Birkner made changes -
          Link This issue duplicates MNG-4979 [ MNG-4979 ]
          Hide
          Stefan Birkner added a comment -

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

          Show
          Stefan Birkner added a comment - It's a special case of bug MNG-4979 .
          Hide
          Kristian Rosenvold added a comment -
          Show
          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
          Kristian Rosenvold made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Kristian Rosenvold [ krosenvold ]
          Fix Version/s 2.7.2 [ 17030 ]
          Fix Version/s Backlog [ 13647 ]
          Resolution Fixed [ 1 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: