Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext from ecore model error - couldn't resolve reference to EPackage
Xtext from ecore model error - couldn't resolve reference to EPackage [message #1707273] Thu, 03 September 2015 12:01 Go to next message
Elvis Dowson is currently offline Elvis DowsonFriend
Messages: 65
Registered: December 2011
Member
Hi,

I tried to create a new Xtext project from an existing ecore model, but I get the following error in my Library.xtext file.

Couldn't resolve reference to EPackage 'http://www.emf.com/examples/library'.

I've aded the following entries to my GenerateLibraryDsl.mwe2 file, but the error still persists:

GenerateLibraryDsl.mwe2 file snippet:
Workflow {
	bean = StandaloneSetup {
		scanClassPath  = true
		platformUri = "${runtimeProject}/.."
		registerGeneratedEPackage = "com.emf.examples.library.model.library.LibraryPackage"
		registerGenModelFile = "platform:/resource/com.emf.examples.library/model/library.genmodel"
		registerEcoreFile = "platform:/resource/com.emf.examples.library/model/library.ecore"
	}


LibraryDsl.xtext file contents:
// automatically generated by Xtext
grammar org.xtext.example.librarydsl.LibraryDsl with org.eclipse.xtext.common.Terminals

import "http://www.emf.com/examples/library"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Library returns Library:
	{Library}
	'Library'
	name=EString
	'{'
		('authors' '{' authors+=Author ( "," authors+=Author)* '}' )?
		('books' '{' books+=Book ( "," books+=Book)* '}' )?
	'}';



Author returns Author:
	{Author}
	'Author'
	name=EString
	'{'
		('books' '(' books+=[Book|EString] ( "," books+=[Book|EString])* ')' )?
	'}';

Book returns Book:
	{Book}
	'Book'
	name=EString;

EString returns ecore::EString:
	STRING | ID;


I have attached the library.ecore and library.genmodel files.

Regards,

Elvis Dowson

[Updated on: Thu, 03 September 2015 12:01]

Report message to a moderator

Re: Xtext from ecore model error - couldn't resolve reference to EPackage [message #1707274 is a reply to message #1707273] Thu, 03 September 2015 12:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13219
Registered: July 2009
Senior Member
Hi

you shoudl generate the java code for the ecore and the use registerGeneratedEPackage


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext from ecore model error - couldn't resolve reference to EPackage [message #1707275 is a reply to message #1707274] Thu, 03 September 2015 12:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13219
Registered: July 2009
Senior Member
P.S: the project containing the .genmodel needs xtextnature (rightclick configure)

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext from ecore model error - couldn't resolve reference to EPackage [message #1707276 is a reply to message #1707275] Thu, 03 September 2015 12:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13219
Registered: July 2009
Senior Member
P.P.S: did you use the project wizard?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext from ecore model error - couldn't resolve reference to EPackage [message #1707493 is a reply to message #1707276] Sat, 05 September 2015 16:34 Go to previous messageGo to next message
Elvis Dowson is currently offline Elvis DowsonFriend
Messages: 65
Registered: December 2011
Member
The solution was to add the xtext nature to the project containing the ecore model. It works fine now.

Thanks!
Re: Xtext from ecore model error - couldn't resolve reference to EPackage [message #1734148 is a reply to message #1707493] Sun, 05 June 2016 08:00 Go to previous messageGo to next message
Amin Endah Sulistiawati is currently offline Amin Endah SulistiawatiFriend
Messages: 1
Registered: June 2016
Junior Member
Hi. How did you add xtext nature to the project containing .genmodel?
Re: Xtext from ecore model error - couldn't resolve reference to EPackage [message #1734244 is a reply to message #1734148] Mon, 06 June 2016 14:12 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13219
Registered: July 2009
Senior Member
rightclick -> configure (Add Xtext Nature (Xtext <= 2.9) | Configure Xtext (Xtext 2.10))

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Referring an xcore enum in xtext
Next Topic:Xtext how to write grammar for custom hash comment
Goto Forum:
  


Current Time: Fri Nov 22 05:02:00 GMT 2019

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

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

Back to the top