Skip to main content



      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 08:01 Go to next message
Eclipse UserFriend
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 08:01] by 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 08:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi

you shoudl generate the java code for the ecore and the use registerGeneratedEPackage
Re: Xtext from ecore model error - couldn't resolve reference to EPackage [message #1707275 is a reply to message #1707274] Thu, 03 September 2015 08:30 Go to previous messageGo to next message
Eclipse UserFriend
P.S: the project containing the .genmodel needs xtextnature (rightclick configure)
Re: Xtext from ecore model error - couldn't resolve reference to EPackage [message #1707276 is a reply to message #1707275] Thu, 03 September 2015 08:31 Go to previous messageGo to next message
Eclipse UserFriend
P.P.S: did you use the project wizard?
Re: Xtext from ecore model error - couldn't resolve reference to EPackage [message #1707493 is a reply to message #1707276] Sat, 05 September 2015 12:34 Go to previous messageGo to next message
Eclipse UserFriend
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 04:00 Go to previous messageGo to next message
Eclipse UserFriend
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 10:12 Go to previous message
Eclipse UserFriend
rightclick -> configure (Add Xtext Nature (Xtext <= 2.9) | Configure Xtext (Xtext 2.10))
Previous Topic:Referring an xcore enum in xtext
Next Topic:Xtext how to write grammar for custom hash comment
Goto Forum:
  


Current Time: Wed Jul 23 16:42:53 EDT 2025

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

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

Back to the top