Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [SOLVED] Reference genmodel of another DSL relative to the platform
[SOLVED] Reference genmodel of another DSL relative to the platform [message #1727899] Tue, 29 March 2016 07:26 Go to next message
Tam Gom is currently offline Tam GomFriend
Messages: 36
Registered: July 2011
Member
Hi all,

I have two DSLs created with Xtext 2.9.1, where one DSL has cross references to the other.

For example I can define something like this in DSL A:

package myservice

service MyService {
     list : GET 
     get : GET
     save : POST
}


Then I can use the defined service and its methods in DSL B:

package myclient
import myservice

client MyService {
     list
     get
}


When I reference DSL A's grammar I have to give the path of DslA.genmodel in GenerateDslB.mwe2:

		
language = StandardLanguage {
    // FIXME: only absolute path works for me
    referencedResource = "platform:/resource/org.xtext.example.dsla/model/generated/DslA.genmodel"
    //referencedResource = "file:///path/to/dsla/org.xtext.example.dsla/model/generated/DslA.genmodel"
    name = "org.xtext.example.mydsl.DslB"
    fileExtensions = "dslb"

    serializer = {
        generateStub = false
    }
    validator = {
        // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
    }
}


In the above code snippet if I define the referencedResource variable starting with "platform:/resource..." I get the following exception during Xtext generation:

348  [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems running workflow org.xtext.example.mydsl.GenerateDslB: java.io.IOException: The path '/org.xtext.example.dsla/model/generated/DslA.genmodel' is unmapped
java.lang.RuntimeException: Problems running workflow org.xtext.example.mydsl.GenerateDslB: java.io.IOException: The path '/org.xtext.example.dsla/model/generated/DslA.genmodel' is unmapped
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:104)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.IOException: The path '/org.xtext.example.dsla/model/generated/DslA.genmodel' is unmapped
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
	at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:265)
	at org.eclipse.xtext.xtext.generator.XtextGeneratorResourceSetInitializer.loadResource(XtextGeneratorResourceSetInitializer.java:57)
	at org.eclipse.xtext.xtext.generator.XtextGeneratorResourceSetInitializer.access$0(XtextGeneratorResourceSetInitializer.java:54)
	at org.eclipse.xtext.xtext.generator.XtextGeneratorResourceSetInitializer$1.apply(XtextGeneratorResourceSetInitializer.java:46)
	at org.eclipse.xtext.xtext.generator.XtextGeneratorResourceSetInitializer$1.apply(XtextGeneratorResourceSetInitializer.java:1)
	at org.eclipse.xtext.xbase.lib.IteratorExtensions.forEach(IteratorExtensions.java:363)
	at org.eclipse.xtext.xbase.lib.IterableExtensions.forEach(IterableExtensions.java:333)
	at org.eclipse.xtext.xtext.generator.XtextGeneratorResourceSetInitializer.initialize(XtextGeneratorResourceSetInitializer.java:49)
	at org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage.initialize(XtextGeneratorLanguage.java:206)
	at org.eclipse.xtext.xtext.generator.StandardLanguage.initialize(StandardLanguage.java:166)
	at org.eclipse.xtext.xtext.generator.XtextGenerator.initialize(XtextGenerator.java:176)
	at org.eclipse.xtext.xtext.generator.XtextGenerator.checkConfigurationInternal(XtextGenerator.java:120)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2.checkConfiguration(AbstractWorkflowComponent2.java:21)
	at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.preInvoke(Mwe2Bridge.java:65)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.preInvoke(AbstractWorkflowComponent.java:197)
	at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.preInvoke(AbstractCompositeWorkflowComponent.java:29)
	at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:18)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
	... 4 more
Caused by: java.io.IOException: The path '/org.xtext.example.dsla/model/generated/DslA.genmodel' is unmapped
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:535)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:360)
	at org.eclipse.xtext.resource.XtextResourceSet$1.createInputStream(XtextResourceSet.java:298)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1269)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	... 22 more


If I use the absolute path of DslA.genmodel in my filesystem as you can see in the line commented out in the snippet, it works fine.

Could you please help how I can define the path of DslA.genmodel relative to the platform properly?

I attached a working example of my case to this comment.

Thank you.

[Updated on: Tue, 29 March 2016 09:02]

Report message to a moderator

Re: Reference genmodel of another DSL relative to the platform [message #1727901 is a reply to message #1727899] Tue, 29 March 2016 07:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
calling from eclipse work fine with xtext 2.9.2.

is this about maven?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Reference genmodel of another DSL relative to the platform [message #1727903 is a reply to message #1727901] Tue, 29 March 2016 07:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
if this is about maven then add eithera feature containing dsla to the target of dslb or add a maven dep. to the maven-exec-plugin call in dslbs pom

<dependency>
<groupId>org.xtext.example.dsla</groupId>
<artifactId>org.xtext.example.dsla</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Reference genmodel of another DSL relative to the platform [message #1727905 is a reply to message #1727901] Tue, 29 March 2016 07:56 Go to previous messageGo to next message
Tam Gom is currently offline Tam GomFriend
Messages: 36
Registered: July 2011
Member
This happens if I right-click on DslB.xtext in Eclipse and press Run As -> Generate Xtext Artifacts, so Maven is not involved.

Sorry my example used 2.9.0 instead of 2.9.1, but I still get the error if I set the version to 2.9.2.
Re: Reference genmodel of another DSL relative to the platform [message #1727906 is a reply to message #1727905] Tue, 29 March 2016 08:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
you have to update eclipse plugins for 2.9.2.

there where serious issues on this in 2.9.0 and 2.9.1.



Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 29 March 2016 08:09]

Report message to a moderator

Re: Reference genmodel of another DSL relative to the platform [message #1727907 is a reply to message #1727901] Tue, 29 March 2016 07:56 Go to previous messageGo to next message
Tam Gom is currently offline Tam GomFriend
Messages: 36
Registered: July 2011
Member
This happens if I right-click on DslB.xtext in Eclipse and press Run As -> Generate Xtext Artifacts, so Maven is not involved.

Sorry my example used 2.9.0 instead of 2.9.1, but I still get the error if I set the version to 2.9.2.
Re: Reference genmodel of another DSL relative to the platform [message #1727909 is a reply to message #1727906] Tue, 29 March 2016 09:00 Go to previous message
Tam Gom is currently offline Tam GomFriend
Messages: 36
Registered: July 2011
Member
Great, it works now, thank you very much!
Previous Topic:Re: Reference genmodel of another DSL relative to the platform
Next Topic:Missing xmi file. What is it? Where should it come from?
Goto Forum:
  


Current Time: Fri Sep 24 19:29:55 GMT 2021

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

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

Back to the top