Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XText Generator making random mistakes while generating java classes(XText Generator making random mistakes while generating java classes)
XText Generator making random mistakes while generating java classes [message #1796034] Thu, 04 October 2018 11:37 Go to next message
Mehmetcan Sinir is currently offline Mehmetcan SinirFriend
Messages: 54
Registered: September 2018
Member
I have a quite large grammar.

When I generate the Xtext Artifacts, many many java classes are generated. Generators run successfully. However, almost always some of the classes which are generated have random mistakes in them, which makes them unable to compile.

It is usually only one or two .java classes among almost a hundred which have mistakes, and it is not the same classes, the mistakes seem to come randomly.

Bit it is usually inside the the package implementation class.

Here is an example mistake:

  public EClass getActionDeclaration()
  {
    if (actionDeclarationEClass == null)
    {
      actionDeclarationEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(HmiPackage.eNS_URI).getEClassifiers().g(96);
    }
    return compositeActionEClass;
  }


this code should actually look like this:

  public EClass getActionDeclaration()
  {
    if (actionDeclarationEClass == null)
    {
      actionDeclarationEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(HmiPackage.eNS_URI).getEClassifiers().get(92);
    }
    return actionDeclarationEClass;
  }


so the instead of "get" there is "g"

Here is my Workflow, if that helps:

module de.bmw.rhmi.GenerateHmi

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*
import org.eclipse.emf.mwe.utils.*

var rootPath = ".."
var projectName = "de.bmw.rhmi"
var runtimeProject = "../${projectName}"

Workflow {

	bean = StandaloneSetup {
		scanClassPath = true
		platformUri = "${rootPath}"
		registerGenModelFile = "platform:/resource/de.bmw.rhmi.resource/model/generated/Strings.genmodel"
		registerGenModelFile = "platform:/resource/de.bmw.rhmi.resource/model/Image.genmodel"
		registerGenModelFile = "platform:/resource/de.bmw.rhmi/model/generated/App.genmodel"
		registerGenModelFile = "platform:/resource/de.bmw.rhmi/model/generated/Hmi.genmodel"
		registerGeneratedEPackage = "de.bmw.rhmi.resource.image.ImagePackage"
		registerGeneratedEPackage = "de.bmw.rhmi.resource.strings.StringsPackage"
	}

	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "de.bmw.rhmi"
				rootPath = rootPath
				runtimeTest = {
					enabled = true
				}
				genericIde = {
					enabled = true
				}
				mavenLayout = true
			}
			code = {
				encoding = "UTF-8"
				lineDelimiter = "\n"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
			}
		}

		language = XtextGeneratorLanguage {
			name = "de.bmw.rhmi.App"
			fileExtensions = "rapp"
			referencedResource = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
			fragment = grammarAccess.GrammarAccessFragment2 {}
			fragment = ecore.EMFGeneratorFragment2 {}
			fragment = serializer.SerializerFragment2 {}
			fragment = resourceFactory.ResourceFactoryFragment2 {}
			fragment = parser.antlr.XtextAntlrGeneratorFragment2 {}
			fragment = validation.ValidatorFragment2 {}
			fragment = scoping.ImportNamespacesScopingFragment2 {}
			fragment = exporting.QualifiedNamesFragment2 {}
			fragment = builder.BuilderIntegrationFragment2 {}
			fragment = formatting.Formatter2Fragment2 {}
			fragment = ui.labeling.LabelProviderFragment2 {}
			fragment = ui.outline.QuickOutlineFragment2 {}
			fragment = ui.outline.OutlineTreeProviderFragment2 {}
			fragment = ui.quickfix.QuickfixProviderFragment2 {}
			fragment = ui.contentAssist.ContentAssistFragment2 {}
			fragment = junit.JUnitFragment {}
			fragment = ui.refactoring.RefactorElementNameFragment2 {}
			fragment = ui.templates.CodetemplatesGeneratorFragment2 {}
			fragment = ui.compare.CompareFragment2 {}
			fragment = idea.parser.antlr.XtextAntlrIDEAGeneratorFragment {}
			fragment = ui.projectWizard.TemplateProjectWizardFragment {}
			fragment = ui.fileWizard.TemplateFileWizardFragment {}
		}

		language = XtextGeneratorLanguage {
			referencedResource = "platform:/resource/de.bmw.rhmi/src/main/java/de/bmw/rhmi/App.xtext"
			name = "de.bmw.rhmi.Hmi"
			fileExtensions = "hmi"
			referencedResource = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
			fragment = grammarAccess.GrammarAccessFragment2 {}
			fragment = ecore.EMFGeneratorFragment2 {}
			fragment = serializer.SerializerFragment2 {}
			fragment = resourceFactory.ResourceFactoryFragment2 {}
			fragment = parser.antlr.XtextAntlrGeneratorFragment2 {}
			fragment = validation.ValidatorFragment2 {}
			fragment = scoping.ImportNamespacesScopingFragment2 {}
			fragment = exporting.QualifiedNamesFragment2 {}
			fragment = builder.BuilderIntegrationFragment2 {}
			fragment = formatting.Formatter2Fragment2 {}
			fragment = ui.labeling.LabelProviderFragment2 {}
			fragment = ui.outline.QuickOutlineFragment2 {}
			fragment = ui.outline.OutlineTreeProviderFragment2 {}
			fragment = ui.quickfix.QuickfixProviderFragment2 {}
			fragment = ui.contentAssist.ContentAssistFragment2 {}
			fragment = junit.JUnitFragment {}
			fragment = ui.refactoring.RefactorElementNameFragment2 {}
			fragment = ui.templates.CodetemplatesGeneratorFragment2 {}
			fragment = ui.compare.CompareFragment2 {}
			fragment = idea.parser.antlr.XtextAntlrIDEAGeneratorFragment {}
			fragment = ui.projectWizard.TemplateProjectWizardFragment {}
			fragment = ui.fileWizard.TemplateFileWizardFragment {}
		}
	}
}


