Using dynamic templates in Xcore [message #1859783] |
Tue, 27 June 2023 08:56 |
Nis Wechselberg Messages: 4 Registered: November 2022 |
Junior Member |
|
|
Hi,
i am currently trying to adjust the code generation through dynamic templates in a model that is using Xcore with xtext-maven-plugin for the code generation.
I did the same thing in ecore/genmodel-projects before and that seems to be working fine.
However if I set dynamicTemplates to true in xcore, I only get empty files as generated code.
@GenModel(
bundleManifest="false",
modelDirectory="xcore-maven-example/src/main/java-gen",
dynamicTemplates="true",
templateDirectory="xcore-maven-example/src/resources/templates",
complianceLevel="17"
)
I created a small example (thanks to Guillaume for the base project) at
https://github.com/eNBeWe/xcore-maven-example
Currently dynamicTemplates is false and it works fine. If I set it to true it immediately breaks.
Any ideas what is going on here?
[Updated on: Tue, 27 June 2023 10:23] Report message to a moderator
|
|
|
|
Re: Using dynamic templates in Xcore [message #1859787 is a reply to message #1859785] |
Tue, 27 June 2023 10:26 |
Nis Wechselberg Messages: 4 Registered: November 2022 |
Junior Member |
|
|
I did not use it within Eclipse, but just through maven-plugin.
However your comment might point in the right direction nonetheless. I guess the process with the .JETEmiters project has a high chance of "confusing" the generation in maven, right?
I will try from within Eclipse and have a look there.
UPDATE:
I tested in Eclipse and it seems to work (after activating the plugin nature on the project, adding Manifest, etc.).
It generates the .JETEmitters project and uses the templates from there.
So it seems to be indeed a maven-plugin issue.
Any idea how to get that narrowed down?
[Updated on: Tue, 27 June 2023 10:39] Report message to a moderator
|
|
|
|
Re: Using dynamic templates in Xcore [message #1859792 is a reply to message #1859791] |
Tue, 27 June 2023 11:50 |
Nis Wechselberg Messages: 4 Registered: November 2022 |
Junior Member |
|
|
Okay, I kind of expected that now. I have been reading up on JET in the meantime and I don't see a simple approach to get that working.
For plain *.genmodel we don't use the maven-plugin but generate it in Eclipse and submit that code to git. So we didn't solve anything there ;)
I guess we have to think about some alternative. Either have the generated sources in git for xcore as well or have some other workaround ...
Thanks for your help nonetheless.
[Updated on: Tue, 27 June 2023 11:50] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.01122 seconds