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

run maven test with customized classpath

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5
    • 2.6
    • Maven Surefire Plugin
    • None
    • Patch

    Description

      I have modified the plug-in to allow customizing the classpath used when running tests. The idea is that sometimes one needs to know everything works with the libraries as shipped with another project that is using (and includes) the maven project currently under tests. But at the moment one cannot override the maven test classpath.

      I hope this functionality will be useful to others tasked to test releases of big projects bundling lots of smaller projects and willing to make sure the smaller projects are still operating flawlessly in this environment. So I'm attaching a patch against trunk r898286 that I hope to be included in future maven-surefire-plugin releases.

      There are two configurable additional parameters - ignoreClasspathElements and debugClasspath. The former one selects what to remove from the original maven test classpath and the second outputs classpath information to the INFO level so one doesn't need to dig into the DEBUG output and/or TEST-X.xml

      Basically how I use it is like:
      1. ignoreClasspathElements=runtime (remove runtime artifacts from test classpath)
      2. additionalClasspathElements=<all jars from the big project>
      3. debugClasspath=true (so I can easily verify classpath elements are what I expect them to be)

      There are two more options for ignoreClasspathElements - none and all. First is the default so classpath is what it has always used to be. Latter is to nuke the whole test classpath in case somebody needs full control and wants to specify even the test scoped classpath elements.

      I've put "@since 2.5.1" but that of course is not something I insist on. Please change it to whatever fits best your release rules.

      Attachments

        1. surefire.diff
          8 kB
          A

        Issue Links

          Activity

            People

              pgier Paul Gier
              avalon A
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: