Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Cannot get GettingStarted to work :(
Cannot get GettingStarted to work :( [message #631438] Thu, 07 October 2010 14:39 Go to next message
Robin  is currently offline Robin Friend
Messages: 25
Registered: August 2010
Junior Member
Hi,

I'm trying to get XMF working, but did not succeed so far. Sad

I am using eclipse-SDK-3.6-xtext-1.0.1-win32 and doing the GettingStarted Tutorial:
http://wiki.eclipse.org/Xtext/GettingStarted

I unpacked Eclipse to C:\eclipse and the workspace is C:\eclipsew (I tried also other configurations for this, but it does not change anything). I am using Windows XP (also tried the same on Windows 7).

When I try the last step "Content Generation", I get this error:
0    [main] DEBUG        org.eclipse.xtext.mwe.Reader  - Resource Pathes : [src/model]
0    [main] INFO         org.eclipse.xpand2.Generator  - No meta models configured, using JavaBeans as default.
219  [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: file:/C:/eclipsew/org.xtext.example.mydsl.generator/src/model/Example.mydsl
391  [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems running workflow workflow.MyDslGenerator: Couldn't find EClass for name 'Greeting'.
java.lang.RuntimeException: Problems running workflow workflow.MyDslGenerator: Couldn't find EClass for name 'Greeting'.
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:82)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: org.eclipse.emf.mwe.core.WorkflowInterruptedException: Couldn't find EClass for name 'Greeting'.
	at org.eclipse.xtext.mwe.SlotEntry.findEClasses(SlotEntry.java:116)
	at org.eclipse.xtext.mwe.SlotEntry.put(SlotEntry.java:76)
	at org.eclipse.xtext.mwe.AbstractReader.addModelElementsToContext(AbstractReader.java:87)
	at org.eclipse.xtext.mwe.Reader.invokeInternal(Reader.java:166)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
	at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
	at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:31)
	at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:80)
	... 3 more


But I think there's already something wrong before. First of all, I have the following warnings in Eclipse after creating the xtext project:
Description	Resource	Path	Location	Type
Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment. 	org.xtext.example.mydsl		Build path	JRE System Library Problem

Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment. 	org.xtext.example.mydsl.generator		Build path	JRE System Library 
Problem

Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment. 	org.xtext.example.mydsl.ui		Build path	JRE System Library Problem
The file "plugin.xml" does not exist in the workspace	build.properties	/org.xtext.example.mydsl.generator	line 5	Plug-in Problem

The type DefaultContentOutlineNodeAdapterFactory is deprecated	MyDslOutlineNodeAdapterFactory.java	/org.xtext.example.mydsl.ui/src/org/xtext/example/ui/outline	line 6	Java Problem

The type DefaultContentOutlineNodeAdapterFactory is deprecated	MyDslOutlineNodeAdapterFactory.java	/org.xtext.example.mydsl.ui/src/org/xtext/example/ui/outline	line 8	Java Problem

But since these are only warnings it might not be relevant. Though the message that the "plugin.xml" does not exist in the workspace seems severe.

I think there's already a problem during the DSL generation.
1.) I have a different console output.
Compare http://wiki.eclipse.org/Image:WorkflowLog1.png to mine:
0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri 'C:\eclipsew'
922  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning C:\eclipsew\org.xtext.example.mydsl\..\org.xtext.example.mydsl\src-gen
922  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning C:\eclipsew\org.xtext.example.mydsl\..\org.xtext.example.mydsl.ui\src-gen
1141 [main] INFO  ipse.xtext.generator.LanguageConfig  - generating infrastructure for org.xtext.example.MyDsl with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, ParseTreeConstructorFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, FormatterFragment, LabelProviderFragment, TransformerFragment, OutlineNodeAdapterFactoryFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment
5469 [main] INFO  or.validation.JavaValidatorFragment  - executing generate for org.eclipse.xtext.generator.validation.JavaValidatorFragment
6625 [main] INFO  .emf.mwe2.runtime.workflow.Workflow  - Done.

2.) I have not the same files after the DSL generation. Compared to http://wiki.eclipse.org/Image:AfterFirstGeneration.png I have only the following files in package "org.xtext.example" of the project "org.xtext.example.mydsl":
MyDslRuntimeModule.java
MyDslStandaloneSetup.java
GenerateMyDsl.mwe2.mwe2
MyDsl.xtext

