Maven
  1. Maven
  2. MNG-3118

Test-classes should come before classes in the classpath

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.7
    • Fix Version/s: 2.0.8, 3.0-alpha-1
    • Component/s: General
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      Currently maven-project creates the test classpath in the order: classes, tests-classes, dependencies.
      It would be better if test-classes came first because sometimes it is useful for a test class to replace a main class during testing. The opposite case is not normally true (i.e. one would not want to override a test class with one of the main classes).

        Issue Links

          Activity

          Hide
          Benjamin Bentmann added a comment -

          Well, how should Maven have kept backward compatibility here? There can only be one class path order.

          If Surefire 2.3.1 is not usable for you (I feel happy with it and Maven 2.0.8), you can lock your POM to Surefire 2.3 by explicitly specifying <version>2.3</version> in the corresponding <plugin> element.

          Show
          Benjamin Bentmann added a comment - Well, how should Maven have kept backward compatibility here? There can only be one class path order. If Surefire 2.3.1 is not usable for you (I feel happy with it and Maven 2.0.8), you can lock your POM to Surefire 2.3 by explicitly specifying <version>2.3</version> in the corresponding <plugin> element.
          Hide
          KlaasJan Elzinga added a comment -

          It just didn't feel like a patch version change. The fact that my build failed first with 2.0.8 and a week later with 2.0.7 doesn't feel right.

          Backwards compatibility could be accomplished by mvn querying the surefire plugin version and construct the path with respect to that version. FYI, I was using mvn in an environment where upgrades are not allways possible/easy (...and all the dvl'ers had to upgrade), I know how to work around it, which meant a code change or an upgrade.

          In the end I advised everyone to upgrade to 2.0.8. I'll stop commenting on this issue since this is not really the place for it anyway.

          Thanks for the reaction though.

          Show
          KlaasJan Elzinga added a comment - It just didn't feel like a patch version change. The fact that my build failed first with 2.0.8 and a week later with 2.0.7 doesn't feel right. Backwards compatibility could be accomplished by mvn querying the surefire plugin version and construct the path with respect to that version. FYI, I was using mvn in an environment where upgrades are not allways possible/easy (...and all the dvl'ers had to upgrade), I know how to work around it, which meant a code change or an upgrade. In the end I advised everyone to upgrade to 2.0.8. I'll stop commenting on this issue since this is not really the place for it anyway. Thanks for the reaction though.
          Hide
          Ceki Gulcu added a comment -

          In my 20 months experience with Maven, the test-classes always came before "classes". This is a feature that I heavily rely on. Could you please kindly document this behavior as part of the Maven/Surefire contract, so that the re-ordering problem does not reoccur?

          Many thanks in advance,

          Show
          Ceki Gulcu added a comment - In my 20 months experience with Maven, the test-classes always came before "classes". This is a feature that I heavily rely on. Could you please kindly document this behavior as part of the Maven/Surefire contract, so that the re-ordering problem does not reoccur? Many thanks in advance,
          Hide
          Juan Losada added a comment -

          Same to me Ceki. Days of work lost cause this.

          Not to mention a regression issue in the surefire 2.3 with testng that only allows me to work with 2.4-SNAPSHOT

          And although I love maven my only way out is to migrate everything to ant if I don't want to lose the testing options in my C.I. machine. This just sad!!

          Show
          Juan Losada added a comment - Same to me Ceki. Days of work lost cause this. Not to mention a regression issue in the surefire 2.3 with testng that only allows me to work with 2.4-SNAPSHOT And although I love maven my only way out is to migrate everything to ant if I don't want to lose the testing options in my C.I. machine. This just sad!!
          Hide
          Benjamin Bentmann added a comment -

          While I agree that having a documentation would be nice, it does not prevent the bugs from reoccurring. What you really want are tests. Therefore, you are invited to vote for MNG-2365 and SUREFIRE-428.

          Show
          Benjamin Bentmann added a comment - While I agree that having a documentation would be nice, it does not prevent the bugs from reoccurring. What you really want are tests. Therefore, you are invited to vote for MNG-2365 and SUREFIRE-428 .

            People

            • Assignee:
              Unassigned
              Reporter:
              Paul Gier
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: