Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem with referencedResource and gradle(Cannot load genmodel of a referenced grammar)
icon9.gif  Problem with referencedResource and gradle [message #1736405] Wed, 29 June 2016 09:33 Go to next message
Andreas Würtz is currently offline Andreas WürtzFriend
Messages: 3
Registered: June 2016
Junior Member
I have a grammar X that uses another grammar Y from another project, so I specify the Y grammar's genmodel in the MWE2 file like this:

referencedResource = "platform:/resource/Y.project/model/generated/Y.genmodel"

Everything fine when generating Eclipse, but I need to be able to build on a build server with gradle. When MWE2 script invoked by gradle build script, nothing from the Y grammar is found. I tried mapping platform:/ to resource:/ as described in the documentation (for maven, however), but to no avail.

Has anyone achieved this? And how?
Re: Problem with referencedResource and gradle [message #1736442 is a reply to message #1736405] Wed, 29 June 2016 12:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13723
Registered: July 2009
Senior Member
are you sure the classpath setup is correct ? does it contain the dependent dsl project/jar?

dependencies {
mwe2 "org.eclipse.emf:org.eclipse.emf.mwe2.launch:2.8.3"
mwe2 "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}"
mwe2 ...... //your stuff
}

can you share a small reproducable example?


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: Problem with referencedResource and gradle [message #1737042 is a reply to message #1736442] Tue, 05 July 2016 09:21 Go to previous messageGo to next message
Andreas Würtz is currently offline Andreas WürtzFriend
Messages: 3
Registered: June 2016
Junior Member
Here you go. x-build finds y via file respository (see build.gradle)
  • Attachment: xtext.zip
    (Size: 3.46MB, Downloaded 66 times)
Re: Problem with referencedResource and gradle [message #1737053 is a reply to message #1737042] Tue, 05 July 2016 11:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13723
Registered: July 2009
Senior Member
in y:

gradle/source-layout.gradle



remove the exclude for *.xtext
sourceSets.all {
resources.exclude '**/*.g', '**/*.mwe2', '**/*.xtend', '**/*._trace'
}


make sure gradle can find the dependencies e.g. by gradle build install and adding mavenLocal() to the repo list in build.gradle

repositories {
jcenter()
mavenLocal()
}

org.xtext.example.x/build.gradle

dependencies {
mwe2 "org.eclipse.emf:org.eclipse.emf.mwe2.launch:2.8.3"
mwe2 "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}"
mwe2 "org.xtext.example.y:org.xtext.example.y:1.0.0-SNAPSHOT"
compile "org.xtext.example.y:org.xtext.example.y:1.0.0-SNAPSHOT"
}



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: Problem with referencedResource and gradle [message #1737240 is a reply to message #1737053] Wed, 06 July 2016 14:13 Go to previous message
Andreas Würtz is currently offline Andreas WürtzFriend
Messages: 3
Registered: June 2016
Junior Member
Thank you very much! That did the trick.
Previous Topic:[SOLVED] Strange erroneous behavior of xtext-maven-plugin
Next Topic:install problem
Goto Forum:
  


Current Time: Mon Jan 25 08:08:12 GMT 2021

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

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

Back to the top