Please anybody help!! I want to start a university project concerning domain-specific languages using xtext and I am totally stuck.

Regards,

Robin
Re: Cannot get GettingStarted to work :( [message #631447 is a reply to message #631438] Thu, 07 October 2010 14:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

did you sucessfully run GenerateMyDsl.mwe2? and you get nothing generated in org.xtext.example.mydsl / org.xtext.example.mydsl.ui?

the default generated generator (xpand) does not fit to the grammar from the wiki getting started.

you find the latest getting started here:
http://www.eclipse.org/Xtext/documentation/latest/xtext.html #getting-started

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 07 October 2010 15:03]

Report message to a moderator

Re: Cannot get GettingStarted to work :( [message #631463 is a reply to message #631447] Thu, 07 October 2010 15:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
So a short way to test if i works is

(1) create a new Xtext project with Wizard
(2) run /org.xtext.example.mydsl/src/org/xtext/example/mydsl/Generat eMyDsl.mwe2
(3) run /org.xtext.example.mydsl.generator/src/workflow/MyDslGenerat or.mwe2

what should be all Wink

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Cannot get GettingStarted to work :( [message #631907 is a reply to message #631463] Sun, 10 October 2010 12:41 Go to previous messageGo to next message
Robin  is currently offline Robin Friend
Messages: 25
Registered: August 2010
Junior Member
Hi,

I did your short test as suggested:
Quote:

(1) create a new Xtext project with Wizard


Did that with all default settings and naming.
Quote:

(2) run /org.xtext.example.mydsl/src/org/xtext/example/mydsl/Generat eMyDsl.mwe2


Gives the following output:
0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri 'C:\eclipsew'
982  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning C:\eclipsew\org.xtext.example.mydsl\..\org.xtext.example.mydsl\src-gen
985  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning C:\eclipsew\org.xtext.example.mydsl\..\org.xtext.example.mydsl.ui\src-gen
1170 [main] INFO  ipse.xtext.generator.LanguageConfig  - generating infrastructure for org.xtext.example.mydsl.MyDsl with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, ParseTreeConstructorFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, FormatterFragment, LabelProviderFragment, TransformerFragment, OutlineNodeAdapterFactoryFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment
6854 [main] INFO  or.validation.JavaValidatorFragment  - executing generate for org.eclipse.xtext.generator.validation.JavaValidatorFragment
7458 [main] INFO  .emf.mwe2.runtime.workflow.Workflow  - Done.

Quote:

(3) run /org.xtext.example.mydsl.generator/src/workflow/MyDslGenerat or.mwe2


Gives the following output:
0    [main] DEBUG        org.eclipse.xtext.mwe.Reader  - Resource Pathes : [src/model]
3    [main] INFO         org.eclipse.xpand2.Generator  - No meta models configured, using JavaBeans as default.
132  [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: file:/C:/eclipsew/org.xtext.example.mydsl.generator/src/model/Example.mydsl
850  [main] INFO         org.eclipse.xpand2.Generator  - Written 3 files to outlet [default](src-gen)
851  [main] INFO  .emf.mwe2.runtime.workflow.Workflow  - Done.


So I tried again with the complete distribution and the latest documentation tutorial but I have no syntax highlighting then.
Distribution: http://download.itemis.com/distros/eclipse-SDK-3.6-xtext-1.0 .1-win32.zip
Documentation: http://www.eclipse.org/Xtext/documentation/latest/xtext.html #getting-started
Eclipse Directory: c:\eclipse
Workspace Directory: c:\eclipsew

Generate Language Artifacts: Run As -> MWE2 Workflow.
Output:
0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri 'C:\eclipsew'
649  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning C:\eclipsew\org.eclipse.xtext.example.domainmodel\..\org.eclipse.xtext.example.domainmodel\src-gen
650  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning C:\eclipsew\org.eclipse.xtext.example.domainmodel\..\org.eclipse.xtext.example.domainmodel.ui\src-gen
900  [main] INFO  ipse.xtext.generator.LanguageConfig  - generating infrastructure for org.eclipse.xtext.example.Domainmodel with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, ParseTreeConstructorFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, FormatterFragment, LabelProviderFragment, TransformerFragment, OutlineNodeAdapterFactoryFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment
7128 [main] INFO  or.validation.JavaValidatorFragment  - executing generate for org.eclipse.xtext.generator.validation.JavaValidatorFragment
7834 [main] INFO  .emf.mwe2.runtime.workflow.Workflow  - Done.


Run the Generated IDE Plug-in - Right-click on the Xtext project and choose Run As -> Eclipse Application.
It does not say on which project one should click, as there are three to choose from:
org.eclipse.xtext.example.domainmodel
org.eclipse.xtext.example.domainmodel.generator
org.eclipse.xtext.example.domainmodel.ui
I tried to run all of them as eclipse application, but I always have no syntax hightlighting in the new Eclipse when I create a new project and put "my.entity" in it.
So it works only, if one uses the prebuild examples?!? Sad

Regards, Robin
Re: Cannot get GettingStarted to work :( [message #631913 is a reply to message #631907] Sun, 10 October 2010 14:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

you named you file .entity but the getting started tutorial creates a dsl with the extension .dmodel.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sun, 10 October 2010 14:03]

Report message to a moderator

Re: Cannot get GettingStarted to work :( [message #637921 is a reply to message #631913] Tue, 09 November 2010 11:14 Go to previous messageGo to next message
Robin  is currently offline Robin Friend
Messages: 25
Registered: August 2010
Junior Member
Hi,

d'oh! Thanks Christian! It somehow works better now, but I am still having problems with the example. Sad

I have the tutorial grammar (and I did NOT copy/paste it):
grammar org.eclipse.xtext.example.Domainmodel
	with org.eclipse.xtext.common.Terminals

generate domainmodel "http://www.eclipse.org/xtext/example/Domainmodel"

DomainModel :
	(elements+=Entity)*;
	
Type:
	DataType | Entity;

DataType:
	'datatype' name=ID;

Entity:
	'entity' name=ID ('extends' superType=[Entity])? '{'
		(features+=Feature)*
	'}';

Feature:
	name=ID ':' type=TypeRef;

TypeRef:
	referenced=[Type] (multi?='*')?;


But when I run the language it does not recognize "datatype" and it says "mismatched input 'datatype' expecting EOF".

I get the error in the first line with this:
datatype String
datatype Bool


entity Session {
	title: String
	isTutorial : Bool
}

entity Conference {
	name: String
	attendees : Person*
	speakers : Speaker*
}

entity Person {
	name : String
}

entity Speaker extends Person {
	sessions: Session*
}


But no error when I comment out everything regarding datatypes:
//datatype String
//datatype Bool


entity Session {
//	title: String
//	isTutorial : Bool
}

entity Conference {
//	name: String
	attendees : Person*
	speakers : Speaker*
}

entity Person {
//	name : String
}

entity Speaker extends Person {
	sessions: Session*
}


What am I still doing wrong??? Sad
Does anyone have an idea?

Regards, Robin
Re: Cannot get GettingStarted to work :( [message #637960 is a reply to message #637921] Tue, 09 November 2010 13:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hello Robin,

this may be a bug in the docs. the grammar should be

grammar org.eclipse.xtext.example.Domainmodel
	with org.eclipse.xtext.common.Terminals

generate domainmodel "http://www.eclipse.org/xtext/example/Domainmodel"

DomainModel :
	(elements+=Type)*;
	
Type:
	DataType | Entity;

DataType:
	'datatype' name=ID;

Entity:
	'entity' name=ID ('extends' superType=[Entity])? '{'
		(features+=Feature)*
	'}';

Feature:
	name=ID ':' type=TypeRef;

TypeRef:
	referenced=[Type] (multi?='*')?;



~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Cannot get GettingStarted to work :( [message #638171 is a reply to message #637960] Wed, 10 November 2010 10:29 Go to previous message
Robin  is currently offline Robin Friend
Messages: 25
Registered: August 2010
Junior Member
Thank you so much! It works now. Also it now makes total sense.

Well, if you define different element types
Type:
	DataType | Entity;

then you should also use them
DomainModel :
	(elements+=Type)*;


Actually quite obvious. Sorry, but I am new to xtext and also to DSLs.

Regards, Robin
Previous Topic:Test cross-references
Next Topic:Load classes in user project
Goto Forum:
  


Current Time: Tue Apr 23 07:21:36 GMT 2024

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

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

Back to the top