Struggling with IntelliJ

We have a need to include a certain directory in the classpath for IJ launch configs, but I don’t want that in the build’s runtime configurations. I’d like to be able to use the idea plugin to do that, but it seems that the idea plugin only creates file-based configs and must be manually run to be of any use.

Further, given that IntelliJ recommends using directory based vs file based project configuration (see here ) AND the fact that it understand gradle via the tooling API, I can’t shake the feeling that the idea plugin isn’t the best way forward.

My goals are:

  1. No need to check IntelliJ project configuration files into source control. I don’t want to have to update/commit a bunch of IJ files every time I tweak the build, otherwise what’s the point of being able to import a gradle project in IJ?
  2. Add runtime-only dependencies that are used by IJ but not the larger build. For now, we are manually adding this directory as a runtime dependency in IJ, but it gets blown away anytime you sync the gradle project.

Seems like the idea plugin should be about providing information that IJ reads during a gradle sync, right? Am I missing something?

You can add a configuration containing your additional dependencies to idea.module.scopes.RUNTIME. Idea’s importer will pick that up.

configurations {
  myExtraIdeaStuff
}

dependencies {
  myExtraIdeaStuff files(...)
}

idea.module.scopes.RUNTIME.plus << myExtraIdeaStuff

Without any need to actually run any idea task? That’s awesome. I don’t think that’s made clear in the docs – or I completely missed it. Either way, thanks for the info.