Why is this happening?

My Idea was to increase the timeout variable for the generator, but I am not sure if that has to do with it or how to do it.
Re: XText Generator making random mistakes while generating java classes [message #1796035 is a reply to message #1796034] Thu, 04 October 2018 11:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
Can you please ask in the emf forum what could cause this?
PS there is a slow down the the forum to avoid spamming so please be patient when creating questions to avoid duplicate posts


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1796038 is a reply to message #1796035] Thu, 04 October 2018 11:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
PS does this happen from maven or from eclipse ?
Which Xtext and emf version do you use?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1796040 is a reply to message #1796038] Thu, 04 October 2018 12:06 Go to previous messageGo to next message
Mehmetcan Sinir is currently offline Mehmetcan SinirFriend
Messages: 54
Registered: September 2018
Member
not sure what you mean if it happens from maven or eclipse

I am using xtext version 2.14.0

All I do is click generate xtext artifacts, and then the classes are generated.

But now I see that there is always a problem in the HmiPackage.java class
Re: XText Generator making random mistakes while generating java classes [message #1796046 is a reply to message #1796040] Thu, 04 October 2018 12:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
Yes that class is generated by the emf generator.
As written in emf forum. Make sure you don't run two workflows at the same time
Wait for the build to finish before calling generate Xtext artifacts again


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

[Updated on: Thu, 04 October 2018 12:32]

Report message to a moderator

Re: XText Generator making random mistakes while generating java classes [message #1796067 is a reply to message #1796046] Thu, 04 October 2018 15:59 Go to previous messageGo to next message
Mehmetcan Sinir is currently offline Mehmetcan SinirFriend
Messages: 54
Registered: September 2018
Member
I think i found the solution
it has to do with the runTimeVersion Attribute of the genmodels.

I realize that when the genmodels are generated by xtext, runtime version is automatically set to 2.14, which causes the genmodels to be corrupted (i.e. when I try to open them, I get an illegal runtimeVersion error)
They only get better if I set the runtimeVersion Attribute manually to 2.2

If I do this (change the runtime version), delete everything in the xtext-gen folder, and regenerate the model code, everything works as expected.

How can I make it so that, when xtext generates the genmodels, the runtime version is automatically 2.2? Or that 2.14 is an accepted runtime Version?

Does this have to do with the EMF Version not being in sync ? I don't understand

[Updated on: Thu, 04 October 2018 16:10]

Report message to a moderator

Re: XText Generator making random mistakes while generating java classes [message #1796070 is a reply to message #1796067] Thu, 04 October 2018 16:18 Go to previous messageGo to next message
Mehmetcan Sinir is currently offline Mehmetcan SinirFriend
Messages: 54
Registered: September 2018
Member
How can I change the runtime version of my EMF Generator

[Updated on: Thu, 04 October 2018 16:19]

Report message to a moderator

Re: XText Generator making random mistakes while generating java classes [message #1796074 is a reply to message #1796070] Thu, 04 October 2018 17:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
You should be able to set emfRuntimeVersion on the emf fragment

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1796078 is a reply to message #1796074] Thu, 04 October 2018 17:57 Go to previous messageGo to next message
Mehmetcan Sinir is currently offline Mehmetcan SinirFriend
Messages: 54
Registered: September 2018
Member
thanks, but what I don't understand is, when the runtimeVersion is set to 2.14 (automatically by xtext), why do you get an IllegalArgumentException saying
the value is not a valid enumerator of GenRuntimeVersion, when I try to open the generated genModel file by xtext
Re: XText Generator making random mistakes while generating java classes [message #1796079 is a reply to message #1796078] Thu, 04 October 2018 18:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
I don't know which emf you have configured in eclipse and which is pulled by gradle
It might be that gradle does (and will if you don't use xtext 2.15) pull a newer emf version
But you still might have installed emf 2.12 in eclipse


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1796081 is a reply to message #1796079] Thu, 04 October 2018 18:32 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6439
Registered: July 2009
Senior Member
Hi

An inconsistent EMF or an unwise runtime version might give consistently no generation or consistently unhelpful code, but the kind of error you identify seems very unlikely to be from this cause.

Regards

Ed Willink
Re: XText Generator making random mistakes while generating java classes [message #1796116 is a reply to message #1796081] Fri, 05 October 2018 12:20 Go to previous messageGo to next message
Mehmetcan Sinir is currently offline Mehmetcan SinirFriend
Messages: 54
Registered: September 2018
Member
the issue is resolved, I have no idea why, but

I imported the project as a new gradle project,.

removed this line in build gradle:

compile group: 'org.eclipse.xtext', name: 'org.eclipse.xtext.common.types', version: '2.14.0'


now the code generator is not making any mistake
Re: XText Generator making random mistakes while generating java classes [message #1796124 is a reply to message #1796116] Fri, 05 October 2018 14:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
This sounds bogus to me. But we would still need a reproducible example and a github issue to investigate

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1809211 is a reply to message #1796124] Thu, 11 July 2019 16:25 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 44
Registered: January 2013
Member
I get the same error with Xtext 2.18.0 and EMF 2.18.0:

This is the stack trace of the Maven build:

Jul 11, 2019 6:09:33 PM org.eclipse.emf.mwe.utils.StandaloneSetup setResourceSet
INFORMATION: Using resourceSet registry. The registered Packages will not be registered in the global EPackage.Registry.INSTANCE!
597  ERROR Mwe2Launcher       - Problems running workflow de.abas.screen.smartscreen.GenerateSmartScreen: org.eclipse.emf.ecore.xmi.IllegalV
alueException: Value '2.18' is not legal. (platform:/resource/de.abas.screen.model.screen/model/screen.genmodel, 9, 71)
java.lang.RuntimeException: Problems running workflow de.abas.screen.smartscreen.GenerateSmartScreen: org.eclipse.emf.ecore.xmi.IllegalValue
Exception: Value '2.18' is not legal. (platform:/resource/de.abas.screen.model.screen/model/screen.genmodel, 9, 71)
        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)
        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:498)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.IllegalValueException:
 Value '2.18' is not legal. (platform:/resource/de.abas.screen.model.screen/model/screen.genmodel, 9, 71)
        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:51)

        at org.eclipse.xtext.xtext.generator.XtextGeneratorResourceSetInitializer.lambda$initialize$0(XtextGeneratorResourceSetInitializer.j
ava:41)
        at java.util.ArrayList.forEach(ArrayList.java:1257)
        at org.eclipse.xtext.xtext.generator.XtextGeneratorResourceSetInitializer.initialize(XtextGeneratorResourceSetInitializer.java:43)
        at org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage.initialize(XtextGeneratorLanguage.java:218)
        at org.eclipse.xtext.xtext.generator.XtextGenerator.initialize(XtextGenerator.java:185)
        at org.eclipse.xtext.xtext.generator.XtextGenerator.checkConfigurationInternal(XtextGenerator.java:139)
        at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2.checkConfiguration(AbstractWorkflowComponent2.java:22)
        at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.preInvoke(Mwe2Bridge.java:68)
        at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.preInvoke(AbstractWorkflowComponent.java:207)
        at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.preInvoke(AbstractCompositeWorkflowComponent.java:30)
        at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
        at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
        ... 10 more
Caused by: org.eclipse.emf.ecore.xmi.IllegalValueException: Value '2.18' is not legal. (platform:/resource/de.abas.screen.model.screen/model
/screen.genmodel, 9, 71)
        at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2697)
        at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:2751)
        at org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:79)
        at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:2229)
        at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1366)
        at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1504)
        at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1026)
        at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:78)
        at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1008)
        at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:719)
        at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:190)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:745)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359)

        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1289
)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.
java:3132)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:852)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
        at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
        at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
        at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
        at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1297)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
        ... 24 more
