# Struggling with IntelliJ

**URL:** <https://discuss.gradle.org/t/struggling-with-intellij/21730>\
**Category:** Help/Discuss\
**Created:** [February 23, 2017, 7:16pm UTC](https://discuss.gradle.org/t/struggling-with-intellij/21730 "2017-02-23T19:16:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikesnare](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mikesnare/32/5846_2.png) [@mikesnare](https://discuss.gradle.org/u/mikesnare)\
**Post date:** [February 23, 2017, 7:16pm UTC](https://discuss.gradle.org/t/struggling-with-intellij/21730/1 "2017-02-23T19:16:56Z")

</div>

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](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206167769-File-based-vs-Directory-based-Projects-Which-way-to-go-) ) 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?

---

<div class="post-metadata">

**Author:** ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)\
**Post date:** [February 23, 2017, 7:20pm UTC](https://discuss.gradle.org/t/struggling-with-intellij/21730/2 "2017-02-23T19:20:03Z")

</div>

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

```gradle
configurations {
  myExtraIdeaStuff
}

dependencies {
  myExtraIdeaStuff files(...)
}

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

```

---

<div class="post-metadata">

**Author:** ![mikesnare](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mikesnare/32/5846_2.png) [@mikesnare](https://discuss.gradle.org/u/mikesnare)\
**Post date:** [February 23, 2017, 7:22pm UTC](https://discuss.gradle.org/t/struggling-with-intellij/21730/3 "2017-02-23T19:22:23Z")

</div>

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.
