Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem with XtextLinkingDiagnostic
Problem with XtextLinkingDiagnostic [message #882975] Thu, 07 June 2012 11:09 Go to next message
kon f is currently offline kon f
Messages: 112
Registered: March 2012
Senior Member

I would like to perform the generation process without need of starting an Eclipse instance. It just takes to much time and I'm currently working only on the generation process. The process works fine if I just use one Resource for generation.

If I have two Resources that contain references to each other, the validation results in the following error :

XtextLinkingDiagnostic: null:51 Couldn't resolve reference to SubProduct 'productNameXYZ'.

Here is the extracted part of my GenerationClass:

private Provider<ResourceSet> resourceSetProvider;

private IResourceValidator validator;

private IGenerator generator;

private JavaIoFileSystemAccess fileAccess;

public static void main(String[] args) {
    if (args.length == 0) {
	System.err.println("Aborting: no path to EMF resource provided!");
    Injector injector = new org.product.ProductStandaloneSetupGenerated()
    ProductGeneratorRunner main = injector

public List<Issue> runGenerator(String[] paths) {
	// load the resource
	ResourceSet set = resourceSetProvider.get();

	List<Resource> resources = new ArrayList<Resource>();

	for (String path : paths) {
		Resource resource = set.getResource(URI.createURI(path), true);

	for (Resource resource : resources) {
		List<Issue> issues = validator.validate(resource, CheckMode.ALL,
		if (!issues.isEmpty()) {
			for (Issue issue : issues) {
			return issues;
		generator.doGenerate(resource, fileAccess);

	System.out.println("Code generation finished.");

	return null;

Somehow is Xtext aware of the referenced file if I execute the generation process with an Eclipse instance. How can I resolve this issue? Thank you.

Re: Problem with XtextLinkingDiagnostic [message #883000 is a reply to message #882975] Thu, 07 June 2012 12:02 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6211
Registered: July 2009
Senior Member

i cannot reproduce this problem. please note: in standalone mode you have to add all involved resource to the resourceset.
so are you sure you added the file containing productNameXYZ to the resourceset?

Previous Topic:Ecore Modell from extisting Grammar
Next Topic:How to support implicit imports?
Goto Forum:

Current Time: Fri Aug 22 09:47:41 EDT 2014

Powered by FUDForum. Page generated in 0.01767 seconds