Directories not getting added to IDEA classpath with idea plugin

(Phil Swenson) #1

I have this code in one of my .gradle files: sourceSets.main.runtimeClasspath += files("$aeConfDir/Caching") + files("$aeConfDir/glue/maps") sourceSets.test.runtimeClasspath += files("$aeConfDir/Caching") + files("$aeConfDir/glue/maps")

When I go into IDEA, these directories are not configured as in the classpath of the IDEA project.

How do I get this?


(Peter Niederwieser) #2

The IDEA plugin uses what’s on the compile/runtime/testCompile/testRuntime configuration, not what’s on the source sets’ class paths. So either you add your directories to the ‘runtime’ configuration, or you add them to separate configurations and add those to ‘’. See the DSL reference for ‘IdeaModule’ for details.

(Phil Swenson) #3

How do I add a directory directly to the runtime configuration? All the examples I can find go thru the sourceSets…

(Peter Niederwieser) #4
dependencies {
    runtime files("/path/to/dir")

Documented in the DSL reference.

(Phil Swenson) #5

I get this error when I try that:

What went wrong: A problem occurred evaluating project ‘:modules:bam-ae’. > Could not find method runtime() for arguments [file collection] on project ‘:modules:bam-ae’.

(Phil Swenson) #6

did you mean to put it in “dependencies” not “configurations”?

(Peter Niederwieser) #7


(Phil Swenson) #8

Thanks! Works!