eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

Run config not resolving dependency tree

Open
#468 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
22h 47m
Merged PRs (30d)
28

Description

Sorry if this issue is in the wrong project, It was difficult to know if it should be in ui or in core (or somewhere else for that matter).

When adding a project as a dependency in a run configuration, the dependency tree of that project is not taken into account by Eclipse.
For me this becomes an issue when writing applications using plugins such as using java ServiceLoader. When running applications with such plugins in the IDE it is almost impossible to correctly add all of the dependencies (since eclipse will not resolve them automatically).

I have created a very simple project that demonstrates the issue here: git@gitlab.com:spacemetric-public/eclipse-runcfg-transitive-issue.git

This project demonstrates this by having 3 projects: a, b and c with 3 classes A, B and C and one interface Plugin.

Project b has a dependency on project a and c while projects a and c have no dependencies at all.
Class A in project a uses the ServiceLoader to load instances of the Plugin interface and iterates over them.
Class B in project b implements this interface and uses class C from project c in its implementation.

In order to run the application we create a run configuration for class A and then add our plugin (project b) to the dependencies.
My assumption would be that any dependencies of b would also be added to the classpath by eclipse but this is not the case. Instead the result when running is a NoClassDefFoundError.
This error could of course easily be resolved by adding project c as well to the dependencies list. But in a real world scenario using ServiceLoader to load plugins into an application, it is often very difficult to find ALL the correct dependencies that needs to be added and doing this work manually.
I see very little reason why eclipse should not resolve these dependencies by itself.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.