Skip to main content



      Home
Home » Modeling » Epsilon » load xtext dsl during ant build
load xtext dsl during ant build [message #1865172] Sat, 27 April 2024 11:47 Go to next message
Eclipse UserFriend
Hi,

I'm want to create a DSL with xtext and transform it with eclipse epsilon, but i'm running into problems. I have done the following:

I have created the default xtext project, I can then start a runtime eclipse environment, create a file with the DSL (and correct extension) and finally run successfully EOL scripts on that file. That file is then loaded as an EMF model. This I can get to work.

Now I want to do the same but then within ANT. So I created ant that I could run from the command line, outside of eclipse: ie. https://eclipse.dev/epsilon/doc/articles/running-epsilon-ant-tasks-from-command-line
This will run. I then added the jar and called the doSetup with epsilon.java.executeStaticMethod task. from the setup i don't get any error, but from loading the dsl file I get the following error:
java.lang.NoSuchFieldError: Class org.antlr.runtime.Token does not have member field 'org.antlr.runtime.Token EOF_TOKEN' xtext

There is indeed no EOF_TOKEN in org.antlr.runtime.Token (atleast for ANTLR version 3.5.2, which epsilon 2.5 is using), there is an EOF.

After some research in maven repositories I see that xtext runtime 2.34.0 is depending on ANTLR 3.2, while epsilon 2.5 is depending on 3.5.2.

Does anyone have an solution for this problem?
I also don't get why it seems to work within eclipse, but outside in an ant file I get the error.

With Kind regards,

Michiel Fortuin
Re: load xtext dsl during ant build [message #1865175 is a reply to message #1865172] Sat, 27 April 2024 11:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi Michiel,

Epsilon and Xtext requiring different versions of ANTLR is not a problem in Eclipse because OSGi loads each plugin using its own classloader. As far as I know, in Ant (at least under its default settings) there's only one classloader and therefore multiple versions of the same library cannot co-exist.

Thanks,
Dimitris
Re: load xtext dsl during ant build [message #1865181 is a reply to message #1865175] Sat, 27 April 2024 12:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dimitris,

So if i understand this correct because the 2 antlr versions are not compatible, it is not possible to both have xtext and epsilon running in a same instance of Ant, unless xtext would update to a newer antlr.

Okeey, because xtext is not going to update any time soon, I'm going to look at different options.

Thank you for the quick answer.

Michiel Fortuin
Re: load xtext dsl during ant build [message #1865184 is a reply to message #1865181] Sat, 27 April 2024 13:02 Go to previous messageGo to next message
Eclipse UserFriend
This is correct. Before giving up it may be worth trying to add a direct dependency to different versions of ANTLR between 3.2 and 3.5.2 in case there's a version that both Xtext and Epsilon are not too unhappy about.

Thanks,
Dimitris
Re: load xtext dsl during ant build [message #1865199 is a reply to message #1865184] Sun, 28 April 2024 03:22 Go to previous messageGo to next message
Eclipse UserFriend
Thank you, I have it now working, but as a software engineer I see this as a possible future problem. This is a problem of the Antlr runtime. I have noticed in other project that Antlr binaries aren't always compatible with each other as you would expect (as in semver). In that case it was in Antlr4 and not so much in Antlr3, but I do notice that tendency in that project. It is never a problem with a single parser, but with multiple parsers in different libraries it's will become a problem.

But for now I have a solution, I now a direct dependency to Antlr 3.4 and both epsilon and xtext seems to be working.
Re: load xtext dsl during ant build [message #1865208 is a reply to message #1865199] Sun, 28 April 2024 08:15 Go to previous messageGo to next message
Eclipse UserFriend
It's good to hear that you got this to work by fixing the version of ANTLR to 3.4 and many thanks for sharing your solution!

Cheers,
Dimitris
Re: load xtext dsl during ant build [message #1865385 is a reply to message #1865208] Thu, 02 May 2024 04:09 Go to previous message
Eclipse UserFriend
Just to add to this discussion around Xtext and ANTLR, here is a link that may be useful to understand how Xtext relies on some very specific internal details of ANTLR 3.x:

https://github.com/eclipse/xtext/discussions/2794
Previous Topic:Using EGL to instantiate an excel file
Next Topic:serialize ecl matchtrace
Goto Forum:
  


Current Time: Fri Oct 31 21:26:23 EDT 2025

Powered by FUDForum. Page generated in 0.05350 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top