简体   繁体   中英

Travis CI build error with gradle and Antlr

I have a strange situation where my project builds locally without issue, yet on Travis-CI fails. I'm unsure how to debug / investigate the issue.

The build fails in the generateGrammarSource task (Part of the ANTLR build process). This task reads a ANTLR grammar file and outputs Java source code to be compiled later on in the build process:

/home/travis/build/RichTeaLang/RichTea/src/main/antlr/richTea/compiler/RichTea.g:1:1: unexpected token: grammar error: Token stream error reading grammar(s): /home/travis/build/RichTeaLang/RichTea/src/main/antlr/richTea/compiler/RichTea.g:23:1: unexpected char: '@'

Just to re-iterate, locally, this task executes successfully (Tested on Linux and Mac).

Thanks for any help.

Ok, I've found the issue.

Travis-CI comes bundled with v2.0 of gradle. The ANTLR plugin for gradle requires a later version of gradle for the type of ANTLR grammar that is being compiled.

The solution to the issue is to bundle the gradle wrapper scripts into your repo. Travis CI will then use the wrapper scripts rather than its bundled version of gradle.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM