Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Xtext-maven-plugin with sources
Xtext-maven-plugin with sources [message #1823032] Wed, 18 March 2020 09:03 Go to next message
Eclipse UserFriend
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 16:34 Go to previous message
Eclipse UserFriend
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

[Updated on: Thu, 26 March 2020 16:35] by Moderator

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


Current Time: Sun Jul 13 21:35:41 EDT 2025

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

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

Back to the top