0
votes

Suppose there are 2 (non-Maven, legacy) projects in Eclipse.

  • A -> depends on B and lib-2.0.jar
  • B -> depends on lib-1.0.jar

When we run a HelloWorld.java from project A, the runtime classpath is A\classes;A\lib\lib-2.0.jar;B\classes;B\lib\lib-1.0.jar

(even though library lib-1.0.jar is not marked as 'Exported' on Java build path settings of project B). Probably that checkbox has influence just on compile-time classpath, not on the runtime one.

We need to exclude lib-1.0.jar PERMANENTLY for the whole project A (since -2.0 contains incompatible changes, and presence of both lib-1.0.jar & lib-2.0.jar in the runtime classpath causes bad consequences).

The desired classpath would be: A\classes;A\lib\lib-2.0.jar;B\classes.

How can this be achieved globally for the whole project?

I found a possibility to specify a concrete launch configuration with a custom runtime classpath. But this way to solve the problem is hard-to-support: - need to specify such launch config for every class we need to be runnable in project A - need to modify it as soon as new libraries are added.

Thank you for your ideas!

Project structure

1

1 Answers

0
votes

I'm not sure if that's what you need but you can right click on project A, Build Path -> Configure Build Path and in the Projects tab add your project B, now whenever you'll add something to B, it will be 'visible' in A.