Skip to end of metadata
Go to start of metadata

Is your classpath backwards?

Read this document if you think Maven is putting your classpath in the wrong order.

Two bugs canceled each other out

Take a look at That bug was fixed in Maven 2.0.8 and called out in the release announcement as a backwards compatibility risk:

As noted in the comments to MNG-3118, Surefire 2.3 had a bizarre classpath ordering bug that made the test classpath appear to be correct (test-classes first) under Maven 2.0.7 for some users with large classpaths:

SUREFIRE-61 was fixed in Surefire 2.3.1. Notably, it would make the "Test Classpath" output in -X look correct, while secretly under the hood it would munge the classpath incorrectly!

As a result, for at least one project here at my work, we've seen:

Maven 2.0.7 + Surefire 2.3: test-classes before classes
Maven 2.0.8 + Surefire 2.3: classes before test-classes
Maven 2.0.7 + Surefire 2.3.1 or higher: classes before test-classes
Maven 2.0.8 + Surefire 2.3.1 or higher: test-classes before classes

Benjamin checked in a classpath ordering test in the Surefire trunk that we now run with every release. It's currently passing in Surefire 2.4.2 and Maven 2.0.8, and failing with Maven 2.0.7.

Still having problems?

Read this page, which explains how Surefire launches your tests. Classloading and Forking under Maven Surefire

Also, take a look at this Nabble discussion. (Mostly redundant, but it couldn't hurt.)

  • No labels