Skip to content

Fixing antlr dependencies#5752

Open
nielsbasjes wants to merge 4 commits intospring-projects:mainfrom
nielsbasjes:FixAntlrDependencies
Open

Fixing antlr dependencies#5752
nielsbasjes wants to merge 4 commits intospring-projects:mainfrom
nielsbasjes:FixAntlrDependencies

Conversation

@nielsbasjes
Copy link
Copy Markdown

Changes in this pull request:

  • Problem to fix: The spring-ai-template-st module references the Token class from Antlr to access something in the template library. The template library uses Antlr 3 and the added dependency is the Antlr 4 runtime. It is a miracle that actually worked.

  • Solution: Shade the already provided antlr-runtime (which is V3) and relocate it to a package that is chosen to avoid conflicts with any downstream consuming application.

  • Problem to fix: antlr4-runtime conflicts when used with other libraries that use Antlr4. #5748
    When using Antlr in a project the antlr runtime needs to be an exact matched version of the plugin used to generate the code. If you have a downstream project that has a different dependency that also uses Antlr then there is a high probability there is a conflict in the used runtime and a least one of the components will not work.

  • Solution: Shade the applicable antlr4-runtime and relocate it to a package that is chosen to avoid conflicts with any downstream consuming application. Also: The generated Anltr4 code was committed to the repo which is not needed at all.

  • Chore: Updating to the latest Antlr4 version.

NOTE: I used this pattern to relocate the antlr runtime to. This can be changed to anything as long as the new package avoids conflicts with any downstream users.
shaded.${project.groupId}.${project.artifactId}.library.org.antlr

@nielsbasjes nielsbasjes force-pushed the FixAntlrDependencies branch 2 times, most recently from cae9a55 to 6e0a74d Compare April 9, 2026 12:27
@nielsbasjes nielsbasjes marked this pull request as draft April 9, 2026 14:51
@nielsbasjes nielsbasjes force-pushed the FixAntlrDependencies branch from 6e0a74d to e5c8f92 Compare April 9, 2026 16:27
@nielsbasjes nielsbasjes marked this pull request as ready for review April 9, 2026 16:28
Signed-off-by: Niels Basjes <niels@basjes.nl>
Signed-off-by: Niels Basjes <niels@basjes.nl>
Signed-off-by: Niels Basjes <niels@basjes.nl>
Signed-off-by: Niels Basjes <niels@basjes.nl>
@nielsbasjes nielsbasjes force-pushed the FixAntlrDependencies branch from e5c8f92 to 62b3d9d Compare April 9, 2026 17:31
@nielsbasjes
Copy link
Copy Markdown
Author

Note: The ST4 must be shaded in also because that is the main library that needs the shaded antlr-runtime also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant