Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356500 - JDK JUnit runner classpath problem with war projects using attachClasses
Summary: JDK JUnit runner classpath problem with war projects using attachClasses
Status: CLOSED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-01 13:28 EDT by Rafal Krzewski CLA
Modified: 2021-04-19 13:22 EDT (History)
1 user (show)

See Also:


Attachments
projects that exhibit described problem (5.84 KB, application/zip)
2011-09-01 13:30 EDT, Rafal Krzewski CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafal Krzewski CLA 2011-09-01 13:28:26 EDT
Build Identifier: I20110613-1736

maven-war-plugin allows packaging the classes into a separate attached jar artifact instead of war artifact itself.

When another project depends on the attached artifact, m2e fails to configure JUunit runner classpath correctly. /target/classes directory of the war project is missing from the classpath.



Reproducible: Always

Steps to Reproduce:
1. Create project test1, use war packaing and maven-war-plugin <attachClasses> option
2. Create a class under test1/src/main/java
3. Create a test under test1/src/test/java
4. Build the project from the command line - tests succeed, all is fine.
5. Run all tests in test1 project using JDT JUnit runner, all is fine.
6. Create project test2, add dependency on test1, using <classifier>classes</classifier>
7. Add classes and tests in test2/ referencing classes from test1/src/main/java - eclipse reports no compilation, errors.
8. Build test2 project from command line, tests succeed, all is fine.
9. Build test2 using m2e, using external / internal Maven installation, workspace resolution on and off, all is fine.
10. Run tests in test2 using JDT JUunit runner - tests fail with NoClassDefFoundError on classes from test1/src/main/java
11. Set breakpoint in a test inside test2 project before NCDFE is triggered. Examine ClassLoader classpath - test1/target/classes is missing. Interestingly test1/target/test-classes is present!
Comment 1 Rafal Krzewski CLA 2011-09-01 13:30:25 EDT
Created attachment 202625 [details]
projects that exhibit described problem
Comment 2 Rafal Krzewski CLA 2011-09-01 13:33:20 EDT
Forgot to add m2e version, sorry. I'm running 1.0.100.20110804-1717
Comment 3 Igor Fedorenko CLA 2013-09-29 00:01:53 EDT
closing old/stale bugreports
Comment 4 Denis Roy CLA 2021-04-19 13:22:46 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/