IDEA plugin resource folders support

IntelliJ IDEA 13 introduced new type of directory - resource directory with test or main scoped. See details at

Could you add respective support in the gradle ‘idea’ plugin also?

Thanks in advance!

I support this request.

The reason this is significant is that if a directory src/test/resources or src/intTest/resources is marked as a test source root in IDEA, IDEA will offer to locate test classes in those directories when you gesture that you want to create a test class.

If Gradle had a way of marking a directory as a test resource root, IDEs could avoid offering to create new classes in those directories, where, of course, they will never be seen by unit test running harnesses like JUnit or TestNG.


This worked for setting up a “testResource” directory. Just modify as required for a normal “resource” directory. (Improvements welcome!)

Intellij IDEA Ultimate 14 Gradle 2.2

apply plugin: 'idea'
  idea {
    module.iml.withXml {
        def atts = it.asNode().component.content.sourceFolder
                .find { it.@url == 'file://$MODULE_DIR$/src/test/resources' }
  atts.put('type', 'java-test-resource')

Duplicate of: - - ?