How to get Intellij to use module output jars instead of output classes?

I’m trying to import the Apache Beam codebase into Intellij so that the platform test runner and code completion works (using the Gradle test runner does work though).

One of the issues is that we use the shadow plugin a lot to produce repackaged jars which we vendor (1, 2). We use these relocated classes directly within the codebase in other modules (example).

The issue that I run into is that these vendored classes are not found within Intellij.

These are the things that I have tried:

  • set the idea.module.outputDir to a location with the classes extracted from the shaded jar. It seems as though Intellij uses this as an output directory and doesn’t look at the contents.
  • set the idea.module.scopes.RUNTIME.plus to a configuration which points to the shadow configuration within the gradle project. This seems to be explicitly ignored by Intellij as I don’t see any change to the list of dependencies listed by the module.
  • set the idea.module.scopes.RUNTIME.plus to a configuration which points to a configuration containing the shaded jar. This seems to be explicitly ignored by Intellij as I don’t see any change to the list of dependencies listed by the module.

The project is currently using Gradle 4.8.1 and I have tried this with Intellij 2018.1.3.

Pinging this question since I haven’t found a solution to this issue.