IntelliJ version 13 and Gradle intTest-type source roots

I’m seeing IntelliJ v13 incorrectly marking directories like src/intTest/java as “main” source roots when they had been marked as “test source” roots. It happens when you open the JetGradle window and refresh the Project.

You may be seeing it, too. A reference project is included in the comments.

JetBrains tells me through the issue comments that IDEA v13 does not respect manually configured test source roots across Gradle project refreshes. I don’t think this is the right feature implementation, but changing that is up to them. In the meantime, your project needs this IDEA-specific config to preserve custom test-source roots:

apply plugin: 'idea'
  idea {
    module {
        testSourceDirs += file('src/intTest/java')
        testSourceDirs += file('src/intTest/resources')

I consider this less than desirable, as now my build has IDE specific configs in it. Oh, well.

Thanks Mark, its horrible, but it just works. :smiley:

Please take a look at this comment in JetBrains bug tracker - Change in scopes mapping can help you to add test dependencies to your IDEA project. If you only add source directories to IdeaModule.testSourceDirs IDEA may not be able to resolve some dependencies for your intTest.

1 Like

Hi Radim,

Thanks, your comment solved another problem I was facing.