Launcher classpath problem

(Nat Mishkin) #1

Summary
I recently started noticing a problem running JUnit tests using launchers for Buildship-created projects in Eclipse 2018-12. In short, the test was throwing inexplicable ClassNotFoundException 's. By uninstalling Buildship 3.0.1 and then installing Buildship 2.2.1 I could make the problem stop happening. Once I upgraded back to 3.0.1 the problem reoccurred.

Details
I used Eclipse’s new-ish “Show Command Line” feature in the Run Configurations dialog to determine that the -classpath argument is different depending on whether I’m using Buildship 3.0.1 vs. 2.2.1. The former is missing at least one of one project’s output folder.

I say “one of one project’s” because this project (call it the “core” project) has two source folders that contain Java source files and one source folder that contains non-Java “resources”. Each of these source folders has its own output folder. My other projects have just one Java source folder and one “resources” source folder.

It’s probably also worth my noting that one of the “core” project’s Java source folder contains generated Java code. The source code generation happens as part of a regular Gradle command invocation. The ClassNotFoundException. Until Buildship 3.0.2, at least, Buildship appears to have been capable of sorting this out. And it’s still seems to be capable WRT getting Eclipse projects that successfully compile. However, launching seems to have broken due to the incorrect -classpath parameter being generated.

I want to mention another anomaly that appears in the -classpath parameter, in both versions of Buildship: in addition to containing syntactically correct file system pathnames (i.e., of the form “/User/mishkin/foo/project1/bin/main”), the parameter also contains “Eclipse” pathnames–i.e., names of the form “/project1/main/bin”. The latter, being meaningless as file system pathnames, are ignored by the JRE. But it’s weird that they are there.

Any idea what’s going on?

Thanks.

Nat

0 Likes

(Donát Csikós) #2

If you provide a sample project then I’ll be able to effectively debug your problem.

Nonetheless, I have a hunch for the root cause. Does the problem appear in Buildship 2.2.2?

0 Likes

(Nat Mishkin) #3

Yes, in fact I see now that upgrading from 2.2.1 to 2.2.2 introduces the broken behavior.

I hope this helps you confirm that your hunch is correct, because I’m not sure how easy it’d be for me to give you a simple sample.

Thanks.

Nat

0 Likes

(Nat Mishkin) #4

Hi @donat ,

I’m just following up to see if my observation about the breakage happening on upgrade from 2.2.1 to 2.2.2 is enough info for you to diagnose the problem and confirm your hunch, or whether I should try to boil the issue down to a sample project (which given the size and number of the projects that I’m seeing the problem in might not be a simple task). Or supply you with other info that might be helpful.

Thanks.

Nat

0 Likes