Gradle and the Java Generator

Official Content
This documentation is valid for:

Gradle is an advanced compilation tool that allows you to automate and manage the compilation process, as well as to define customized and flexible compilation configurations. 

As from GeneXus 18, Gradle is the tool for managing the Java Generator’s dependencies and build process. Therefore, the compilation mechanism GXJMake and createwebapplication.bat are no longer used, and Gradle is used instead. In addition, the compile folder that contained a file for every GeneXus object to be compiled is no longer used either.

The use of Gradle brings about the following changes: at the folder structure level, the available command lines, and the properties to generate your KB.

Folder structure

Below is a list of the folders structure:

  • The *.java sources are generated in the folder src\main\java.
  • The JavaScript sources are generated in the js folder of the model.
  • The compiled code is generated in the folder build\classes\java\main.

Command lines 

Gradle can be called from command line, indicating the task to be executed. The available tasks are listed below:

This task calls the tasks buildGenexus, copyTomcat, and compileJava.

This task calls the tasks copyRuntimeLibs and copyAdditionalFiles.

This task compiles all the existing sources in “src\main\java” and leaves the classes in “build\classes\java\main.”

This task downloads and copies all the necessary packages to the “build\libs” folder to execute any proc command line.

This task copies all the necessary files to the “build\classes\java\main” folder from the model folder to execute any proc command line.

This task downloads and copies all the necessary packages to the webapp lib folder in Tomcat to run the webapp.

This task copies all the necessary classes to the webapp classes folder in Tomcat in order to run the webapp.

This task copies all the static content to the 'static' folder of the webapp in Tomcat.

This task copies all necessary resources other than jars, static content, or classes to the Tomcat webapp.

This task calls the tasks that are necessary to run the webapp on Tomcat. 

This task deletes the “dependencies” folder.

This task calls the cleanTomcat, cleanSources tasks and deletes the “build” folder.

This task deletes the webapp from Tomcat.

This task deletes all the sources from the “src\main\java” folder.

This task downloads all the packages needed to run to the “dependencies” folder.


The Gradle project is located in the build.gradle file that is distributed by GeneXus with the generator. This file is overwritten when the generator is updated.

In addition, Gradle uses a set of properties to run the project. These properties are located in the file, which is generated every time you compile. 

To run Gradle from the command line, you may want to overwrite some of the properties of the file, which are shown in the table below. To overwrite the values of these properties, you must indicate the value of the property in the command line.

GENEXUS_VERSION Version of the standard classes to be used.
JAVA_PACKAGE_NAME_FOLDER Package name of the model.
TOMCAT_STATIC_PATH Path to the static folder in Tomcat.
JAVA_PLATFORM It can have the values jakartaEE, javaEE or both.
SQLSERVER If a SQL Server datastore exists.
ORACLE If an Oracle datastore exists.
POSTGRESQL If a PostgreSQL datastore exists.
MYSQL If a MySQL datastore exists.
DB2ISERIES If an iSeries datastore exists.
WEBAPP_NAME Name of the webapp in Tomcat.
LAYOUT_METADATA_FOLDER If there are dynamic reports, their templates are saved in this folder.
DAMENG If a Dameng datastore exists.


The following examples are command line calls to Gradle.

Sample #1

You can make a Build using the Build task with the properties defined by default in the file that GeneXus generated. To do so, type the following in command line: 

gradlew.bat build

It is the same command that is called from GeneXus when selecting any Build option.

Sample #2

It is also possible to make a Build by typing the value of the GENEXUS_VERSION property, as shown in the following line:

gradlew.bat build -PGENEXUS_VERSION="2.8-SNAPSHOT"



  • To start Gradle it uses the value defined in the JAVA_HOME environment variable.



This feature is available since GeneXus 18.