Skip to main content



      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 18:24 Go to next message
Eclipse UserFriend
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 11:10 Go to previous message
Eclipse UserFriend
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)
Previous Topic:XText Generator making random mistakes while generating java classes
Next Topic:The feature ..... contains an unresolved proxy
Goto Forum:
  


Current Time: Tue Apr 22 16:46:51 EDT 2025

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

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

Back to the top