0

In our project we are using Liquibase gradle plugin. Recently, we updated ojdbc8 plugin to version 18.3.0.0. Unfortunately, it caused our Liquibase task to fail with ORA-01882: timezone region not found. I found some solutions for this error (e.g. there: ORA-01882: timezone region not found), but I have no idea how I could add this -Duser.timezone or -Doracle.jdbc.timezoneAsRegion property to gradle task. I tried different approaches, but with no success.

This is how some crucial parts of our build.gradle look like:

liquibase {
    activities {
        oracle {
            changeLogFile "$liquibasePath/db.changelog-master.xml"
            driver liquibaseProps['oracle.driver']
            url "jdbc:oracle:thin:@${liquibaseProps['oracle.ip.port']}:${liquibaseProps['oracle.schema']}"
            username liquibaseProps['oracle.username']
            password liquibaseProps['oracle.password']
            outputDefaultSchema false
            outputDefaultCatalog false
        }
    }
}


def generate(taskName, taskDescription, generateCommand) {
    project.task(taskName, type: LiquibaseTask) {
        group = 'Liquibase'
        description = taskDescription

        inputs.property('databases', getRunList())
        inputs.dir liquibasePath
        outputs.dir sqlScriptsPath


        doLast {
            new LiquibaseSqlCleanupTask(sqlScriptsPath).execute()
        }
    }
}
wojtek1902
  • 503
  • 2
  • 10
  • 25

1 Answers1

1

You need to set that as a system property when running gradle. The docs for that are at https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_system_properties, but here is a copy/paste of the most relevant info:

Using the -D command-line option, you can pass a system property to the JVM which runs Gradle. The -D option of the gradle command has the same effect as the -D option of the java command.

You can also set system properties in gradle.properties files with the prefix systemProp.

So you could create a gradle.properties file in the root directory of your project with contents like this:

systemProp.oracle.jdbc.timezoneAsRegion=false
SteveDonie
  • 8,700
  • 3
  • 43
  • 43