Filtering transitive paths from inter-module dependencies?


My plugin has support for a Clojure build system called deps which I developed some time ago. Deps has the concept of local dependencies, where you can declare that a module depends on e.g. `../libraries/some-lib`, and that directory will contain a project file describing the local module. It's a way to have dependencies on modules without having to publish them as libraries.

Modules in deps declare dependencies and source paths, much like e.g. Maven, and it has a concept of aliases which is roughly analogous to Maven profiles. However, it has one quirk - extra paths added via aliases are not transitively visible to depending modules, and test source roots are added via aliases. This means that if module A depends on another local module B, A cannot access B's test code. 

This led me to not add the local dependencies as inter-module dependencies as you might expect, instead I created libraries to represent the dependencies, and the dependent modules refer to the libraries instead of the corresponding modules. This works, somewhat, but it has various problems. It would be better if I could actually create modules and module dependencies for this - is there any way I can filter out content roots for module dependencies using custom criteria?



If you want to change how IntelliJ Platform processes transitive dependencies, you may override 'shouldProcessDependenciesRecursively' and 'shouldIncludeTestsFromDependentModulesToTestClasspath' from 'OrderEnumerationHandler' extension.


That looks perfect, Nikolay, thanks!


Please sign in to leave a comment.