Enabling Parrot Parser for Groovy Eclipse
See original GitHub issueSince spotless depends on groovy-eclipse for groovy parsing/formatting, and since groovy-eclipse doesn’t enable the parrot parser by default, Spotless fails when configured for groovy code that utilizes Groovy 3+ syntax.
After experiencing some pain with spotless + groovy, I stumbled upon #246 which led me to dig into groovy-eclipse. Turns out groovy-eclipse leaves the new antlr4 based Parrot Parser disabled by default, which means any newer Groovy 3 syntax that contains, for example, Java lambdas, blows up.
I can manually add -Dgroovy.antlr4=true
to my Gradle execution and that gets it working for me locally, but there should be some way to configure this right within build.gradle? I’m trying to find a solution that is more amenable to a team environment.
In the past I’ve modified JavaExec tasks and the like to include forked JVM options. But there seems to be no way to do that for SpotlessTask.
Am I missing something obvious here?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
For the Eclipse WTP formatter you cannot configure everything per project. Some things are still configured for per workspace. The WTP stores them statically. The spotless user doesn’t see this difference. In a multi-project build, you can configure multiple WTP based formatters.
So I propose for
groovy.antlr4
:IllegalArgumentException
I’m struggling to understand what you mean by this. Could you give a bit more context? Thanks for the help already!