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: 37
Registered: March 2020
Member
Hello,

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

I'm using it like this
<plugin>
   <groupId>org.eclipse.xtext</groupId>
   <artifactId>xtext-maven-plugin</artifactId>
   <version>${xtext.version}</version>
   <executions>
      <execution>
	 <id>compile-wkfs</id>
	<goals>
	   <goal>generate</goal>
	</goals>
      </execution>
   </executions>
   <configuration>
      <languages>
         <language>      
            <setup>com.wkfsfrc.rr.tools.ruledesigner.datamodel.
                            DatamodelDslStandaloneSetup</setup>
		<outputConfigurations>
			<outputConfiguration>					
                            <outputDirectory>
                               ${project.basedir}/src/main/resources
                            </outputDirectory>
			</outputConfiguration>
		</outputConfigurations>
	</language>


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,

Alexandra
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: 14669
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[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: Sat Apr 27 03:33:37 GMT 2024

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

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

Back to the top