Skip to main content



      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 08:05 Go to next message
Eclipse UserFriend
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 10:54] by Moderator

Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832048 is a reply to message #1832047] Mon, 07 September 2020 08:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi. This looks like an improper encoding config
Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832053 is a reply to message #1832048] Mon, 07 September 2020 08:56 Go to previous messageGo to next message
Eclipse UserFriend
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 09:39 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Mon, 07 September 2020 09:52] by Moderator

Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832114 is a reply to message #1832057] Wed, 09 September 2020 06:10 Go to previous messageGo to next message
Eclipse UserFriend
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 09:31 Go to previous messageGo to next message
Eclipse UserFriend
Please provide a reproducible example
Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832263 is a reply to message #1832122] Mon, 14 September 2020 10:59 Go to previous messageGo to next message
Eclipse UserFriend
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 15:06 Go to previous messageGo to next message
Eclipse UserFriend
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)
Re: Xtend template expressions are not resolved using Xtend Maven plugin [message #1832455 is a reply to message #1832265] Fri, 18 September 2020 06:12 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 19:21:59 EDT 2025

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

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

Back to the top