Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot invoke method get() on null object #119

Open
lfgcampos opened this issue Apr 14, 2023 · 2 comments
Open

Cannot invoke method get() on null object #119

lfgcampos opened this issue Apr 14, 2023 · 2 comments

Comments

@lfgcampos
Copy link

lfgcampos commented Apr 14, 2023

I believe this is more of a usage question rather than a bug.

I have my project configured using Kotlin DSL.
But for some internal reasons, I need to configure my own gradle task, which is pretty common.

An extract of my code look like this:

import org.liquibase.gradle.LiquibaseTask
import org.liquibase.gradle.liquibase.command.RollbackCountCommand

plugins {
    id("org.liquibase.gradle") version "2.2.0"
}

// ...

dependencies {
    // liquibase properties
    liquibaseRuntime("org.liquibase:liquibase-core:4.20.0")
    liquibaseRuntime("org.postgresql:postgresql:42.5.1")
    liquibaseRuntime("info.picocli:picocli:4.6.1")
}

// ...

tasks.register<LiquibaseTask>("rollbackChangeSet") {
    group = "liquibase-internal"
    liquibaseCommand = RollbackCountCommand()
    liquibase {
        activities.register("runRollback") {
            this.arguments = mapOf(
                    "changeLogFile" to dbMasterChangelog,
                    "url" to databaseUrl,
                    "username" to databaseUser,
                    "password" to databasePass,
                    "driver" to databaseDriver,
                    "logLevel" to "INFO",
                    "count" to 1
            )
        }
        runList = "runRollback"
    }
}

// ...

When I run it, I get the error mentioned:

Cannot invoke method get() on null object

It happens here suggesting that the liquibaseVersionProvider was not created properly, meaning the overrode configure wasn't called for the task.

I've tried to find ways to call it myself, hook it into some sort of gradle task lifecycle and other things without luck.

The same task used to work with previous version of liquibase and the plugin.

  • plugin: 2.1.1
  • liquibase: 3.5.5

Can it be a bug? Am I doing something wrong here? Any help is appreciated.

@stevesaliman
Copy link
Collaborator

Version 3.0.0 of the plugin was released this morning, and it completely overhauls the way Liquibase tasks are created and configured. Is this still an issue with the latest version?

@lfgcampos
Copy link
Author

Version 3.0.0 of the plugin was released this morning, and it completely overhauls the way Liquibase tasks are created and configured. Is this still an issue with the latest version?

Thanks for the heads up!
Let me play with the new version during the week and get back to you on this =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants