Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem with multiple ecore refering
Problem with multiple ecore refering [message #1772902] Mon, 18 September 2017 14:15 Go to next message
Eduardo Silva is currently offline Eduardo SilvaFriend
Messages: 12
Registered: September 2014
Junior Member
Hello everyone,

I'm creating an Xtext grammar to a metamodel I have for some time.
There is an important information regarding this metamodel: It extends another metamodel (lets call it metamodel A).

I would like to build an xtext grammar for the extended metamodel, but only defining the necessary types for the metamodel A. The file extensions are different, depending on which model the user chooses to create the file.

I defined the whole grammar for my metamodel, including the required rules for metamodel A, so the grammar would make sense.

However, now I'm trying to build the project and I'm getting an error

[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: XtextGenerator)
java.lang.IllegalArgumentException: Cannot determine the package name of '<Model>.<ModelPackage>'. Please use the TypeReference(packageName, className) constructor
at org.eclipse.xtext.xtext.generator.model.TypeReference.getPackageName(TypeReference.java:164)


I added the referencedResource to the workflow file as instructed by a tutorial I found, but the problem persists. I'm using xtext version 2.12.0.
Thanks in advance.


Workflow file (simplified, it is mostly the same generated by xtext)
import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var rootPath = ".."

Workflow {
component = XtextGenerator {
<...>
language = StandardLanguage {
<...>
referencedResource = "<MyModel>.genmodel"
referencedResource = "<ModelA>.genmodel"

fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment2 auto-inject {}

fragment = org.eclipse.xtext.generator.adapter.FragmentAdapter {
fragment = org.eclipse.xtext.generator.ecore2xtext.FormatterFragment {}
}

serializer = {
generateStub = false
}
}
}
}

Re: Problem with multiple ecore refering [message #1772903 is a reply to message #1772902] Mon, 18 September 2017 14:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11892
Registered: July 2009
Senior Member
are you sure your ecore sticks to java naming conversions egarding package and class names?

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Problem with multiple ecore refering [message #1772904 is a reply to message #1772903] Mon, 18 September 2017 14:29 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11892
Registered: July 2009
Senior Member
see https://github.com/eclipse/xtext-core/issues/161

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Previous Topic:Partial Parsing Problem
Next Topic:Xtext parser rules overlap problem
Goto Forum:
  


Current Time: Fri Apr 20 01:27:39 GMT 2018

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

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