Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext 1.0 -> 2.0 / import ecore on classpath not working as before
Xtext 1.0 -> 2.0 / import ecore on classpath not working as before [message #703328] Wed, 27 July 2011 12:58 Go to next message
Magnus Jungsbluth is currently offline Magnus JungsbluthFriend
Messages: 5
Registered: July 2011
Junior Member
I'm currently migrating our Xtext 1.0 projects to Xtext 2.0. As far as I understand in Xtext 2.0 the uris referencing the ecore model from the genmodel must match the uri used within the xtext grammar.

In Xtext 1.0 this worked:

  • Create two dsls DslA and DslB
  • Add DslA as plugin dependency of DslB
  • DslB: Add an 'import "classpath:/../DslA.ecore"'
  • DslB: In the workflow, add the referenced genmodel
    fragment = ecore.EcoreGeneratorFragment{referencedGenModels = "classpath:/../DslA.genmodel"


In Xtext 2.0 this fails with

The referenced package 'http ://www.mycompany.com/../DslA' was imported from a different location. Here: 'platform:/resource/com.mycompany.../src-gen/../DslA.ecore


The solution is to add an uriMap to the StandaloneSetup of DslB's workflow
uriMap = {
  from = "platform:/resource/../src-gen/../DslA.ecore"
  to = "classpath:/../DslB.ecore"
}


This was not trivial to figure out, especially cause the error message was masked by some weird invalid super type error (I guess there was some ambiguity) when used in our original projects.

The documentation's section covering classpath imports does not mention this behaviour.

Is this behaviour expected? Why wasn't this a problem with Xtext 1.0
Re: Xtext 1.0 -> 2.0 / import ecore on classpath not working as before [message #703660 is a reply to message #703328] Wed, 27 July 2011 19:58 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13882
Registered: July 2009
Senior Member
Hi,

i guess the reason for this is the changed behaviour of standalonesetup.setplatformuri
this new behaviour does some classpath/project/plugin magic so that classpath uris may not be neccessary any more.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:How can I run xtext from a webservice?
Next Topic:Xtend - nested graph information
Goto Forum:
  


Current Time: Thu Apr 15 10:45:08 GMT 2021

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

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

Back to the top