Antlr plugin adds compile dependency on the whole Antlr

According to offcial Antlr plugin documentation you specify Antlr version used this way:

dependencies {
    antlr group: 'org.antlr', name: 'antlr4', version: '4.5.1'
}

As result:

% gradle depIns --dependency antlr --configuration compile
org.antlr:antlr4:4.5.1
\--- compile

and 1.4 megabytes of antlr4-4.5.1.jar are copied with no purpose to my WEB-INF/lib/. This is because AntlrPlugin.java does the following:

project.getConfigurations().getByName(COMPILE_CONFIGURATION_NAME).extendsFrom(antlrConfiguration);

This is not needed, because antlr itself is only required to generate .java files. ‘compile’ configuration should only contain antlr-runtime (160 kilobytes).

Thanks. This is indeed wrong. I’ve raised GRADLE-3325.

Would you be interested in contributing the fix?

I don’t know when I will find time to work on this - and the fix is not trivial, because the Antlr plugin will need to have two dependencies instead of one, in the same time keeping artifact name and version consistent between antlr and antlr-runtime (and even the artifact name is different between Antlr v3 and v4).

We’re seeing this too. I discovered it while trying to stomp out jars that we’re not supposed to be shipping.

Is there at least a workaround?