Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » cross-project references not resolved in standalone mode
cross-project references not resolved in standalone mode [message #1709708] Wed, 30 September 2015 13:46 Go to next message
Hans-Peter Bantle is currently offline Hans-Peter BantleFriend
Messages: 5
Registered: September 2015
Junior Member
Hi,

I have splitted my model file into multiple files and put them into different projects. Once I have configured the project dependencies, this is working perfectly fine in Eclipse:
index.php/fa/23401/0/

Btw, I'm using the DSL from the Extended-15-Minutes-Tutorial: https://eclipse.org/Xtext/documentation/103_domainmodelnextsteps.html
And I have attached the actual DSL: domainmodel_dsl.zip
as well as my project files: my.project.zip

Now I'm trying to build my project with gradle (build.gradle scripts are included with the project files). But when the second project gets validated, I always end up with following error:
Starting validation for input: 'blog.dmodel'
ERROR:Couldn't resolve reference to Type 'String'. (file:/C:/dev/runtime-EclipseXtext/my.project.blog/src/main/java/blog.dmodel line : 6)
ERROR:Couldn't resolve reference to Entity 'HasAuthor'. (file:/C:/dev/runtime-EclipseXtext/my.project.blog/src/main/java/blog.dmodel line : 10)
ERROR:Couldn't resolve reference to Type 'String'. (file:/C:/dev/runtime-EclipseXtext/my.project.blog/src/main/java/blog.dmodel line : 11)
ERROR:Couldn't resolve reference to Type 'String'. (file:/C:/dev/runtime-EclipseXtext/my.project.blog/src/main/java/blog.dmodel line : 12)
ERROR:Couldn't resolve reference to Entity 'HasAuthor'. (file:/C:/dev/runtime-EclipseXtext/my.project.blog/src/main/java/blog.dmodel line : 16)
ERROR:Couldn't resolve reference to Type 'String'. (file:/C:/dev/runtime-EclipseXtext/my.project.blog/src/main/java/blog.dmodel line : 17)
:my.project.blog:xtextGenerate FAILED


Has anyone experienced a similar problem and found a solution for this? Any kind of help is very much appreciated. Thanks.
Re: cross-project references not resolved in standalone mode [message #1709713 is a reply to message #1709708] Wed, 30 September 2015 14:04 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

The xtextTooling configuration is only meant for dependencies of the Xtext generator itself (i.e. you add your language implementation to that).

For dependencies between projects, please use the usual compile/testCompile configurations.
Re: cross-project references not resolved in standalone mode [message #1709717 is a reply to message #1709713] Wed, 30 September 2015 14:14 Go to previous messageGo to next message
Hans-Peter Bantle is currently offline Hans-Peter BantleFriend
Messages: 5
Registered: September 2015
Junior Member
Thanks for your reply. I just modified the build.gradle file in project my.project.blog and changed the dependency configuration to:
dependencies {
   compile project(path: ':my.project.common')
}

Of course, this works fine for compile dependencies, but unfortunately not for dsl references. From my point of view, the import statement in blog.dmodel does not get resolved.
The error actually occurs in task xtextGenerate, as you can see in the above error message.
Re: cross-project references not resolved in standalone mode [message #1709741 is a reply to message #1709717] Wed, 30 September 2015 16:09 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

That's because your dmodel files are not in the .jar. You should put them in src/main/resources or add src/main/java to the list of resource folders.
Re: cross-project references not resolved in standalone mode [message #1709800 is a reply to message #1709741] Thu, 01 October 2015 07:49 Go to previous messageGo to next message
Hans-Peter Bantle is currently offline Hans-Peter BantleFriend
Messages: 5
Registered: September 2015
Junior Member
Adding src/main/java to the list of resource folders solved the problem. Thanks a lot.
Re: cross-project references not resolved in standalone mode [message #1709803 is a reply to message #1709800] Thu, 01 October 2015 07:51 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

Have a look at you jar contents, though. Adding src/main/java as a resource might lead to other source files being put in the jar, too. So you might need to add some exclude rules to it.
Re: cross-project references not resolved in standalone mode [message #1746452 is a reply to message #1709803] Sat, 29 October 2016 10:03 Go to previous messageGo to next message
Edilberto Castellanos is currently offline Edilberto CastellanosFriend
Messages: 2
Registered: October 2016
Junior Member
Hi,

xtext cross-project references not resolved in standalone mode during maven compilation. I have enhanced a bit herolanguage to model hero idols and validate the resolution of cross-project references and it runs as eclipse projects, taken into account maven dependencies, but when running as a maven install it fails to resolve them.

I upload the samples,


any help would be appreciated.

thanks.
  • Attachment: heroplus.zip
    (Size: 4.86MB, Downloaded 13 times)
  • Attachment: sample.zip
    (Size: 12.21KB, Downloaded 14 times)
Re: cross-project references not resolved in standalone mode [message #1746467 is a reply to message #1746452] Sun, 30 October 2016 08:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 10434
Registered: July 2009
Senior Member
<classPathLookupFilter>.</classPathLookupFilter>

is bad, that regex will match barely nothing
Re: cross-project references not resolved in standalone mode [message #1746478 is a reply to message #1746467] Sun, 30 October 2016 15:01 Go to previous message
Edilberto Castellanos is currently offline Edilberto CastellanosFriend
Messages: 2
Registered: October 2016
Junior Member
Thank you Cristian, I had been fighting against the workflow and ResourceProviders customization, looking at wrong places.

A lot of thanks.
Previous Topic:xtext from ecore bogus in mars + java 8
Next Topic:Indexing outside of the buider
Goto Forum:
  


Current Time: Sat Apr 29 21:38:22 GMT 2017

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

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