In some DevOps scenarios, there is a need to integrate the generated application code into a pipeline where Git is used for SCM, Maven is used to compile it, and other tools are used to take that code through testing to production.
: This is not the typical case. The 'single source of knowledge' in GeneXus projects is the Knowledge Base
in GeneXus Server
, and GeneXus Server is the recommended tool for SCM.
However, for the reason described at the beginning of this article, in some companies, the goal is to package sources to later assemble the binaries, instead of packaging the binaries directly. To achieve this in GeneXus, you must select Local as the Target in the Application Deployment tool and set the "Sources" value in the Package Type property.
When you select that target and deploy, the source code, resources, and libraries corresponding to the selected Deployment Unit object are copied to a specific folder structure.
These files can then be put under version control -with Git, for example.
This target also allows generating the pom.xml file required to compile the application with Maven. For that, you must set the Generate Maven pom file property to True.
When you set that property to True, a couple of new properties appear. Maven path for local libs property, where you can set the path where Maven expects the required jars (libs) for the compilation of the app to be located when no Maven dependency is known, and the Maven file version property which will help you easily identify the version of the Maven compiled application.
To generate the pom.xml, GeneXus uses a template named Maven.pom.stg that is copied to the Knowledge Base directory so that you can change it adding your plugins, profiles, reference parent files, etc.
That template is a template group of StringTemplate which has the skeleton of the XML and references subtemplates that you can change as needed.