ST4 dependencies - turtles all the way down

76 views
Skip to first unread message

michael...@gmail.com

unread,
Aug 14, 2013, 12:31:45 AM8/14/13
to antlr-di...@googlegroups.com
Hi folks,

I'm working on a project involving generating Java source so naturally I want to use ST4 :) The problem is its dependency on multiple ANTLR versions...

+- org.antlr:ST4:jar:4.0.7:compile
\- org.antlr:antlr-runtime:jar:3.5:compile
\- org.antlr:stringtemplate:jar:3.2.1:compile
\- antlr:antlr:jar:2.7.7:compile

My project already uses ANTLR v4.1 so adding ST4 would result in *three* versions of ANTLR in the dependency graph. This is freaking out my users - especially those who have to negotiate with standards committees.

So my questions are:

1 Is it possible to exclude any of the above dependencies and still have stuff work ?

2. Are there any firm plans for a cleaner version of ST4 ?

3. Has anyone forked ST4 or parts thereof to address the dependency issue ?

cheers
Michael


michael...@gmail.com

unread,
Aug 15, 2013, 12:37:55 AM8/15/13
to antlr-di...@googlegroups.com, michael...@gmail.com
A colleague pointed me to two previous posts that my own trawling had overlooked...

This one from Jim:
https://groups.google.com/forum/#!searchin/antlr-discussion/maven$20dependencies/antlr-discussion/5GtWb6J9lFM/okpwvlvtbo8J

And this from Sam:
https://groups.google.com/forum/#!searchin/antlr-discussion/maven$20dependencies/antlr-discussion/RGvoaB3V3m4/x8QynE8DU9oJ

So, for my maven-based project I have done the following in the pom.xml file:

<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>ST4</artifactId>
<version>4.0.7</version>
<!-- Exclude stringtemplate 3.x (only required for operations -->
<!-- that Jiffle does not perform. This also avoids dragging -->
<!-- in antlr 2.x, although we can't avoid antlr 3.5 -->
<exclusions>
<exclusion>
<artifactId>stringtemplate</artifactId>
<groupId>org.antlr</groupId>
</exclusion>
</exclusions>
</dependency>

Then, instead of three versions of ANTLR and two of StringTemplate, the dependencies reduce to two versions of ANTLR and one of StringTemplate. That still looks a little odd to my users but not as frightening as before.

Does anyone know of a better solution ?

Michael

Ramon Mendes

unread,
Aug 16, 2013, 5:59:42 PM8/16/13
to antlr-di...@googlegroups.com, michael...@gmail.com
Don't use ST4, there are many better options out there, IMHO. I am using Chunk

Terence Parr

unread,
Aug 16, 2013, 6:02:14 PM8/16/13
to antlr-di...@googlegroups.com
I can see that I need to educate a new generation of template users and designers ;)

"Enforcing Strict Model-View Separation in Template Engines":


Ter

--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Terence Parr

unread,
Aug 16, 2013, 8:11:28 PM8/16/13
to antlr-di...@googlegroups.com
Try this one: 


  • Complete ANTLR 3.5 Java binaries w/o legacy ANTLR v2 jar (complete ANTLR 3.5 tool, Java runtime and ST 4.0.7 which should be able to run the tool and the generated code unless you are using output=template; For backward compatibility reasons, ANTLR 3.5 still generates code that uses ST v3 at parse-time.)


--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Dictation in use. Please excuse homophones, malapropisms, and nonsense. 

Michael Bedward

unread,
Aug 16, 2013, 9:05:52 PM8/16/13
to antlr-di...@googlegroups.com
On 17 August 2013 10:11, Terence Parr <pa...@cs.usfca.edu> wrote:
>
> Try this one:
>
> http://www.antlr3.org/download/antlr-3.5-complete-no-st3.jar
>

I guess that is equivalent to what I arrived at with maven:

<dependency>
<groupId>org.antlr</groupId>
<artifactId>ST4</artifactId>
<version>4.0.7</version>
<!-- Exclude stringtemplate 3.x (only required for operations -->
<!-- that Jiffle does not perform. This also avoids dragging -->
<!-- in antlr 2.x, although we can't avoid antlr 3.5 -->
<exclusions>
<exclusion>
<artifactId>stringtemplate</artifactId>
<groupId>org.antlr</groupId>
</exclusion>
</exclusions>
</dependency>

Michael
Reply all
Reply to author
Forward
0 new messages