Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext-maven-plugin with sources
Xtext-maven-plugin with sources [message #1823032] Wed, 18 March 2020 13:03 Go to next message
Alexandra Tritean is currently offline Alexandra TriteanFriend
Messages: 18
Registered: March 2020
Junior Member

Is it possible to specify a resource/folder as input for the xtext-maven-plugin?

I'm using it like this

To be more explicit with what I'm trying to achieve:
I have two grammars. I will reffer to them further by the file extension, to be more easier. My generator (implemented in Xtend) uses a .datamodel file to generate a corresponding .model file in the output directory specified. All good until now. But as a new step, I also need an additional file (a properties file) to generate some more details in my .model file. The properties file is located in the same project as my .datamodel file. For the generator, I'm using a Java helper to get this file by doing something like this.
 String platformString = datamodelResource.getURI().toPlatformString(true);
 IFile resourceFile = ResourcesPlugin.getWorkspace().getRoot().getFile( new Path(platformString));
 IProject correspondingProject = resourceFile.getProject();
 File contextParamFile = getCorrespondingContextParamFile(correspondingProject);

This works perfectly fine when the generation is done automatically (doing a change in .datamodel file -> .model file is regenerated).
But, when doing a maven clean install on my project I'm getting the following error java.lang.IllegalStateException: Workspace is closed generated by the ResourcesPlugin.getWorkspace() operation.

I was wondering if there is a way to send the properties file as an argument to my generator to avoid doing 'workspace operations'.

Thank you!

Kind Regards,

Re: Xtext-maven-plugin with sources [message #1823452 is a reply to message #1823032] Thu, 26 March 2020 20:34 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13724
Registered: July 2009
Senior Member
can you please provide a complete example and error message / exception from log

p.s: do you know IFileSystemAccess2 (and IFileSystemAccess*Extension) have also methods to read

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :

[Updated on: Thu, 26 March 2020 20:35]

Report message to a moderator

Previous Topic:how to create an external cross-reference in the AST
Next Topic:Xtext YAML Grammar
Goto Forum:

Current Time: Mon Jan 25 23:38:01 GMT 2021

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

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

Back to the top