Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349668

Summary: Transitive test dependencies on Eclipse classpath
Product: z_Archived Reporter: Harald Wellmann <hwellmann.de>
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: CLOSED NOT_ECLIPSE QA Contact:
Severity: major    
Priority: P3 CC: igor
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Test case none

Description Harald Wellmann CLA 2011-06-17 06:10:45 EDT
Build Identifier: m2e 0.12.1-2011012-1712

In a multimodule project, module A has a test scope dependency on module B. 

Module B has a test scope dependency on an external library C.

According to Maven scope resolution rules, A has _no_ transitive dependency on C, but when running a JUnit test of A from Eclipse, C/test-classes is on the classpath, which leads to incorrect results.


Reproducible: Always
Comment 1 Igor Fedorenko CLA 2011-06-17 07:10:40 EDT
Please provide complete standalone sample project and steps to reproduce the problem.
Comment 2 Harald Wellmann CLA 2011-06-17 10:57:44 EDT
Created attachment 198183 [details]
Test case

Here is a test case, a parent project with two modules.

Import the project into Eclipse and run test-scope-bug-parent/test-scope-client/src/test/java/com/blogspot/hwellmann/testscope/ClasspathTest.java as JUnit test from Eclipse.

This will print the classpath to System.out.

The output includes .../test-scope-dep/target/test-classes and other dependencies of test-scope-dep.

The problem does not occur when the packaging of test-scope-client is jar (not 
war), so this may be an issue of m2eclipse WTP rather than m2e core. I'm using

Maven Integration for WTP (Optional)	0.11.1.20101108-1810
Comment 3 Igor Fedorenko CLA 2011-06-17 11:54:38 EDT
This is a bug in m2e-wtp integration, a separate project hosted at github. This bug appears to have been fixed in recent m2e-wtp builds (see [1]), but I am not familiar with the code enough to tell for sure.


[1] http://dev.eclipse.org/mhonarc/lists/m2e-users/msg00692.html


PS: FWIW, m2e 1.0.0 generates correct classpath if I change test-scope-client packaging to "jar".
Comment 4 Denis Roy CLA 2021-04-19 13:26:15 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/