How do I get IntelliJ to recognize gradle generated sources dir?

后端 未结 5 2438
天涯浪人
天涯浪人 2021-02-20 13:08

So I have an XJC javaExec that spins like a top but IntelliJ doesn\'t recognize the generated output despite having marked generated-src/java as such. Do I need to

5条回答
  •  囚心锁ツ
    2021-02-20 13:36

    I'll point out a solution by Daniel Dekany, from a Gradle discussion thread actually linking to this question. To quote:

    apply plugin: "idea"
    ...
    sourceSets.main.java.srcDir new File(buildDir, 'generated/javacc')
    idea {
        module {
            // Marks the already(!) added srcDir as "generated"
            generatedSourceDirs += file('build/generated/javacc')
        }
    }
    

    Works well for me.

提交回复
热议问题