Open T00fy opened 4 days ago
+1
Hi!
I have the same problem. The problem occurs after few minutes of gradle deamon inactivity.
I tried running the following code in the LiquibasePlugin.applyTasks
method.
def commandDefinition = CommandFactory.getInstance().getCommandDefinition('update')
println("liquibase-plugin: commandDefinition.name=${commandDefinition.name}")
println("liquibase-plugin: commandDefinition.shortDescription=${commandDefinition.shortDescription}")
println("liquibase-plugin: commandDefinition.longDescription=${commandDefinition.longDescription}")
println("liquibase-plugin: commandDefinition.arguments.keySet()=${commandDefinition.arguments.keySet()}")
The first run results are as follows.
liquibase-plugin: commandDefinition.name=[update]
liquibase-plugin: commandDefinition.shortDescription=Deploy any changes in the changelog file that have not been deployed
liquibase-plugin: commandDefinition.longDescription=null
liquibase-plugin: commandDefinition.arguments.keySet()=[changeExecListener, changeExecListenerClass, changeExecListenerPropertiesFile, changelogFile, changelogParameters, contextFilter, database, databaseChangelog, defaultCatalogName, defaultSchemaName, driver, driverPropertiesFile, labelFilter, password, showSummary, showSummaryOutput, skipDatabaseStep, updateNullChecksums, url, username]
After 5 minutes, the results are as follows.
liquibase-plugin: commandDefinition.name=[update]
liquibase-plugin: commandDefinition.shortDescription=Deploy any changes in the changelog file that have not been deployed
liquibase-plugin: commandDefinition.longDescription=null
liquibase-plugin: commandDefinition.arguments.keySet()=[]
For some reason, commandDefinition.arguments
becomes empty after a few minutes of inactivity.
I also run the following code in the LiquibasePlugin.applyTasks
method.
def commandDefinition = CommandFactory.getInstance().getCommandDefinition('update')
println("liquibase-plugin: commandDefinition.name=${commandDefinition.name}")
println("liquibase-plugin: commandDefinition.shortDescription=${commandDefinition.shortDescription}")
println("liquibase-plugin: commandDefinition.longDescription=${commandDefinition.longDescription}")
println("liquibase-plugin: commandDefinition.arguments.keySet()=${commandDefinition.arguments.keySet()}")
Scope.exit(Scope.getCurrentScope().scopeId)
commandDefinition = CommandFactory.getInstance().getCommandDefinition('update')
println("liquibase-plugin: commandDefinition.name=${commandDefinition.name}")
println("liquibase-plugin: commandDefinition.shortDescription=${commandDefinition.shortDescription}")
println("liquibase-plugin: commandDefinition.longDescription=${commandDefinition.longDescription}")
println("liquibase-plugin: commandDefinition.arguments.keySet()=${commandDefinition.arguments.keySet()}")
Result:
liquibase-plugin: commandDefinition.name=[update]
liquibase-plugin: commandDefinition.shortDescription=Deploy any changes in the changelog file that have not been deployed
liquibase-plugin: commandDefinition.longDescription=null
liquibase-plugin: commandDefinition.arguments.keySet()=[changeExecListener, changeExecListenerClass, changeExecListenerPropertiesFile, changelogFile, changelogParameters, contextFilter, database, databaseChangelog, defaultCatalogName, defaultSchemaName, driver, driverPropertiesFile, labelFilter, password, showSummary, showSummaryOutput, skipDatabaseStep, updateNullChecksums, url, username]
liquibase-plugin: commandDefinition.name=[update]
liquibase-plugin: commandDefinition.shortDescription=Deploy any changes in the changelog file that have not been deployed
liquibase-plugin: commandDefinition.longDescription=null
liquibase-plugin: commandDefinition.arguments.keySet()=[]
In a future version of liquibase
there will be a CommandFactory.resetCommandDefinitions()
method. I think using it will solve the problem that arguments is empty.
public void resetCommandDefinitions() {
COMMAND_DEFINITIONS.clear();
}
I don't really understand what Liquibase does with its Scope
. However, it seems a bit strange that CommandFactory. commandArgumentDefinitions
is populated by static initializers (e. g. the .build()
calls in UpdateToTagCommandStep
), while the CommandFactory
itself is bound to the Scope
.
This is directly related to #154
While
./gradlew --no-daemon
and./gradlew --stop
do get around this isusue, it still occurs everytime gradle has cached a deamon, and requiring to kill the daemons everytime is cumbersome.Can this be investigated?