Maven Integration
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:
Preconditions
As described in Maven Build Helper Plugin when working with JEAF or JEAF Generator then we need to make use of Maven Build Helper Plugin. So please refer to the mentioned site to ensure that is integrated properly.
Maven Plugin Configuration Parameters
The following tables describe all possible configuration parameters of the JEAF Generator Maven Plugin. Usage of almost all of them is shown in the example below.
Common Configuration Parameters
Configuration Parameter | Required / Optional / Default | Description |
---|---|---|
| The UML model can either be defined by pointing to the directory where the XMI files are located directly or by referencing an artifact that contains the XMI files. In case artifact referencing also a dependency to the artifact is required (see example below) The parameters are required in case of artifact referencing. For further details please also refer to Export UML Model from MagicDraw UML | Group ID of the artifact that contains the XMI files of the UML model. |
| Artifact ID of the artifact that contains the XMI files of the UML model. | |
| XMI Path inside the artifact that contains the XMI files of the UML model. | |
| Parameter is required in case of directly pointing to XMI files. | Directory which contains all XMI files. The files have to be exported from MagicDraw UML using its Eclipse UML2 Export v2.x |
| Parameter is optional for case that JEAF Generator only should generate so called message constants. In this case no UML model is required as input. For further details please also refer to Internationalization / Localization | Name of the model file that should be used. Usually it has the same name as the MagicDraw UML project. Only the name of the file has to be provided as we assume that the file is located in the XMI directory.
|
| Name of the file that contains the JEAF Meta Model (JMM). Usually the default value "JMM.profile.uml" can be used. Only the name of the file has to be provided as we assume that the file is located in the XMI directory. | |
| required in case of code generation from UML models but not for message constants only. | Directory where all files that belong to the |
| required | Directory where all files that belong to the |
| required | Directory where all files that belong to the |
| required | Directory where all files that belong to the |
| optional | Parameter defines if By default it is disabled. |
| optional | Parameter defines if By default it is disabled. |
|
| Besides MagicDrawUML JEAF Generator also supports Eclipse Papyrus as modeling tool ( |
|
| Parameter defines the type of Enterprise Java that should be used for code generation. By default JavaEE (aka JEE) is used. Using this parameter the Enterprise Java type can be configured. For backward compatibgility reasons default value is still JavaEE (aka JEE). However, usage of Jakarta EE ( |
|
| Name of the root template for customer specific extensions |
| optional | List of custom check files that will be used to run customer specific checks of the UML model. |
| required in case of code generation from UML models but not for message constants only. | Whitelist of packages for the JEAF Generator. Model elements of all packages that match with the white list will be handled by JEAF Generator. |
| optional | List of resource files that should be ignored when generating message constants classes from resource files. |
| optional | Company information for header of generated files. |
| optional | Author information for header of generated files. |
| optional | Copyright information for header of generated files. |
| optional | Version information for header of generated files. |
|
| Parameter can be used to disable formatting of generated sources and resources in general. |
|
| Parameter can be used to disable formatting of generated sources only. |
|
| Parameter can be used to disable formatting of generated resources only. |
| optional | Reference to the file that contains the code style definition for Java code. If it is not defined then the default code style will be used. |
| optional | Reference to the file that contains the code style definition for XML. If it is not defined then the default code style will be used. |
|
| Parameter defines the grouping and sorting of Java import statements. |
|
| Parameter defines the grouping and sorting of static Java import statements. |
|
| Switch defines if |
|
| Switch defines if |
|
| Switch defines if |
|
| Switch defines if |
|
| Switch defines whether POJO's should be serializable or not. |
|
| Switch defines if extensible enums should be generated in light-weight or heavy-weight style. By default to so called light-weight style is used where extensible enums will have an additional literal |
|
| Switch defines whether generated |
|
| Switch defines if Java Validation Annotation |
|
| Switch defines whether Java Validation Annotations should not only be generated for explicitly modeled annotations but also from multiplicity of modeled attributes. |
|
| Switch defines whether Java Validation Annotations should not only be generated for explicitly modeled annotations but also from multiplicity of modeled associations. |
|
| Switch defines if object validation should be generated in build() operation of the class builder. If it is enabled then the generated code will have a dependency on one of the following artifacts: Spring Boot: <dependency>
<groupId>com.anaptecs.jeaf.validation</groupId>
<artifactId>jeaf-validation-api-spring</artifactId>
<version>${1.6.0 or higher}</version>
</dependency> JEAF: <dependency>
<groupId>com.anaptecs.jeaf.validation</groupId>
<artifactId>jeaf-validation-api-service-provider</artifactId>
<version>${1.6.0 or higher}</version>
</dependency> Depending on the implementation of class |
|
| Switch defines if an Which properties will be used for the |
|
| Switch defines if an |
|
| Switch defines whether for the Java representation of OpenAPI Data Types as |
|
| Switch enables that JEAF Generator generates a |
|
| When working with soft links in your UML model then you can define there that a custom generic type should be used for the soft link. The concrete java type (its fully qualified class name) that should be used can be defined through this parameter. |
|
| Switch defines whether the generated set methods for one-to-many associations should be public or not. |
|
| Switch defines whether the generated set methods for to-one associations has checks for null values of parameters. |
|
| Switch defines whether generated methods dealing with any kind of collections must ensure that the internal state of an object can not be modified by accident. This will lead to get method that make use of Builders that receive a collection as input will copy their content. This is the default behavior of JEAF Generator. If this parameter is set to |
|
| Switch defines whether generated methods dealing with arrays must ensure that the internal state of an object can not be modified by accident. This will lead to Builders that receive an array as input will copy their content. This is the default behavior of JEAF Generator. If this parameter is set to |
|
| Switch defines whether generated methods dealing with byte arrays must ensure that the internal state of an object can not be modified by accident. This will lead to |
|
| Switch defines if only the public view of POJO's or ServiceObjects should be generated. This will lead to generated classes where some internal structures of a POJO / ServiceObject will be hidden to the outside world. |
|
| Switch defines if a detailed toString() method should be generated for POJOs, ServiceObjects and DomainObjects. "Detailed" here means that besides the attributes of an class also references to other objects and arrays with be present in result of |
|
| Parameter defines if generated code for JSON serialization / deserialization should be SemVer compliant, which is strongly recommend. If parameter is set to true then generated code will ignore unknown properties in read JSON and just ignore them. |
|
| Parameter defines if JAX-RS annotations for service objects or POJOs should be generated. If the parameter is set to |
|
| Parameter defines if Jackson annotations for service objects or POJOs should be generated. If the parameter is set to |
|
| Parameter can be used to define a list of warning that should be suppressed in the generated code. This will lead to annotation |
|
| Parameter can be used to suppress all warnings in generated code It's strongly recommended to not use this feature ;-) |
|
| Switch defines if errors during code generation should break the build. This feature is mainly intended for test purposes of JEAF Generator itself. |
|
| Parameter can be used to add |
|
| Parameter can be used to also add timestamp of code generation to the |
|
| Parameter can be used to also add the defined comment of code generation to the |
|
| Parameter can be used to define the target runtime environment for which code should be generated. Currently JEAF, Spring and Java are supported. Valid values are : |
|
| REST Library that is the target for code generation. Depending on the target runtime either JAX-RS (Java and JEAF) or Spring Web MVC (Spring) is used as default. Supported values are: |
Configuration Parameters for Services / REST Resources
Configuration Parameter | Required / Optional / Default | Description |
---|---|---|
|
| Switch defines whether service objects should be generated or not. |
|
| Switch defines whether service interfaces should be generated or not. |
|