Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » problems with the tutorial "Five simple steps to your JVM language"
problems with the tutorial "Five simple steps to your JVM language" [message #755496] Tue, 08 November 2011 16:31 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1775
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I've just tried the Five simple steps to your JVM language tutorial and
when trying the editor it all seems to work (and I added the xtext
nature to the project), but for expressions like these:

op getFullName() : String {
return firstName + " " + name;
}

op getFriendsSortedByFullName() : List<Person> {
return friends.sortBy( f | f.fullName);
}

with errors:

Couldn't resolve reference to JvmIdentifiableElement '+'.
Couldn't resolve reference to JvmIdentifiableElement 'sortBy'.

is it a known issue? I'm getting the same problems even when I use the
domain model example which comes with xtext

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: problems with the tutorial &quot;Five simple steps to your JVM language&quot; [message #755504 is a reply to message #755496] Tue, 08 November 2011 16:39 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Hi Lorenzo,

you have to add the xbase.lib to the classpath of the project. It's
probably the easiest way to use a plugin project and add the dependency
by means of 'require-bundle'

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 08.11.11 17:31, Lorenzo Bettini wrote:
> Hi
>
> I've just tried the Five simple steps to your JVM language tutorial and
> when trying the editor it all seems to work (and I added the xtext
> nature to the project), but for expressions like these:
>
> op getFullName() : String {
> return firstName + " " + name;
> }
>
> op getFriendsSortedByFullName() : List<Person> {
> return friends.sortBy( f | f.fullName);
> }
>
> with errors:
>
> Couldn't resolve reference to JvmIdentifiableElement '+'.
> Couldn't resolve reference to JvmIdentifiableElement 'sortBy'.
>
> is it a known issue? I'm getting the same problems even when I use the
> domain model example which comes with xtext
>
> thanks in advance
> Lorenzo
>
Re: problems with the tutorial &quot;Five simple steps to your JVM language&quot; [message #755511 is a reply to message #755496] Tue, 08 November 2011 16:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
Hi,

is xbase.lib on the path?

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: problems with the tutorial &quot;Five simple steps to your JVM language&quot; [message #755558 is a reply to message #755511] Tue, 08 November 2011 19:45 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
Hi,

I just ran into the same problem.
Xbase is already a required bundle. Here is the manifest:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.xtext.example.mydsl3
Bundle-Vendor: My Company
Bundle-Version: 1.0.0
Bundle-SymbolicName: org.xtext.example.mydsl3; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext;bundle-version="2.1.0";visibility:=reexport,
 org.eclipse.xtext.xbase;bundle-version="2.1.0";resolution:=optional;visibility:=reexport,
 org.apache.log4j;bundle-version="1.2.15";visibility:=reexport,
 org.apache.commons.logging;bundle-version="1.0.4";resolution:=optional;visibility:=reexport,
 org.eclipse.xtext.generator;resolution:=optional,
 org.eclipse.emf.codegen.ecore;resolution:=optional,
 org.eclipse.emf.mwe.utils;resolution:=optional,
 org.eclipse.emf.mwe2.launch;resolution:=optional,
 org.eclipse.xtext.util,
 org.eclipse.emf.ecore,
 org.eclipse.emf.common,
 org.antlr.runtime,
 org.eclipse.xtext.common.types,
 org.eclipse.xtext.xtend2.lib,
 org.eclipse.xtext.xbase.lib
Import-Package: org.apache.log4j,
 org.apache.commons.logging
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.xtext.example.mydsl3,
 org.xtext.example.mydsl3.services,
 org.xtext.example.mydsl3.myDsl,
 org.xtext.example.mydsl3.myDsl.impl,
 org.xtext.example.mydsl3.myDsl.util,
 org.xtext.example.mydsl3.serializer,
 org.xtext.example.mydsl3.parser.antlr,
 org.xtext.example.mydsl3.parser.antlr.internal,
 org.xtext.example.mydsl3.validation,
 org.xtext.example.mydsl3.formatting,
 org.xtext.example.mydsl3.jvmmodel

Re: problems with the tutorial &amp;quot;Five simple steps to your JVM language&amp;quot; [message #755573 is a reply to message #755558] Tue, 08 November 2011 20:24 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Hi Goran,

you have to add the dependency to the project that contains the model file.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 08.11.11 20:45, Goran wrote:
> Hi,
>
> I just ran into the same problem.
> Xbase is already a required bundle. Here is the manifest:
>
>
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: org.xtext.example.mydsl3
> Bundle-Vendor: My Company
> Bundle-Version: 1.0.0
> Bundle-SymbolicName: org.xtext.example.mydsl3; singleton:=true
> Bundle-ActivationPolicy: lazy
> Require-Bundle:
> org.eclipse.xtext;bundle-version="2.1.0";visibility:=reexport,
> org.eclipse.xtext.xbase;bundle-version="2.1.0";resolution:=optional;visibility:=reexport,
>
> org.apache.log4j;bundle-version="1.2.15";visibility:=reexport,
> org.apache.commons.logging;bundle-version="1.0.4";resolution:=optional;visibility:=reexport,
>
> org.eclipse.xtext.generator;resolution:=optional,
> org.eclipse.emf.codegen.ecore;resolution:=optional,
> org.eclipse.emf.mwe.utils;resolution:=optional,
> org.eclipse.emf.mwe2.launch;resolution:=optional,
> org.eclipse.xtext.util,
> org.eclipse.emf.ecore,
> org.eclipse.emf.common,
> org.antlr.runtime,
> org.eclipse.xtext.common.types,
> org.eclipse.xtext.xtend2.lib,
> org.eclipse.xtext.xbase.lib
> Import-Package: org.apache.log4j,
> org.apache.commons.logging
> Bundle-RequiredExecutionEnvironment: J2SE-1.5
> Export-Package: org.xtext.example.mydsl3,
> org.xtext.example.mydsl3.services,
> org.xtext.example.mydsl3.myDsl,
> org.xtext.example.mydsl3.myDsl.impl,
> org.xtext.example.mydsl3.myDsl.util,
> org.xtext.example.mydsl3.serializer,
> org.xtext.example.mydsl3.parser.antlr,
> org.xtext.example.mydsl3.parser.antlr.internal,
> org.xtext.example.mydsl3.validation,
> org.xtext.example.mydsl3.formatting,
> org.xtext.example.mydsl3.jvmmodel
>
>
Re: problems with the tutorial &amp;quot;Five simple steps to your JVM language&amp;quot; [message #755580 is a reply to message #755573] Tue, 08 November 2011 20:55 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
Hi Sebastian,

What do you mean with "you have to add the dependency to the project that contains the model file"?

Doesn't the manifest of the project contain the dependencies?
It is the one that contains the model file.

If I look at the Plug-in dependencies of the project I can also see:
org.eclipse.xtext.xbase.lib.source_2.1.0.v201111010612.jar

Maybe I'm missing something too obvious here.

[Updated on: Tue, 08 November 2011 21:01]

Report message to a moderator

Re: problems with the tutorial &amp;quot;Five simple steps to your JVM language&amp;quot; [message #755581 is a reply to message #755580] Tue, 08 November 2011 21:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
Hi,

there is a place where you create your .dmodel file.
this project should be (in Sebastians scenario)
a plugin project. then you add the dependency to
this plugin projects manifest.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: problems with the tutorial &amp;quot;Five simple steps to your JVM language&amp;quot; [message #755585 is a reply to message #755581] Tue, 08 November 2011 21:09 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
Hi Christian,

I guess you mean the project I create when giving the editor a try for my DSL.
In my case this is not a plugin project. I also can't see a manifest file in there.

[Updated on: Tue, 08 November 2011 21:10]

Report message to a moderator

Re: problems with the tutorial &amp;quot;Five simple steps to your JVM language&amp;quot; [message #755588 is a reply to message #755585] Tue, 08 November 2011 21:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
hi,

as i said. the easiest is to use a plugin project. the second option is to use a java project. then you have to pimp the classpath yourself.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: problems with the tutorial &amp;quot;Five simple steps to your JVM language&amp;quot; [message #755590 is a reply to message #755588] Tue, 08 November 2011 21:24 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
Ok, I created a plugin project instead for my dmodel, then I added the xbase.lib dependency.
However I still get the same problem.
Re: problems with the tutorial &amp;quot;Five simple steps to your JVM language&amp;quot; [message #755591 is a reply to message #755590] Tue, 08 November 2011 21:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
hmmm very strange, it works for me,
can you share you model file and manifest?

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: problems with the tutorial &amp;quot;Five simple steps to your JVM language&amp;quot; [message #755600 is a reply to message #755591] Tue, 08 November 2011 22:01 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
I tried it again for the domain model example following the steps on http://www.eclipse.org/Xtext/documentation/2_1_0/035-domainmodel-java.php
and indeed it works when using a plugin project.
However it is not yet working for my custom grammar which I can't share at the moment.
If I can't fix it I'll get back to you.
Re: problems with the tutorial &amp;amp;quot;Five simple steps to your JVM language&amp;amp; [message #756351 is a reply to message #755588] Sat, 12 November 2011 10:34 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1775
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/08/2011 10:16 PM, Christian Dietrich wrote:
> hi,
>
> as i said. the easiest is to use a plugin project. the second option is
> to use a java project. then you have to pimp the classpath yourself.
>
> ~Christian

I think that what confused us was that in the documentation you read to
create a new Java project and then in the screenshot (and in the example
at the beginning of the section) you see both the '+' concatenation and
the use of an extension sortBy which will work only when adding
explicitly xbase.lib in the created project (and it's easier when
creating a plugin project and not a plain Java project as written in the
documentation :)

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: problems with the tutorial &amp;amp;quot;Five simple steps to your JVM language&amp;amp; [message #756365 is a reply to message #756351] Sat, 12 November 2011 11:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13770
Registered: July 2009
Senior Member
Hi Lorenzo,

please file a bug against the docs if there is not already one.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: problems with the tutorial &amp;amp;quot;Five simple steps to your JVM language&amp;amp; [message #756374 is a reply to message #756351] Sat, 12 November 2011 13:43 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
This issue will be addressed in 2.2

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 12.11.11 11:34, Lorenzo Bettini wrote:
> On 11/08/2011 10:16 PM, Christian Dietrich wrote:
>> hi,
>>
>> as i said. the easiest is to use a plugin project. the second option is
>> to use a java project. then you have to pimp the classpath yourself.
>>
>> ~Christian
>
> I think that what confused us was that in the documentation you read to
> create a new Java project and then in the screenshot (and in the example
> at the beginning of the section) you see both the '+' concatenation and
> the use of an extension sortBy which will work only when adding
> explicitly xbase.lib in the created project (and it's easier when
> creating a plugin project and not a plain Java project as written in the
> documentation :)
>
> cheers
> Lorenzo
>
Re: problems with the tutorial &amp;amp;amp;quot;Five simple steps to your JVM language&amp; [message #756843 is a reply to message #756365] Tue, 15 November 2011 10:20 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1775
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/12/2011 12:50 PM, Christian Dietrich wrote:
> Hi Lorenzo,
>
> please file a bug against the docs if there is not already one.
>

done

https://bugs.eclipse.org/bugs/show_bug.cgi?id=363793

cheers
Lorenzo


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:Help with Actions
Next Topic:&quot;It is recommended to use the ANTLR 3 parser generator&quot; message gone?
Goto Forum:
  


Current Time: Tue Mar 09 05:24:51 GMT 2021

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

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

Back to the top