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

后端 未结 5 2359
天涯浪人
天涯浪人 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:32

    The code of this answer, rewritten using Kotlin DSL, will look like this:

    plugins {
        idea
    }
    
    val generatedSourcesPath = file("out/production/classes/generated")
    
    java.sourceSets["main"].java.srcDir(generatedSourcesPath)
    
    idea {
        module {
            generatedSourceDirs.add(generatedSourcesPath)
        }
    }
    

提交回复
热议问题