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.
Below is a list of the folders structure:
- The *.java sources are generated in the folder src\main\java.
- The compiled code is generated in the folder build\classes\java\main.
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 gradle.properties 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 gradle.properties 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.
||Version of the standard classes to be used.
||Package name of the model.
||Path to Tomcat.
||Path to the static folder in Tomcat.
||It can have the values jakartaEE, javaEE or both.
||If a SQL Server datastore exists.
||If an Oracle datastore exists.
||If a PostgreSQL datastore exists.
||If a MySQL datastore exists.
||MySQL Datastore Version.
||If an iSeries datastore exists.
||Name of the webapp in Tomcat.
||If there are dynamic reports, their templates are saved in this folder.
||If a Dameng datastore exists.
The following examples are command line calls to Gradle.
You can make a Build using the Build task with the properties defined by default in the gradle.properties file that GeneXus generated. To do so, type the following in command line:
It is the same command that is called from GeneXus when selecting any Build option.
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.