Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtend template expressions are not resolved using Xtend Maven plugin
Xtend template expressions are not resolved using Xtend Maven plugin [message #1832047] Mon, 07 September 2020 12:05 Go to next message
Zakir Meer is currently offline Zakir MeerFriend
Messages: 50
Registered: February 2016
Member
Hello Experts,

I am using Xtend for model to text use-case. I am creating a RCP product and have used maven to build the product from the eclipse plugins.

I realized that the generated code from Xtend file, is different in both development envrionment (inside Eclipse IDE) and build envrionment (generated using Xtend maven plugin).

I realized that in the build environment, Xtend expressions are not resolved and the entire content is dumped as a text. Please find the below screenshot for reference

index.php/fa/38862/0/

It will be helpful if you can let me know if I need to do some change in the build configuration to get the same output.

Note: I am using Xtext 2.20.0

[Updated on: Mon, 14 September 2020 14:54]

Report message to a moderator

Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832048 is a reply to message #1832047] Mon, 07 September 2020 12:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13709
Registered: July 2009
Senior Member
Hi. This looks like an improper encoding config

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: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832053 is a reply to message #1832048] Mon, 07 September 2020 12:56 Go to previous messageGo to next message
Zakir Meer is currently offline Zakir MeerFriend
Messages: 50
Registered: February 2016
Member
Hi Christian,
where should the encoding be set ?
- should it be set in the POM.xml for the maven-Xtend plugin?
- should it be set for the eclipse project which contains the Xtend file with Template expressions ? "At present the encoding of the file is Cp1252. As mentioned earlier, in the development environment Xtend builder is working as expected. "

In case of the build environment : I understood that generator is messing it up, unable to process input Xtend files and generate appropriate java files
Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832057 is a reply to message #1832053] Mon, 07 September 2020 13:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13709
Registered: July 2009
Senior Member
Usually you should configure a modern encoding in eclipse and in maven (project.build.sourceEncoding)
But you also can configure it for the plugin

https://github.com/eclipse/xtext-xtend/blob/6d1044ecf9ba15c3a3c1cff603998db7026ee12d/org.eclipse.xtend.maven.plugin/src/main/java/org/eclipse/xtend/maven/AbstractXtendCompilerMojo.java#L76


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

[Updated on: Mon, 07 September 2020 13:52]

Report message to a moderator

Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832114 is a reply to message #1832057] Wed, 09 September 2020 10:10 Go to previous messageGo to next message
Zakir Meer is currently offline Zakir MeerFriend
Messages: 50
Registered: February 2016
Member
Hi Christian,
This property (project.build.sourceEncoding) is already set in the parent pom.xml of my project, but still there is no influence of it (guillemot's are not recognized and are dumped as text with special charaters)
There was a similar issue reported in the past.. : https://www.eclipse.org/forums/index.php/t/265368/
Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832122 is a reply to message #1832114] Wed, 09 September 2020 13:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13709
Registered: July 2009
Senior Member
Please provide a reproducible 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: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832263 is a reply to message #1832122] Mon, 14 September 2020 14:59 Go to previous messageGo to next message
Zakir Meer is currently offline Zakir MeerFriend
Messages: 50
Registered: February 2016
Member
Hello Christian,

I have create a example application containing xtend files (using template expressions) : https://www.eclipse.org/forums/index.php?t=getfile&id=38896&
- you can build this example using mvn clean verify command and verify the generated java file . \maven.build.xtendgen\01_Source\com.test.m2t\xtend-gen\com\test\m2t\model\Transformation.java

I have created a screenshot of input xtend, generated java file and decompiled class file after the build in my local PC : https://www.eclipse.org/forums/index.php?t=getfile&id=38897&
index.php/fa/38897/0/
Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832265 is a reply to message #1832263] Mon, 14 September 2020 19:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13709
Registered: July 2009
Senior Member
you did not create the xtend file using UTF-8 but something else.
the xtend file needs to be created in the encoding you specify i maven
(ISO-8859-1 might work)


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: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832455 is a reply to message #1832265] Fri, 18 September 2020 10:12 Go to previous message
Zakir Meer is currently offline Zakir MeerFriend
Messages: 50
Registered: February 2016
Member
Hi Christian,
Thanks a lot for your support. Based on the above point mentioned by you, I have adapted all the Xtend files to have UTF-8 encoding. Based on this change, maven-xtend-gen plugin is working perfectly fine in the build environment (also in IDE code generation is perfect) !!
Previous Topic:Unresolved reference with dsl in jar library
Next Topic:Xtext Build and Indexing taking more time
Goto Forum:
  


Current Time: Fri Jan 15 21:44:55 GMT 2021

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

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

Back to the top