Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Deploying xtext features
Deploying xtext features [message #1716548] Fri, 04 December 2015 17:54 Go to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
I have an xtext DSL created from an existing ecore model and built with maven, but opening the editor for the DSL in the deployed user environment results in an injection exception (see attached). What could cause such exceptions?

The error occurs only on the deployed feature in a user environment (which has all the dependencies installed, including the ecore model on which the DSL is based).

One of the exceptions mentions a missing '.xmi' file, but that doesn't seem to be generated by Xtext, and is not present in the development environment where the editor does work.

I'm not sure if this could be the reason but in my pom files I have configured the tycho-compiler-plugin so that it doesn't copy resources, and therefore only class files in source folders are packaged. I'm wondering if there are some non-class files generated by xtext and/or xtend that we should be packaging? Do we need to package the .xtextbin/.xtendbin files?

I'm also attaching the workflow, in case that provides any hints.

Thanks
Re: Deploying xtext features [message #1716552 is a reply to message #1716548] Fri, 04 December 2015 18:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
In this case have a look for the .xtextbin file

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Deploying xtext features [message #1716556 is a reply to message #1716552] Fri, 04 December 2015 19:19 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
So is that the reason? We need to package the .xtextbin files? Anything else?

Is there any documentation about these files?

Thanks
Re: Deploying xtext features [message #1716561 is a reply to message #1716556] Fri, 04 December 2015 20:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Don't know any docs on this. You should package the same core Gen model and plugin.xml as well. You may have a look at build.properties (I don't understand why you don't use tycho defaults

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Deploying xtext features [message #1716562 is a reply to message #1716561] Fri, 04 December 2015 20:26 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
The gen model is in a separate plugin (as the grammar was generated from an existing ecore model, not the other way around), and it is packaged in that plugin.

We don't want our deployed artifacts to include anything other than what is strictly necessary. Using the tycho defaults results in packaging xtend source files, ._trace files, the ANTLR .g and .tokens, and other things that are not needed at runtime.

By the way, there are both .xtextbin files and .xtendbin files. Are both necessary, or just the .xtextbin file(s)?

Re: Deploying xtext features [message #1716563 is a reply to message #1716562] Fri, 04 December 2015 20:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
No they are not necessary

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Deploying xtext features [message #1716569 is a reply to message #1716563] Fri, 04 December 2015 21:40 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
Apparently the ANTLR .tokens file is also necessary. After adding the following to the xtext's project pom.xml it works:

		<resources>
			<resource>
				<targetPath>org/eclipse/papyrusrt/xtumlrt/xtext</targetPath>
				<directory>src-gen/org/eclipse/papyrusrt/xtumlrt/xtext</directory>
				<includes>
					<include>Umlrt.xtextbin</include>
				</includes>
			</resource>
			<resource>
				<targetPath>org/eclipse/papyrusrt/xtumlrt/xtext/parser/antlr/internal</targetPath>
				<directory>src-gen/org/eclipse/papyrusrt/xtumlrt/xtext/parser/antlr/internal</directory>
				<includes>
					<include>InternalUmlrt.tokens</include>
				</includes>
			</resource>
		</resources>
Re: Deploying xtext features [message #1779504 is a reply to message #1716569] Mon, 08 January 2018 21:45 Go to previous messageGo to next message
David Pace is currently offline David PaceFriend
Messages: 19
Registered: March 2013
Junior Member
Thanks for posting this, Ernesto. These two files are indeed needed in the distribution, otherwise an error like this is thrown:

org.eclipse.xtext.resource.FileNotFoundOnClasspathException: Couldn't find resource on classpath. URI was 'classpath:/tld/domain/my/package/MyLanguage.xmi'


I suppose Xtext looks for the .xmi file as a fallback if the .xtextbin can not be located.
Re: Deploying xtext features [message #1779508 is a reply to message #1779504] Mon, 08 January 2018 22:24 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Yes that the fallback / the way it was done in Stone Age Xtext (backw. Compatibility)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Use object as type instead of String
Next Topic:@Traced generate method returning string instead of a IGeneratorNode
Goto Forum:
  


Current Time: Fri Mar 29 11:55:57 GMT 2024

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

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

Back to the top