Order of Inherited Libraries

I have a project with 2 modules in it.
The base module has 2 libraries in it (both marked Export)
The second library is a fix for the first and contains some classes with the same name as the first library.
Therefore the 2nd library (the fix) is higher up the classpath.

The other module has a dependency on the base module.

If I create a class in the base module that refers to one of the classes in the fix, IDEA resolves it correctly.

However, if I copy and paste that class to the other module, IDEA resolves the class in the first library and not from the fix.

Is the order of the classpath not inherited when you click module dependency on the dependencies tab?

1 comment
Comment actions Permalink

This has come up again where I am working on a similarly structured project.
I have one module with 70 jars in it.
1 jar is the main jar, the rest are incremental fixes for different parts of that jar.

In several instances there have been multiple fixes for the same class in different jars.

I have ordered the jars correctly in this "patch" module and ticked export on each.

However, when I import this "patch"  module into my other module the   "patch" classpath seems to be lost.

Is that meant to happen?
Is classpath order not preserved when you export modules?


Please sign in to leave a comment.