I inherited a project that has a number of subprojects. During development, you can start the actual product by calling run on the top-level project. However, for running the product, you don’t need the classpath of all subprojects to be included. In fact, some subprojects have a classpath that should definitely not be included in the top-level runClasspath. How can you do that? How can you explicitly exclude the classpath of a subproject from the top-level classpath?
I inherited a project that has a number of subprojects. During development, you can
Share
I’ll answer my own question first. I don’t feel it’s the right approach, but it seems to work. Suppose that you defined a subproject like this:
… then it seems to be possible to prevent the
fooSub‘s classpath to be included in the top-level classpath by adding this to the definition of your top-level project:This works, because
fullClasspathseems to usetopologicalSortto find all subprojects, to include their classpaths to its own classpath. It seems a little too aggressive for my taste though. Hard to tell if it breaks somewhere else.