Hi! I had a problem in Epackage Imports.
Actually I tried this issue on more complex projects. But, to be more clear on the forum, I used example projects State-Machine and Domain-Model.
I follow thought the Xtext Documentation. Under //The Grammar Language/The Syntax/Epackage Declarations/Epackage Imports, it explains how to import an existing Epackage. I wanted to give it a try and I tried to import Domainmodel grammar to Statemachine. From there on I follow what I understood from the documentation for Epackage imports.
I typed the nsURI of DomainModel.ecore to StateMachine.xtext as import
[...] => I typed this to avoid "You can only use links to eclipse.org sites while you have fewer than 5 messages." But I can assure you that nsURI's and links are working.
grammar org.eclipse.xtext.example.fowlerdsl.Statemachine with org.eclipse.xtext.common.Terminals
generate statemachine "[...]/xtext/example/fowlerdsl/Statemachine"
//added code
import "[...]/xtext.org/example/Domainmodel" as dmodel
and I changed the Standalone attributes and added
bean = StandaloneSetup {
platformUri = "${runtimeProject}/.."
scanClassPath = true
//added code
registerGeneratedEPackage =
"org.eclipse.xtext.example.domainmodel.domainmodel.DomainmodelPackage"
registerGenModelFile =
"platform:/resource/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel/Domainmodel.genmodel"
}
There were no complains from the editor. Then I tried to run the workflow, and it gives:
0 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering platform uri 'C:\PgEc\WS\Jn'
10108 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems instantiating module org.eclipse.xtext.example.fowlerdsl.GenerateStatemachine: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: Problems instantiating module org.eclipse.xtext.example.fowlerdsl.GenerateStatemachine: java.lang.reflect.InvocationTargetException
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:95)
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:74)
...
I also tried other suggested methods on the same documentation section. And no luck. It seems somehow I cannot import the Epackage via
import "[...]xtext.org/example/Domainmodel" as dmodel
statement I checked the net but I couldn't find what I am doing wrong.
Your guidance is appreciated.