Affects Version/s: None
Fix Version/s: None
Component/s: Dependency Resolver
Since version 2.6 the Maven SureFire plugin provides two new configuration parameters allowing a fine-grained customization of the test classpath:
- classpathDependencyExcludes: excludes given dependencies from test classpath and
- classpathDependencyScopeExclude: excludes given scopes from test classpath
A use case for these parameters is working with javaee-api.jar which contains the complete Java EE API. This JAR is fine for compilation but it must not be used during runtime as it contains only method signatures but no implementations and throws ClassFormatErrors when trying to do so.
One typically uses this dependency in scope "provided", as any target JEE container provides these APIs. For test execution an API implementation is used in "test" scope and mentioned javaee-api dependency is excluded using the "classpathDependencyExcludes" option. In this scenario tests can be executed fine when running Maven on the command line but fail with said ClassFormatError when executed in Eclipse.
To address this issue M2Eclipse's classpath provider should take these options into account when creating the runtime classpath for JUnit tests.