Standalone command-line compiler
We already know that the Xtext project wizard created the projects for our DSL separating the features related to the user interface in a separate project (the .ui project); the runtime project does not depend on the Eclipse user interface. Thus, we can create a command-line application consisting of a simple Java class with a main method. Simply add the following lines to your MWE2 workflow file:
// generator API
fragment = generator.GeneratorFragment {
  generateJavaMain = true
}If you now run the workflow, you will find a Main class in the src folder of your project in the org.example.entities.generator package. As you may recall from Chapter 2, Creating Your First Xtext Language, files generated into the src folder are only generated once (if they do not exist) and thus you can safely add/modify the logic of the Main class. This is not required at this point; we will use the class as it was generated. You do not have to worry about not understanding everything...