Maven
  1. Maven
  2. MNG-2365

classes before test-classes in MavenProject.getTestClasspathElements() - should be the other way around?

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0.4
    • Fix Version/s: None
    • Component/s: Reactor and workspace
    • Labels:
      None
    • Environment:
      doesnt matter
    • Complexity:
      Intermediate
    • Number of attachments :
      1

      Description

      in getTestClasspathElements() we have:

      List list = new ArrayList( getArtifacts().size() + 1 );
      list.add( getBuild().getOutputDirectory() );
      list.add( getBuild().getTestOutputDirectory() );

      • causing classes to be prior to test-classes in the classpath- something then prohibits test-resources/classes to shadow classes/ resources fom main. .I.e. it is not possible to redefine resources/classes for usage when running tests.

      Sugested solution:
      List list = new ArrayList( getArtifacts().size() + 1 );
      list.add( getBuild().getTestOutputDirectory() );
      list.add( getBuild().getOutputDirectory() );

      add test-classes before classes

        Issue Links

          Activity

          Hide
          Brett Porter added a comment -

          while this makes sense to me, ISTR having to change this in the past. Please investigate SVN history before doing this.

          Show
          Brett Porter added a comment - while this makes sense to me, ISTR having to change this in the past. Please investigate SVN history before doing this.
          Hide
          Benjamin Bentmann added a comment -

          This patch includes a unit test to to check the proper test class path ordering.

          Show
          Benjamin Bentmann added a comment - This patch includes a unit test to to check the proper test class path ordering.
          Hide
          John Casey added a comment -

          applied the unit test, and all tests out just fine.

          Show
          John Casey added a comment - applied the unit test, and all tests out just fine.

            People

            • Assignee:
              John Casey
              Reporter:
              kai lilleby
            • Votes:
              12 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: