Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext Referencing Not Working in Java Project
Xtext Referencing Not Working in Java Project [message #1808953] Thu, 04 July 2019 22:24 Go to next message
Damian Rivas is currently offline Damian RivasFriend
Messages: 1
Registered: July 2019
Junior Member
I followed the 15 minute tutorial exactly, with no changes on my part, and everything was working great up until I split up the Blog model into separate files. I kept getting "could not resolve" errors for `HasAuthor` and the `String` type.

I made sure to generate the Xtext artifacts after the second iteration to the grammar, and I reran the plug-in as an Eclipse application.

It just wouldn't work until I converted the Blog package to an Xtext project. Then everything resolved correctly. Was I doing something wrong? Was I supposed to create a new Xtext project all along instead of a Java project? I mean the instructions say to create a new Java project after you run the plug-in for the first time so I'm not sure...

If you want to verify the code...
datatypes.dmodel
datatype String

commons.dmodel
package my.company.common {
	entity HasAuthor {
		author: String
	}
}

blog.dmodel
package my.company.blog {
	import my.company.common.*
	
	entity Blog {
		title: String
		many posts: Post
	}
	
	entity Post extends my.company.common.HasAuthor {
		title: String
		content: String
		many comments: Comment
	}
	
	entity Comment extends HasAuthor {
		content: String
	}
}
Re: Xtext Referencing Not Working in Java Project [message #1809261 is a reply to message #1808953] Fri, 12 July 2019 15:10 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13159
Registered: July 2009
Senior Member
you should

(1) create a xtext projet, create your grammar, run the workflow
(2) start eclipse runtime
(3a) if you already have the grammar based on xtext create a java project and put model files in a source folder (or package within)
(3b) if you dont have xbase yet you can create a general -> project too
(4) if you create a file you are asked if you want to convert the project to a xtext project. you have to answer yes. (you can do the same with right click configure on the project)
(5) make sure you have build automatically on and the file extension is correct (including casing)


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:XText Generator making random mistakes while generating java classes
Next Topic:The feature ..... contains an unresolved proxy
Goto Forum:
  


Current Time: Thu Oct 17 23:28:02 GMT 2019

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

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

Back to the top