debugging a java.util.ServiceLoader module

Hi all,

I try to break down a huge monolithic project into several modules using the java6 ServiceLoader facility.
Thus I started with a new Intellij module and moved all relevant code over there.
The main module then defines an interface and the plugin module advertises its implementation.
(I'm not talking about IntelliJEDA plug ins here...)

In order to to discover and load the module it must be packed into a jar archive.
Thus I defined an artifact to be build from the modules source.
In addition I defined a module dependency of the plugin module on the main modules, as it defines the interface to implement.

When I try to debug the module loaded by the main program, Intellij gets confused about the source code.
Using "step into" it will load the class from the jar file but then it asks me about the source code location.
Simply adding the source path to the jar does not work but confuses IJ even more.

Thus I defined an additional dependency of the main module on the plugin module.
In contrast to the other dependency I defined this one as a runtime dependency to avoid a cyclic dependency of both modules.
The dependency on the module jar must also be preserved, as the module isn't found without the META-INF from the jar.
And the module dependency has to be placed before the module-jar dependency to get it worked.

So it seems that the class is advertised by the jar, but is it finally loaded from the build directory tree instead?
It seems to work for now, but I expect further trouble if I will start playing around with different class loaders...

So I'm searching for a way to define a dependency on the artifact directly, similar to a module dependency.

Am I missing something?

Dieter.

1 comment
Comment actions Permalink

>In order to to discover and load the module it must be packed into a jar archive.

if you express dependencies between modules on artifatcs level (as an library) you have to add the src to that library. if you create module dependencies, sources should be visible.

regards, Alex

0

Please sign in to leave a comment.