Integrate JEAF Generator into Maven Build
JEAF Generator is provided as Maven Plugin and thus can be easily integrated into your build process. This side will describe how to do that.
Maven Build Helper Plugin
When working with JEAF Generator the standard Maven directory layout is not sufficient any longer as we have to distinguish between hand-written and generated code (Directory Layout for generated output). This also requires that the additional locations of source code and resources are known to the build process in general. To do so we make use of Maven Build Helper Plugin.
This means that in addition to the JEAF Generator Plugin also Maven Build Helper has to be added to your build. Depending on the structure of you Maven projects it might also be an option to add configuration Build Helper Plugin to your parent POM.
Configuration of JEAF Generator Maven Plugin
JEAF Generator can either read the required XMI files directly from the local file system e.g. some sub directory in your project or from a Maven artifact.
For the example here we read the model files from an artifact. So, we need to declare a dependency in our POM for that:
Below you can find an example how JEAF Generator can be integrated into your build. As it supports a rather large set of features it also has a big bunch of configuration parameters. For full list of configuration parameters please have a look here: JEAF Generator Configuration Parameters
Execute JEAF Generator
As you can see in the example configuration above JEAF Generator will be executed in Maven standard phase generate-sources
as part of your build. This means that it will be execute as part of your standard build process e.g. mvn clean install
.
If you want to run code generation only, then you can execute goal generate-sources
which is supported by most development environments directly via the UI.