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: 94
Registered: May 2010

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>]
  [ <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$
	at org.eclipse.emf.codegen.ecore.Generator$
	at org.eclipse.emf.codegen.ecore.Generator$
	at org.eclipse.emf.codegen.ecore.Generator$PlatformRunnable.start(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.eclipse.equinox.launcher.Main.invokeFramework(
	at org.eclipse.equinox.launcher.Main.basicRun(
	at org.eclipse.equinox.launcher.Main.main(
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$
	... 18 more

Programmatically, we must include the following statement to enable the XCore bundles detection:

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: 31342
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.

Ed Merks
Professional Support:
Previous Topic:Remove item from list using its containment Setting
Next Topic:UnsupportedOperationException when setting a model attribute
Goto Forum:

Current Time: Mon Aug 03 19:12:00 GMT 2020

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

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

Back to the top