Gradle, Flyway & Oracle APEX – a few words about migration. Part 2

29 November 2019, Lech Cieślik

When we are working on projects for our clients, we often face the problem of database schema migration. In the previous article, I answered the basic questions about the migration problem. I presented capabilities of the Gradle and Flyway tools and with their help I prepared the migration process of several database scripts. However, let’s not forget about Oracle APEX applications. We can also migrate them using Gradle. All we have to do is use two commands export_apex and import_apex.

In the previous article I presented an example configuration of the build.gradle file. Reminder. Build.gradle is located in the main project directory and describes its compilation. It is based on DSL. The file defines tasks responsible for performing specific actions (implemented in Groovy or Kotlin). We will implement actions like apex export and import by creating our own tasks. Let’s do it!

In the build.gradle file we will implement a sample task that will display “My first task!” on the screen.

To run the task we will use the command:


Export & import of APEX applications using Gradle

Exporting Oracle APEX applications can be done in several different ways. One of them is to use the SQLcl command according to the following example:

Create a file export.sql containing the above command. Then in the build.gradle file define a new task export_apex according to the following example:

Tasks in Gradle have their own types that allow the use of specific methods. More about the tasks and their types can be found on the website:

Start task using the command:

I’ve just exported Oracle APEX application. We can also import it using tasks. Example below:

Start task using the command:


Defining tasks in the build.gradle file allows us to automate many processes. In this article I’ve presented how to export and import Oracle APEX using only one command.

Tagged with: , , , , ,

Hire us!

Pretius is a software development company.
We create web applications using: Java, Oracle DB, Oracle Apex, AngularJS.
Contact us to talk about how we can help you with your software project!