Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XCore code generation from command line(I get ClassCastException: XPackageImpl cannot be cast to GenModel while attempting to generate the code)
XCore code generation from command line [message #1795880] Mon, 01 October 2018 16:44 Go to next message
Regent LArcheveque is currently offline Regent LArchevequeFriend
Messages: 92
Registered: May 2010
Member
Hi,

al little question. I try to generate EMF code using the application org.eclipse.emf.codegen.Generator from the command line. The eclipse used to start the application contains EMF and XCore bundles. I get a ClassCastException.
Usage arguments:
  [-projects <project-root-directory>]
  [-dynamicTemplates] [-forceOverwrite | -diff]
  [-generateSchema] [-nonNLSMarkers]
  [-codeFormatting { default | <profile-file> } ]
  [-model] [-edit] [-editor] [-tests]
  [-autoBuild <true|false>]
  [-reconcile]
  <genmodel-file-or-platform-resource-uri>
  [ <target-root-directory> ]

For example:

  generate result/model/Extended.genmodel
org.eclipse.core.runtime.CoreException: EMF Error
	at org.eclipse.emf.codegen.ecore.Generator$PlatformRunnable$1.run(Generator.java:455)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2314)
	at org.eclipse.emf.codegen.ecore.Generator$PlatformRunnable.run(Generator.java:465)
	at org.eclipse.emf.codegen.ecore.Generator$PlatformRunnable.run(Generator.java:133)
	at org.eclipse.emf.codegen.ecore.Generator$PlatformRunnable.start(Generator.java:119)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:199)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:391)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:246)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:595)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1501)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1474)
Caused by: java.lang.ClassCastException: org.eclipse.emf.ecore.xcore.impl.XPackageImpl cannot be cast to org.eclipse.emf.codegen.ecore.genmodel.GenModel
	at org.eclipse.emf.codegen.ecore.Generator$PlatformRunnable$1.run(Generator.java:322)
	... 18 more


Programmatically, we must include the following statement to enable the XCore bundles detection:
resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));


Is there a way to specify enable XCore bundle detection from the command line?

I pursue my investigation.

;-)
Re: XCore code generation from command line [message #1795882 is a reply to message #1795880] Mon, 01 October 2018 17:22 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30372
Registered: July 2009
Senior Member
Sorry, these command line things are really not well maintained because I don't use them and don't actually test them.
Previous Topic:Remove item from list using its containment Setting
Next Topic:UnsupportedOperationException when setting a model attribute
Goto Forum:
  


Current Time: Sun Aug 25 05:04:49 GMT 2019

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

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

Back to the top