Caused by: java.lang.IllegalArgumentException: The value '2.18' is not a valid enumerator of 'GenRuntimeVersion'
        at org.eclipse.emf.codegen.ecore.genmodel.impl.GenModelFactoryImpl.createGenRuntimeVersionFromString(GenModelFactoryImpl.java:394)
        at org.eclipse.emf.codegen.ecore.genmodel.impl.GenModelFactoryImpl.createFromString(GenModelFactoryImpl.java:114)
        at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.createFromString(XMLHelperImpl.java:1615)
        at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.setValue(XMLHelperImpl.java:1156)
        at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2692)
        ... 54 more


In my genmodel I set the runtime version to 2.18.
Re: XText Generator making random mistakes while generating java classes [message #1809212 is a reply to message #1809211] Thu, 11 July 2019 16:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
are you sure you use consisten versions? xtext by default uses emf 2.12 via the dev bom.
see https://github.com/eclipse/xtext/issues/1282

=> what do you do to use emf 2.18


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1809231 is a reply to message #1809212] Fri, 12 July 2019 07:42 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 44
Registered: January 2013
Member
I sat the EMF runtime version in my genmodel to 2.18.

You mean, if I set it to 2.14 then Xtext has no problems anymore?
Re: XText Generator making random mistakes while generating java classes [message #1809232 is a reply to message #1809231] Fri, 12 July 2019 08:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
counter question: how do you invoke the workflow?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1809235 is a reply to message #1809232] Fri, 12 July 2019 08:24 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 44
Registered: January 2013
Member
I invoke the workflow with Maven/Tycho.

I changed to 2.14 but I get the same error message: Caused by: java.lang.IllegalArgumentException: The value '2.14' is not a valid enumerator of 'GenRuntimeVersion'
Re: XText Generator making random mistakes while generating java classes [message #1809236 is a reply to message #1809235] Fri, 12 July 2019 08:25 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 44
Registered: January 2013
Member
Where is this enumeration definied?
Re: XText Generator making random mistakes while generating java classes [message #1809237 is a reply to message #1809236] Fri, 12 July 2019 08:29 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 44
Registered: January 2013
Member
I must use EMF 2.18 because of a fixed bug where EMF genmodels could not depend on Xcore models.

[Updated on: Fri, 12 July 2019 08:30]

Report message to a moderator

Re: XText Generator making random mistakes while generating java classes [message #1809238 is a reply to message #1809237] Fri, 12 July 2019 08:43 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 44
Registered: January 2013
Member
When I call the MWE2 Workflow from Eclipse directly then it generates everything as expected. But not from Maven. It worked with Maven before I used EMF 2.18.

[Updated on: Fri, 12 July 2019 08:44]

Report message to a moderator

Re: XText Generator making random mistakes while generating java classes [message #1809239 is a reply to message #1809238] Fri, 12 July 2019 08:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
as i said: i maven xtext uses emf 2.12 (if you do not explicitely override this)

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1809241 is a reply to message #1809239] Fri, 12 July 2019 08:53 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 44
Registered: January 2013
Member
How can I override it?
Re: XText Generator making random mistakes while generating java classes [message #1809242 is a reply to message #1809241] Fri, 12 July 2019 09:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
have a look where the workflow is invoked. there is a dependency list

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1809243 is a reply to message #1809242] Fri, 12 July 2019 09:09 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 44
Registered: January 2013
Member
What from EMF is needed by the Xtext generator?
Re: XText Generator making random mistakes while generating java classes [message #1809246 is a reply to message #1809243] Fri, 12 July 2019 09:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13067
Registered: July 2009
Senior Member
you need to find out that yourself sorry. you can find here a list of potential candidates:
https://github.com/eclipse/xtext-lib/blob/master/releng/org.eclipse.xtext.dev-bom/pom.xml


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XText Generator making random mistakes while generating java classes [message #1809247 is a reply to message #1809246] Fri, 12 July 2019 10:00 Go to previous message
Udo Walker is currently offline Udo WalkerFriend
Messages: 44
Registered: January 2013
Member
Thanks for the hint!

I found following working dependencies configuration:

<dependencies>
	<dependency>
		<groupId>org.eclipse.emf</groupId>
		<artifactId>org.eclipse.emf.mwe.utils</artifactId>
		<version>1.4.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.emf</groupId>
		<artifactId>org.eclipse.emf.mwe2.runtime</artifactId>
		<version>2.10.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.emf</groupId>
		<artifactId>org.eclipse.emf.mwe2.launch</artifactId>
		<version>2.10.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.xtext</groupId>
		<artifactId>org.eclipse.xtext.xtext.generator</artifactId>
		<version>2.18.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.xtext</groupId>
		<artifactId>org.eclipse.xtext.xbase</artifactId>
		<version>2.18.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.xtext</groupId>
		<artifactId>xtext-antlr-generator</artifactId>
		<version>[2.1.1, 3)</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.emf</groupId>
		<artifactId>org.eclipse.emf.codegen</artifactId>
		<version>2.16.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.emf</groupId>
		<artifactId>org.eclipse.emf.codegen.ecore</artifactId>
		<version>2.18.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.emf</groupId>
		<artifactId>org.eclipse.emf.common</artifactId>
		<version>2.16.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.emf</groupId>
		<artifactId>org.eclipse.emf.ecore</artifactId>
		<version>2.18.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.emf</groupId>
		<artifactId>org.eclipse.emf.ecore.change</artifactId>
		<version>2.14.0</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.emf</groupId>
		<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
		<version>2.16.0</version>
	</dependency>
</dependencies>


I.e. Xtext 2.18.0 and EMF 2.18.0 work together with these dependencies.

[Updated on: Fri, 12 July 2019 10:02]

Report message to a moderator

Previous Topic:Formatting Generated Code
Next Topic:Xtext Referencing Not Working in Java Project
Goto Forum:
  


Current Time: Wed Aug 21 14:11:22 GMT 2019

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

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

Back to the top