I have created new Gradle project, added
apply plugin: \'antlr\'
and
dependencies {
antlr \"org.antlr:antlr4:4.5.3\"
Add this to your build.gradle
generateGrammarSource {
outputDirectory = file("src/main/java/com/example/parser")
}
add this to your grammar after your "grammar ";
@header {
package com.example.parser;
}
Tested and working with Java8 grammar from antlr example grammars
Additional Link(s):
Here is a short guide of the Antlr plugin from docs.gradle.org