Q:

found no viable alternative - Ruta in Java Maven project

The below script runs fine in Ruta workbench.  Whereas, when I include the same in an existing Java Maven project which triggers the Ruta script, I get "found no viable alternative" exception.  Why does it happen ?  How to resolve such exception ? 
Script:
    CssDefinition{->onlyClass=false, family = CssDefinition.fontfamily, size = CssDefinition.fontsize, color = CssDefinition.fontcolor}
        <-{CssStyles{PARSE(cssStylesStr),IF(contains(cssStylesStr,tagClass))};};

Stacktrace:
Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.string.bool. BooleanOperationsExtension
Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.string. StringOperationsExtension
Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block. OnlyFirstBlockExtension
Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block. OnlyOnceBlockExtension
Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block.fst. FSTBlockExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.string.bool. BooleanOperationsExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.string. StringOperationsExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block. OnlyFirstBlockExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block. OnlyOnceBlockExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine. RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block.fst. FSTBlockExtension
Jan 10, 2017 5:05:12 PM org.apache.uima.ruta.engine. HtmlConverter mapAnnotations(454)
WARNING: illegal annotation offset mapping
Jan 10, 2017 5:05:12 PM org.apache.uima.ruta.engine. HtmlConverter mapAnnotations(454)
WARNING: illegal annotation offset mapping

org.apache.uima.resource. ResourceInitializationException: Initialization of annotator class "org.apache.uima.ruta.engine. RutaEngine" failed.   (Descriptor: file:/home/Documents/Ruta/TestEngine.xml)
at org.apache.uima.analysis_engine.impl. PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:254)
at org.apache.uima.analysis_engine.impl. PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:158)
at org.apache.uima.impl. AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
at org.apache.uima.impl. CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
at org.apache.uima. UIMAFramework.produceResource(UIMAFramework.java:269)
at org.apache.uima. UIMAFramework.produceAnalysisEngine(UIMAFramework.java:354)
at org.apache.uima.fit.factory. AnalysisEngineFactory.createEngine(AnalysisEngineFactory.java:208)
at com.pagemajik.explico.stylekit. ArtifactAnnotator.runScript(ArtifactAnnotator.java:322)
at com.pagemajik.explico.stylekit. ArtifactAnnotator.getAllAnnotations(ArtifactAnnotator.java:88)
at com.pagemajik.explico.stylekit. MainFormatter.format(MainFormatter.java:105)
at com.pagemajik.explico.stylekit. Test.main(Test.java:29)
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.file_input(RutaParser.java:733)
at org.apache.uima.ruta.engine. RutaEngine.loadScript(RutaEngine.java:988)
at org.apache.uima.ruta.engine. RutaEngine.initializeScript(RutaEngine.java:704)
at org.apache.uima.ruta.engine. RutaEngine.initialize(RutaEngine.java:465)
at org.apache.uima.analysis_engine.impl. PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:252)
... 10 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.statements(RutaParser.java:832)
at org.apache.uima.ruta.parser. RutaParser.file_input(RutaParser.java:719)
... 14 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.statement(RutaParser.java:1055)
at org.apache.uima.ruta.parser. RutaParser.statements(RutaParser.java:811)
... 15 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.forEachDeclaration(RutaParser.java:3124)
at org.apache.uima.ruta.parser. RutaParser.statement(RutaParser.java:1027)
... 16 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.statements(RutaParser.java:832)
at org.apache.uima.ruta.parser. RutaParser.forEachDeclaration(RutaParser.java:3104)
... 17 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.statement(RutaParser.java:1055)
at org.apache.uima.ruta.parser. RutaParser.statements(RutaParser.java:811)
... 18 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.simpleStatement(RutaParser.java:3450)
at org.apache.uima.ruta.parser. RutaParser.statement(RutaParser.java:1007)
... 19 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.ruleElementsRoot(RutaParser.java:3980)
at org.apache.uima.ruta.parser. RutaParser.simpleStatement(RutaParser.java:3434)
... 20 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.ruleElement(RutaParser.java:4340)
at org.apache.uima.ruta.parser. RutaParser.ruleElementsRoot(RutaParser.java:3923)
... 21 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.simpleStatement(RutaParser.java:3450)
at org.apache.uima.ruta.parser. RutaParser.ruleElement(RutaParser.java:4253)
... 22 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.ruleElementsRoot(RutaParser.java:3980)
at org.apache.uima.ruta.parser. RutaParser.simpleStatement(RutaParser.java:3434)
... 23 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.ruleElement(RutaParser.java:4340)
at org.apache.uima.ruta.parser. RutaParser.ruleElementsRoot(RutaParser.java:3923)
... 24 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.ruleElementType(RutaParser.java:4906)
at org.apache.uima.ruta.parser. RutaParser.ruleElement(RutaParser.java:4178)
... 25 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.conditions(RutaParser.java:5225)
at org.apache.uima.ruta.parser. RutaParser.ruleElementType(RutaParser.java:4852)
... 26 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.condition(RutaParser.java:8663)
at org.apache.uima.ruta.parser. RutaParser.conditions(RutaParser.java:5204)
... 27 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser. RutaParser.conditionIf(RutaParser.java:10386)
at org.apache.uima.ruta.parser. RutaParser.condition(RutaParser.java:8526)
... 28 more
Caused by: org.apache.uima.ruta.extensions. RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:362)
at org.apache.uima.ruta.parser. RutaParser.emitErrorMessage(RutaParser.java:376)
at org.apache.uima.ruta.parser. RutaParser.booleanExpression(RutaParser.java:20012)
at org.apache.uima.ruta.parser. RutaParser.conditionIf(RutaParser.java:10372)
... 29 more

PS:
I've come across the same scenario already with some other script too. 

A:

The parse exception is caused by the configuration of the analysis engine in combination of the setup of the project.  The engine failed to initialize the extension contains the contains string function:
WARNING: Failed to initialze extension org.apache.uima.ruta.string. StringOperationsExtension

As a consequence, the parser can not identify the part IF(contains(cssStylesStr,tagClass)) as a correct condition since contains is no boolean variable or other allowed construct.  Assuming it would be something allowed, then for the next ( there is no viable alternative. 
This problem can most likely be solved by adding ruta-core-ext to the classpath.