0

I have a working gradle 3.1 dagger2 antlr4 project with antlr plugin. I have a specific generated sources directory configured in the gradle idea plugin and in the Intellij Annotation Processing option. If I build it in Intellij 2016.2.4, the dagger2 generated sources are duplicated in the build/generated-src/antlr/main directory as well as my configured src/main/generated directory. Why on Earth would non-Antlr code be put into that directory?

Novaterata
  • 4,356
  • 3
  • 29
  • 51

1 Answers1

0

It's been awhile but I think I resolved this by making sure antlr source was in main/antlr/com.foo.bar.parsers like package structure and then setting the package again in the build.gradle:

generateGrammarSource {
    arguments += [
        "-package", "com.foo.bar.parsers"
    ]
    outputDirectory = file("$projectDir/gen") // same as Intellij ANTLR plugin
}
Novaterata
  • 4,356
  • 3
  • 29
  • 51