I am looking for an example pom.xml for an project using XText 2.0, especially the code generator XPand 1.1 in a “plain” maven project.
I already spend time with google, but may I use the wrong terms, or there is no example.
I have an already working pom for xtext 0.7.2 and I want to update the project to 2.0. but I don’t know where to start.
What I have at the moment is this structure of 4 maven projects:
- mydsl
- mydsl.generator (not used)
- mydsl.ui
- application (containing xpand templates to generate code)
The mydsl projects are xtext 0.7.2 projects with and additional pom in (mydsl) that provides the generated classes as maven dependency.
The application has a mwe workflow and xpand template to generate source code. This project has a maven dependency to mydsl
Because I have not implemented so many gui editor functionality I would even except to throw all the xtext stuff away (except the grammer and xpand templates) and build a complete new xtext 2 project.
But I have really no glue how to build the pom for the (new) mydsl project.
One of the most trickiest parts is that in an XText2 grammer project there will be a file in
xtend-genfolder woth name<<project>>Generator.java. That file is not created by theGenerate<<project>>.mwe2workflow, instead it seams that it is created by some eclipse magic. But this file is needed to compile the code!So my solution is to let eclipse generate that file, and then add it to the svn like any normal hand written class.
Then one only need to add this pom to the project. So maven will start the Workflow too.
But there is one drawback: the workflow also generate the classes for the neighbour projects,
.uiand.testand therefor it needs there manifest files. To overcome the trouble of the maven release plugin, one could add a parent maven project, that contains the grammer project and the two dummies.uiand.testPom of project containing the xtext grammer:
POM of the project that uses the grammer and a dsl for source code generation. This is nearly the same as it was for xtext 0.7.1. But with one difference. The
MweReaderused in the mwe file does not exit any more (since xtext 1.0.1) So one need to use theorg.eclipse.xtext.mwe.Reader. This reader not longer take the model file as input, but the path to the file. And it also stores it in a so called “slot”. But this slot is an LIST of elements. So one need to change: theFORin<expand value="templates::Main::main FOR model"/>toFOREACHMwe workflow in that project