Jetty
  1. Jetty
  2. JETTY-1491

jetty-maven-plugin ignores <useTestClasspath> and/or <userTestScope> since 7.5.2.v20111006 and 8.0.3.v20111011

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 7.5.2, 7.5.3, 7.5.4, 7.6.0, 7.6.1, 8.0.3, 8.0.4, 8.1.0
    • Fix Version/s: 7.6.2, 8.1.2
    • Component/s: Maven
    • Labels:
      None
    • Environment:
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      The 7.5.2 and 8.0.3 releases of the jetty-maven-plugin have broken the useTestClasspath and/or useTestScope options.

      The attached sample project illustrates the issue through a couple of JUnit test cases which use httpclient to connect to a jetty instance started through the maven plugin (using Class.forName to resolve classes from different scopes).

      I believe the problem is due to using the combination of the following in JettyRunMojo.java:

      JettyRunMojo.java:57
      /* 
       * @requiresDependencyResolution compile+runtime
       */
      

      and

      JettyRunMojo.java:437
      for ( Iterator<Artifact> iter = projectArtifacts.iterator(); iter.hasNext(); )
      {
          // snip
          if (((!Artifact.SCOPE_PROVIDED.equals(artifact.getScope())) && (!Artifact.SCOPE_TEST.equals( artifact.getScope())))
                         ||
                     (useTestClasspath && Artifact.SCOPE_TEST.equals( artifact.getScope())))
                 {
                 }
      }
      

      It appears that the for loop is assuming all artifacts will be available, and attempting to filter out the test dependencies if useTestScope is specified. However, since the @requireDependencyResolution doesn't include +test, these aren't available.

      I haven't had a chance to verify this (hence no patch to offer just yet) - but I'll try and get something sorted out to confirm this in the next few days (unless someone on the other end can verify ahead of time).

        Activity

          People

          • Assignee:
            Jan Bartel
            Reporter:
            Martin Lau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: