0

In IDEA 2019 I have created a Gradle project and added the following lines to the build.gradle file:

plugins {
    id 'java'
}
sourceSets {
    main {
        java {
            srcDir "../src"
            include "com/example/abc/**"
            exclude "com/example/abc/tst/**"
        }
    }
}

When compiling the project, the compiler apparently does what I expect: starting from the ../src folder, it compiles only the abc package and subpackages except the tst subpackage.

However, in the IDEA sources tree on the left-hand side, the whole content of src is displayed. It makes it harder to navigate in the project and to understand what is compiled and what is not.

Obviously, IDEA is parsing the .gradle file because it correctly understands the ..\src location of my sources. But for some reason it doesn't respect the include and exclude statements. What should I do to make IDEA display exactly the same content which is being compiled?

I know I can hide a folder using the "Mark directory as excluded" context menu. But this is a bad solution because it forces me to make the same thing twice in different places and discredits the concept of having everything in the .gradle file.

Goblin Alchemist
  • 829
  • 5
  • 11
  • 1
    It does not yet work, please see https://youtrack.jetbrains.com/issue/IDEA-169124#focus=streamItem-27-2217923.0-0 You could vote for this issue in tracker: https://youtrack.jetbrains.com/issue/IDEA-169124 – Andrey Jun 27 '19 at 06:06
  • @Andrey, upvoted that, thanks – Goblin Alchemist Jun 27 '19 at 09:51

0 Answers0