antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.15k stars 3.7k forks source link

`ANTLR Tool version 4.13.0 used for code generation does not match the current runtime version 4.11.1` on `mvn clean install` #3588

Closed ris58h closed 1 year ago

ris58h commented 1 year ago
  1. Go to css3 grammar.
  2. mvn clean install
[INFO] --- antlr4test:1.22:test (default) @ CSS3 ---
[INFO] Evaluating Scenario: Default Scenario
[INFO] Parsing :/Users/ris/projects/grammars-v4/css3/examples/mdn-at-font-face.css
ANTLR Tool version 4.13.0 used for code generation does not match the current runtime version 4.11.1
ANTLR Runtime version 4.13.0 used for parser compilation does not match the current runtime version 4.11.1
ANTLR Tool version 4.13.0 used for code generation does not match the current runtime version 4.11.1
ANTLR Runtime version 4.13.0 used for parser compilation does not match the current runtime version 4.11.1
[INFO] Parsing :/Users/ris/projects/grammars-v4/css3/examples/bootstrap.min.css
kaby76 commented 1 year ago

The root pom.xml contains one version for Antlr4 (4.13.0), but the plugin sets a different version. The version selected in grammars-v4 is not overriding the version in the plugin as intended. The easiest would be to update the plugin, upgrade here. But that would not fix an entry in the root pom.xml that does not work. Why even have it? The latest version of the plugin is 1.22.

kaby76 commented 1 year ago

I added an issue requesting a new version of the plugin be published. https://github.com/antlr/antlr4test-maven-plugin/issues/89

The problem is that the version in the grammars-v4/pom.xml is the version of the tool, but the version of the Antlr Java runtime is 4.11.1. The tester should not be using two different version numbers. This, again, is why you should be using the Trash toolkit. It uses one, and only one, version number for the tool and runtime, not only for Java, but for all targets. I worked very hard to get this working across all targets.

The alternative is to keep the version fixed on both tool and runtime and never ever change it. This would mean any grammars that have been updated to use specific features of a new version of Antlr have to be removed from Maven testing, or we request a new version of the plugin. I am anticipating the next version of Antlr to have StringTemplate actions, to clean out the "transformGrammars.py" hack. That will mean any "target agnostic grammars" will be converted over to ST actions and untestable with the Maven test plugin.

kaby76 commented 1 year ago

@ris58h Please update and check that the fix works.

ris58h commented 1 year ago

@kaby76 no warnings anymore. Thanks!