4.3.5. Starting Build Tasks
Gradle tasks described in build scripts can be launched in the following ways:
-
If you are working with the project in CUBA Studio, many commands that you run from the CUBA main menu actually delegate to Gradle tasks: all commands of the Build Tasks item, as well as Start/Stop/Restart Application Server and Create/Update Database commands.
-
Alternatively, you can use the executable
gradlew
script (Gradle wrapper) included in the project. -
One more way is to use the manually installed Gradle version 5.6.4. In this case, run the
gradle
executable located in thebin
subdirectory of the Gradle installation.
For example, in order to compile the Java files and build the JAR files for project artifacts, you need to run the following command:
gradlew assemble
./gradlew assemble
If your project uses Premium Add-ons and you are starting build tasks outside Studio, you should pass the Premium Add-ons repository credentials to Gradle. See the section above for details. |
Typical build tasks in their normal usage sequence are provided below.
-
assemble
– compile Java files and build JARs for project artifacts in thebuild
subdirectories of the modules. -
clean
– removebuild
subdirectories of all project modules. -
setupTomcat – setup the Tomcat server to the path that is specified by the
cuba.tomcat.dir
property of thebuild.gradle
script. -
deploy – deploy the application to the Tomcat server that has been pre-installed by the
setupTomcat
task. -
createDb – create an application database and run the corresponding scripts.
-
updateDb – update the existing application database by running the corresponding scripts.
-
start – start the Tomcat server.
-
stop – stop the running Tomcat server.
-
restart – sequentially run the
stop
,deploy
,start
tasks.