Git Product home page Git Product logo

liquibase-gradle-plugin's Introduction

Liquibase Gradle Plugin

A plugin for Gradle that allows you to use Liquibase to manage your database upgrades. This project was originally created by Tim Berglund, and is currently maintained by Steve Saliman.

Users updating from prior versions of this plugin should look at the Releases page for more information about the releases, including any breaking changes.

Documentation

liquibase-gradle-plugin's People

Contributors

aakoch avatar bomgar avatar dthompsn avatar eggoxygen avatar esselesse avatar filipelautert avatar frangarcia avatar gavvvr avatar gvsandeep2647 avatar haraldradi avatar jspeis avatar mgemard avatar petertrr avatar stevesaliman avatar thunderforge avatar tlberglund avatar tylorjg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liquibase-gradle-plugin's Issues

Accessing changeLogParameters

I tried to access the changeLogParameters set in my build gradle file but I can't reach them. Tried both way to acess them tried ${} it's not accessible.

liquibase
{
  activities
  {
    main
    {
      url databaseUrl
      username databaseUsername
      password databasePassword
      changeLogFile "changelog/changelog-master.groovy"
      classpath "${projectDir}/src/db"
      changeLogParameters([ dbms: "${database}"])
    }

Is there any secret sauce here. Also I'd like to access the classpath in the groovy file as well, how can I do that ?

In my groovy file

changeSet(author: 'user', id: 'xyz') {
    sqlFile(path: "changelog/${dbms}/1.0.RELEASE/track/test.sql")
  }

The error I got is this...

SEVERE 12/3/18 11:51 AM: liquibase: No such property: dbms for class: Script1
groovy.lang.MissingPropertyException: No such property: dbms for class: Script1
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
	at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
	at Script1$_run_closure1.doCall(Script1.groovy:13)

Is this a bug ?

My plugin version is 1.2.4

System properties support

Hello,
are there any system property support? like in maven plugin:

                <configuration>
                    <driver>oracle.jdbc.driver.OracleDriver</driver>
                    <url>${jdbc.url}</url>
                    <username>${jdbc.username}</username>
                    <password>${jdbc.password}</password>
                    <systemProperties>
                        <oracle.net.tns_admin>src/liquibase/</oracle.net.tns_admin>
                        <need-check>${need-check}</need-check>
                    </systemProperties>
                </configuration>

Currently I add such hack:

project.tasks.findAll { it.name.startsWith(project.liquibaseTaskPrefix) }.each {
    it.doFirst {
        System.setProperty('oracle.net.tns_admin', 'src/liquibase/')
    }
}

Make it a bit clearer that one can use the Oracle Wallet by setting a few systemProps

This is less of a problem with the plugin and more of an issue with how it's documented.

I'm working on a project which makes use of the Oracle wallet, and we were running into an issue with not being able to connect to the database.

These instructions were a good clue, but they didn't transliterate over to the plugin that well. Initially I had the properties added in a block inside of the activity itself:

dev {
    changeLogFile 'path/to/changelog.xml'
    url 'jdbc:oracle:thin:@ALIAS'
    parameters += [
        'oracle.net.tns_admin': '/path/to/tns_admin/folder'
        'oracle.net.wallet_location': '/path/to/wallet/folder'
    ]
}

However that was unnecessary (and also not working).

What I wound up doing was adding these values into the gradle.properties file directly:

systemProp.oracle.net.tns_admin=/path/to/tns_admin/folder
systemProp.oracle.net.wallet_location=/path/to/wallet/folder

While I realize that this quite niche, I feel like this should be documented somewhere. If I'm told where it's acceptable to do so, I can also write up the documentation in my spare time.

Wrong tasks help

In your tasks help there are many mentions of <liquibase.commandValue> but this value is invalid because valid value is

Example

lqRollbackCount - Rolls back the last <liquibase.commandValue> change sets.
lqRollbackToDate - Rolls back the database to the state it was in at the <liquibase.commandValue> date/time.
lqTag - Tags the current database state with <liquibase.commandValue> for future rollback
lqUpdateCount - Applies the next <liquibase.commandValue> change sets.

tagExists doesn't work

If you execute gradle tagExists -PliquibaseCommandValue=v1.0.0 on a database that you tagged with gradle tag -PliquibaseCommandValue=v1.0.0 the command doesn't return anything.
Nor does it complain if you check for a tag that doesn't exist at all, in this case, tag v1.0.1.

Here's my DATABASECHANGELOG entry with the current tag:

+------------------+--------+----------------------------------------+---------------------+---------------+----------+------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+----------+-------------+-----------+----------+--------+---------------+
| ID               | AUTHOR | FILENAME                               | DATEEXECUTED        | ORDEREXECUTED | EXECTYPE | MD5SUM                             | DESCRIPTION                                                                                                                              | COMMENTS | TAG         | LIQUIBASE | CONTEXTS | LABELS | DEPLOYMENT_ID |
+------------------+--------+----------------------------------------+---------------------+---------------+----------+------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+----------+-------------+-----------+----------+--------+---------------+
| 1540907006515-53 | xxxx    | my-changeLog | 2018-11-16 11:08:43 |            53 | EXECUTED | xx:xxxx | addForeignKeyConstraint baseTableName=xxxxx, constraintName=xxxxx, referencedTableName=xxxx |          | v1.0.0-beta | 3.6.2     | NULL     | NULL   | 2366518615    |
+------------------+--------+----------------------------------------+---------------------+---------------+----------+------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+----------+-------------+-----------+----------+--------+---------------+

Check for an existing tag

/db # gradle -i tagExists -PliquibaseCommandValue="v1.0.0-beta"
Initialized native services in: /root/.gradle/native
Using 1 worker leases.
Starting Build
Settings evaluated using settings file '/db/settings.gradle'.
Projects loaded. Root project using build file '/db/build.gradle'.
Included projects: [root project 'db']

> Configure project :
Evaluating root project 'db' using build file '/db/build.gradle'.
All projects evaluated.
Selected primary task 'tagExists' from project :
Tasks to be executed: [task ':tagExists']
:tagExists (Thread[main,5,main]) started.

> Task :tagExists
Task ':tagExists' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
liquibase-plugin: Running the 'main' activity...

REMOVE OUTPUT

Successfully started process 'command '/usr/lib/jvm/java-1.8-openjdk/bin/java''
Starting Liquibase at Thu, 22 Nov 2018 21:11:13 GMT (version 3.6.2 built at 2018-07-03 11:28:09)
Liquibase command 'tagExists' was executed successfully.
:tagExists (Thread[main,5,main]) completed. Took 1.053 secs.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3s
1 actionable task: 1 executed

Checking for a bogus database tag

/db # gradle -i tagExists -PliquibaseCommandValue="v1.0.0-beta1"
Initialized native services in: /root/.gradle/native
Using 1 worker leases.
Starting Build
Settings evaluated using settings file '/db/settings.gradle'.
Projects loaded. Root project using build file '/db/build.gradle'.
Included projects: [root project 'db']

> Configure project :
Evaluating root project 'db' using build file '/db/build.gradle'.
All projects evaluated.
Selected primary task 'tagExists' from project :
Tasks to be executed: [task ':tagExists']
:tagExists (Thread[main,5,main]) started.

> Task :tagExists
Task ':tagExists' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
liquibase-plugin: Running the 'main' activity...

REMOVED OUTPUT

Successfully started process 'command '/usr/lib/jvm/java-1.8-openjdk/bin/java''
Starting Liquibase at Thu, 22 Nov 2018 21:11:25 GMT (version 3.6.2 built at 2018-07-03 11:28:09)
Liquibase command 'tagExists' was executed successfully.
:tagExists (Thread[main,5,main]) completed. Took 1.05 secs.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3s
1 actionable task: 1 executed

Running Java/Groovy classes as part of a changeset

I am wondering whether it is possible to run a Java/Groovy/... class from the same Gradle module. When I tried it, it was giving me a java.lang.ClassNotFoundException.

Example with a XML changeset:

  <changeSet id="something" author="me">
    <customChange class="foo.HelloWorld"/>
  </changeSet>

I assume that the class isn't part of the classpath that the plugin uses. Putting the class in an external artifact and then adding a 'classpath' dependency on it becomes more complex than it should be. :-(

[spring boot] ./gradlew diffChangeLog isn't updating changelog correctly

When I run ./gradlew diffChangeLog, liquibase detects the changes but when it modifies my changelog.groovy it inserts the new lines with formatting errors or typos. Like a wrong merge conflict fix.
For example, after running that command, this is being inserted in changelog.groovy

lumn(name: 'testTable', type: 'INT')
      column(name: 'name', type: 'VARCHAR(255)')
      column(name: 'priority', type: 'INT')
      column(name: 'timezone', type: 'VARCHAR(255)')
      column(name: 'type', type: 'VARCHAR(255)')
    }
  }

instead of Column it says lumn - Also, the whole databaseChangeLog block closes and then, after the closing curly brace, there are more changesets inserted. Which shouldn't be happening.
Tried with the groovy liquibase dsl plugin and also with the yaml version and in both cases the same is happening.

How to specify driver?

How can I specify driver class?
I am trying to configure plugin to be used against Aurora db which is mysql and I am using mariadb jdbc driver.

Passing variables to liquibase

Using the the liquibase maven plugin it is possible to have changesets like:

--liquibase formatted sql
--changeset rdbms:827d580e-b864-4ce7-ae8e-a0ffa34623d4 dbms:postgresql context:init runInTransaction:false
CREATE DATABASE ${database.name} WITH OWNER=${database.application.role} ENCODING='UTF8';

and to pass the values for database.name and database.name from the pom.xml file.
Is it possible to do something similar using this plugin?

Task prefix parameter (liquibaseTaskPrefix) cannot be set from within build.gradle

If I try to set the property liquibaseTaskPrefix from inside build.gradle regardless of scope i.e.

liquibase {
    // Prefix commands to avoid naming conflicts - update will become dbUpdate
    liquibaseTaskPrefix = 'myPrefix'
    activities {
    ...
    }
}

i get an error

Could not set unknown property 'liquibaseTaskPrefix' for object of type org.liquibase.gradle.LiquibaseExtension.

If I pass the property as

gradle diff -PliquibaseTaskPrefix=abc

then it works

Ideally I would like to have it inside my liquibase closure, so that i don't configure it at every call with -P
I can propose a pull request.

-Plabels is not being picked up and applied

I'm trying to run some sql formatted changeset that have labels. I only want to run update for the passed in label, but liquibase is always running for all.

I'm on 1.2.4:
classpath 'org.liquibase:liquibase-gradle-plugin:1.2.4'

Inside my main task I'm setting:

            if (project.hasProperty('labels')) {                
                labels labels
            }    

command is essentially:
gradle -Penv=prod update -Plabels=dwc001_query_log_1.0 -Pcontexts=ETL

If I print out the label inside build.gradle, I cann see it's there, but it doesn't seem to be applied. This same approach works fine for the contexts though.

this is how my sql changesets are setup:

--changeset my_email_address:creation_of_dwc001_query_log_raw context:ETL labels:dwc001_query_log_1.0

Thanks!

How to pass sql substitution parameters to Liquibase changelog?

Hi Steve,

I have some changeSets in a groovy changeLog file that contains substitution parameters. I'm passing the parameter as a -D property on the gradle CLI but its not being recognised.

e.g. gradle updatePub -Pcontexts=backport -Dtarget=local

The updatePub task is a GradleBuild wrapper task that has all the necessary liquibase parameters setup.

An example changeset might contain:
update(tableName: 'site_configuration') {
column(name: 'production_url', value:"xxx-${target}-mystore.com")
where('id=xxx')
}

Everything works fine without the target param but when its added the command fails with:

liquibase.exception.LiquibaseException: Unexpected error running Liquibase: No such property: target for class: org.liquibase.groovy.delegate.ColumnDelegate

The interesting thing is that I did have it working at some point but I cannot get back to that point.
If I list the gradle startParameter I can see it coming through correctly as: systemPropertiesArgs={target=local},...

I've also tried running as the basic: gradle update and passing all the params but have the same issue.
Any ideas what I need to do to pass this parameter through?

Support Liquibase 3.4.1

Liquibase 3.4 has some nice improvements. Can the plug-in be updated to use Liquibase 3.4.1?

Pass defaultSchemaName via command line

I'm trying to pass --defaultSchemaName=FOO via the command line.

How do I do that?

I tried

  • --defaultSchemaName=FOO
  • -PdefaultSchemaName=FOO
  • -PliquibaseDefaultSchemaName=FOO
  • -PliquibaseCommandDefaultSchemaName=FOO

None work and the docs doesn't seem to explain how to pass args :(

Configuration example for kotlin-dsl

Hello,

I would like to use this plugin in a gradle env, but with the kotlin-dsl which seems to be complicated due to implementation made in this plugin (usage of Closure which seems to not be the best solution from the gradle website documentation).

I've tried a lot of things but without success to allow a simple changelog execution. My last attemps is this and doesn't do anything. I don't know if I'm far or close to the goal so I preffer ask you some help

liquibase {
    activities(
            closureOf<NamedDomainObjectContainer<Activity>> {
                mapOf(
                        "main" to closureOf<Activity> {
                            mapOf(
                                    "changeLogFile" to "src/main/resources/db/changelog.xml",
                                    "url" to "jdbc:h2:mem"
                            )
                        }
                )
            }
    )
}

Thanks for your help

Caused by: java.lang.NoClassDefFoundError: org/yaml/snakeyaml/Yaml

We observed this error when using yaml files and it seems to start since version 1.0.1 (tlberglund), including this current fork.

e.g.
liquibase {
activities {
main {
changeLogFile "$projectDir/" + 'src/main/resources/db/changelog/db.changelog-master.yaml'
url 'jdbc:mysql://localhost:3306/myschema'
username 'user'
password 'pwd'
}
}
}

./gradlew update

org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.3-bin.zip'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:57)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:71)
at org.springsource.ide.eclipse.gradle.core.TaskUtil.execute(TaskUtil.java:117)
at org.springsource.ide.eclipse.gradle.core.launch.GradleProcess$1.doit(GradleProcess.java:92)
at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable$1.run(GradleRunnable.java:53)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':update'.
at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:77)
at org.gradle.initialization.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
at org.gradle.initialization.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:30)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:43)
at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:30)
at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:119)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:48)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:71)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':update'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:306)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
... 34 more
Caused by: org.gradle.internal.UncheckedException: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: org.yaml.snakeyaml.Yaml
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:39)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:66)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 57 more
Caused by: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: org.yaml.snakeyaml.Yaml
at liquibase.integration.commandline.Main.run(Main.java:205)
at net.saliman.gradle.liquibase.LiquibaseTask.runLiquibase(LiquibaseTask.groovy:95)
at net.saliman.gradle.liquibase.LiquibaseTask$_liquibaseAction_closure2.doCall(LiquibaseTask.groovy:54)
at net.saliman.gradle.liquibase.LiquibaseTask.liquibaseAction(LiquibaseTask.groovy:53)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
... 64 more
Caused by: java.lang.NoClassDefFoundError: org/yaml/snakeyaml/Yaml
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:44)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:215)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.integration.commandline.Main.doMigration(Main.java:1044)
at liquibase.integration.commandline.Main.run(Main.java:175)
... 68 more
Caused by: java.lang.ClassNotFoundException: org.yaml.snakeyaml.Yaml
... 73 more

I do not see anything obvious beetween the 1.0.0 and 1.0.1 diffs found here:
tlberglund@d07f4fb

Thanks

Specify working directory

I put my change log in the src/main/db directory. Is it possible to specify this directory as "working directory" used to resolve absolute path in include element.
Which is the default directory from which all path are resolved launching the plugin tasks?

Unusual behaviour with different changeLogFile path

I'm configuring liquibase with gradle and I have some problems.
My changelog files are in json (not a problem).
eclipse oxygen
java 8
liquibase-core 3.5.3 (forced)

when I execute ./gradlew dropAll update in command line, the error output is different with different changeLogFile path:

case 1:

changeLogFile 'src/main/db/changelog/my.changelog-master.json'

case 2:

changeLogFile 'my.changelog-master.json'

Here an example project to test projectB.zip

Try to execute the command changing changeLogFile property .

executing the same commands within eclipse, the behaviuor is like case 2

No plugin support for passing any "contexts" argument through to liquibase

Does not appear to be any easy way to pass "contexts" through to liquibase using the plugin. I've implemented something similar to what is found here but it seems like it should be more directly supported.

Happy to help with a pull request, but would like to know if a) if there is agreement this should be addressed... and b) what the suggested approach might be.

Thanks

--verbose issue

While executing command:

gradle -PliquibaseCommandValue=--verbose status

I have this error message every time when I use changeLogParameters in my Activity

unexpected command parameters [--verbose=-Dliquibase.appUserRole=UserRole]

liquibase.appUserRole - it is my parameter from
activities {
changeLogParameters('liquibase.appUserRole' : someParameter)
}

Without changeLogParameters property everything works ok

Unable to run diffChangeLog with spring boot with java 11

Hello. As instructed in #44 , I am opening a new issue here. Not sure if this a proper issue, and as was discussed in the other thread, this most likely is not even fault of LB gradle plugin. Anyway, I will appreciate any help or advice on how I could proceed with this without resorting to Java 8 (which I haven't tried yet, but it should supposedly work).

So, I am trying to generate liquibase changelog based on changed JPA entities. My build.gradle looks like this:

buildscript {
	ext {
		springBootVersion = '2.1.0.RELEASE'
        runList = 'main'
        diffLog = '$projectDir/src/main/resources/db/changelog/db.changelog-master.xml'
    }
	repositories {
		mavenCentral()
//        maven {url "https://jitpack.io"}
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath 'org.liquibase:liquibase-gradle-plugin:2.0.1'
        classpath 'org.liquibase:liquibase-core'
//        classpath 'com.github.liquibase:liquibase:master-SNAPSHOT'
        classpath 'org.postgresql:postgresql:42.2.5'
        classpath 'org.liquibase.ext:liquibase-hibernate5:3.6'
        classpath 'org.springframework.data:spring-data-jpa:2.1.2.RELEASE'
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.liquibase.gradle'


group = 'org.company'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 11.0
diffLog = '$projectDir/src/main/resources/db/changelog/db.changelog-{$version}.xml'


repositories {
	mavenCentral()
}


dependencies {
	implementation('org.springframework.boot:spring-boot-starter-data-jpa')
	implementation('org.springframework.boot:spring-boot-starter-security')
	implementation('org.springframework.boot:spring-boot-starter-webflux')
	implementation('org.springframework.session:spring-session-core')
	implementation('org.liquibase.ext:liquibase-hibernate5:3.6')
	implementation('org.liquibase:liquibase-core:3.6.2')
// 	implementation('com.github.liquibase:liquibase:master-SNAPSHOT')
    implementation('io.reactivex.rxjava2:rxjava:2.2.3')
	implementation("org.hsqldb:hsqldb:2.4.1")
  	implementation("org.postgresql:postgresql:42.2.5")
    compileOnly('org.projectlombok:lombok:1.18.4')

	testImplementation('org.springframework.boot:spring-boot-starter-test')
	testImplementation('io.projectreactor:reactor-test')
	testImplementation('org.springframework.security:spring-security-test')

    liquibaseRuntime('org.springframework.boot:spring-boot-starter-data-jpa:2.1.0.RELEASE')
    liquibaseRuntime('org.liquibase.ext:liquibase-hibernate5:3.6')
    liquibaseRuntime('org.liquibase:liquibase-core:3.6.2')
//    liquibaseRuntime('com.github.liquibase:liquibase:master-SNAPSHOT')
    liquibaseRuntime("org.postgresql:postgresql:42.2.5")
    liquibaseRuntime sourceSets.main.output
}

liquibase {
    activities {
        main {
            changeLogFile project.ext.diffLog
            url 'jdbc:postgresql://localhost:5432/database'
            username 'username'
            password 'password'
            referenceUrl 'hibernate:spring:org.company.warehouse.db?' +
                    'dialect=org.hibernate.dialect.PostgreSQL94Dialect&' +
                    'hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&' +
                    'hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'
            referenceDriver 'liquibase.ext.hibernate.database.connection.HibernateDriver'
            logLevel 'debug'
        }
        runList = project.ext.runList
    }
}

A log from running gradle task in intellij:

Task :diffChangeLog
liquibase-plugin: Running the 'main' activity...
Starting Liquibase at Wed, 05 Dec 2018 19:45:12 CET (version 3.6.2 built at 2018-07-03 11:28:09)
Unexpected error running Liquibase: URI is not hierarchical
java.lang.IllegalArgumentException: URI is not hierarchical
at java.base/java.io.File.(File.java:418)
at liquibase.resource.FileSystemResourceAccessor.addRootPath(FileSystemResourceAccessor.java:51)
at liquibase.resource.AbstractResourceAccessor.init(AbstractResourceAccessor.java:39)
at liquibase.resource.FileSystemResourceAccessor.init(FileSystemResourceAccessor.java:44)
at liquibase.resource.FileSystemResourceAccessor.(FileSystemResourceAccessor.java:26)
at liquibase.integration.commandline.Main.doMigration(Main.java:949)
at liquibase.integration.commandline.Main.run(Main.java:191)
at liquibase.integration.commandline.Main.main(Main.java:129)

Now, a little bit of reading revealed that the fix for this is already merged in the PR liquibase/liquibase#830, but the newest release on maven central is 3.6.2 from 4th July 2018, so the fix remains in master for now. So I tried to include a github repo dependency through jitpack - commented out lines in the build file - but I can't get it to work.

My question is, what options do I have to solve this for now? #44 mentions adding javax.xml.bind:jaxb-api as liquibaseRuntime dependency, so I did that:

liquibaseRuntime("javax.xml.bind:jaxb-api:2.3.1")

But the same thing happens. What steps could I take to properly troubleshoot this? I am not very knowledgeable about how Gradle and its plugins work.

Error with resolving org.liquibase.gradle plugin dependency

Hi,
I am using gradle liquibase plugin version 1.2.4 with gradle version: 4.8.1 as part of the build process , but today after cleaning caches of the local gradle repo, I still getting the following error. Also there are no changes in the proxy configuration or in the firewall.

Thank you!

Here is the stack trace:

FAILURE: Build failed with an exception.

  • Where:
    Build file 'C:........\build.gradle' line: 34

  • What went wrong:
    Error resolving plugin [id: 'org.liquibase.gradle', version: '1.2.4', apply: false]

Could not resolve all dependencies for configuration 'xxxxxx'.
Could not determine artifacts for org.liquibase.gradle:org.liquibase.gradle.gradle.plugin:1.2.4
> Could not get resource 'https://plugins.gradle.org/m2/org/liquibase/gradle/org.liquibase.gradle.gradle.plugin/1.2.4/org.liquibase.gradle.gradle.plugin-1.2.4.jar'.
> Could not HEAD 'https://plugins.gradle.org/m2/org/liquibase/gradle/org.liquibase.gradle.gradle.plugin/1.2.4/org.liquibase.gradle.gradle.plugin-1.2.4.jar'.
> Connection reset

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s
2 actionable tasks: 2 executed

unable to pass rollback parameters to gradle task

When trying to pass the rollback parameters to a gradle task as suggested using -PliquibaseCommandValue, the task fails to find the parameter.

The gradle task is defined as below:

task liquibaseRollback(type: JavaExec) {
group = "liquibase"
classpath sourceSets.main.runtimeClasspath
classpath configurations.liquibase
main = "liquibase.integration.commandline.Main"

args "--changeLogFile=" + changeLogFile
args "--databaseChangeLogTableName=" + databaseChangeLogTableName
args "--databaseChangeLogLockTableName=" + databaseChangeLogLockTableName
args "--username=" + username
args "--password=" + password
args "--url=" + url
args "--driver=" + driverClassName
args "rollbackCount"

}

and trying to add -PliquibaseCommandValue='1' as the last line of the code or running this task from command line, like: gradle liquibaseRollback -PliquibaseCommandValue='1' is not working.

loadUpdateData is not recognized as a valid change

First: thank you for this plugin!

I have the following changeSet in my change log:

  <changeSet author="" id="issue254-seed-roles" runOnChange="true">
    <loadUpdateData file="../seeds/roles.csv"
      primaryKey="code"
      tableName="roles" />
  </changeSet>

When validating this block causes the following error:

liquibase.exception.LiquibaseException: Unexpected error running Liquibase: Error parsing line 57 column 27 of db/changelog/db-changelog-1.0.xml: cvc-complex-type.2.4.a: Invalid content was found starting with element 'loadUpdateData'. One of '{"http://www.liquibase.org/xml/ns/dbchangelog/1.9":validCheckSum, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":preConditions, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":tagDatabase, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":comment, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createTable, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropTable, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createView, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":renameView, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropView, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":insert, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addColumn, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":sql, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createProcedure, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":sqlFile, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":renameTable, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":renameColumn, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropColumn, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":modifyColumn, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":mergeColumns, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createSequence, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":alterSequence, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropSequence, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createIndex, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropIndex, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addNotNullConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropNotNullConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addForeignKeyConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropForeignKeyConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropAllForeignKeyConstraints, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addPrimaryKey, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropPrimaryKey, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addLookupTable, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addAutoIncrement, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addDefaultValue, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropDefaultValue, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addUniqueConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropUniqueConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":customChange, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":update, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":delete, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":loadData, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":executeCommand, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":stop, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":rollback, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":modifySql}' is expected.

If I change loadUpdateData to loadData (and remove the primaryKey attribute) it validates just fine; from the error message it looks like loadUpdateData is not recognized as a legitimate entry in a changeSet -- I'm under the impression that it is, based on: https://www.liquibase.org/documentation/changes/load_update_data.html

Cannot exclude objects from "diff"

I wrote a custom gradle task, to use the diff command. I would like to exclude the tables where Liquibase stores its information from the "diff" command. Here is my code:
`task diffFixedDBvsEntities(type: JavaExec) {
group = "liquibase"

classpath sourceSets.main.runtimeClasspath
main = "liquibase.integration.commandline.Main"

args "--changeLogFile=" + '/home/tom/IdeaProjects/demoLiquibaseGit/src/main/resources/db.changelog/db.changelog-master.yaml'
args "--referenceUrl=" + "hibernate:spring:demoLiquibaseGit.domain.entity?dialect=org.hibernate.dialect.MySQL5Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
args "--username=" + "db"
args "--password=" + "db"
args "--url=" + "jdbc:mariadb://localhost:3306/db?useUnicode=yes&characterEncoding=UTF-8"
args "--referenceDriver=liquibase.ext.hibernate.database.connection.HibernateDriver"
args "--classpath=src/main"
args "diff"
args "--diffExcludeObjects=table_DATABASECHANGELOG"

}`

And here is the error I am getting:
Unexpected error running Liquibase: Unknown option: 'diffExcludeObjects' liquibase.exception.CommandLineParsingException: Unknown option: 'diffExcludeObjects' at liquibase.integration.commandline.Main.parseOptionArgument(Main.java:818) at liquibase.integration.commandline.Main.parseOptions(Main.java:764) at liquibase.integration.commandline.Main.run(Main.java:177) at liquibase.integration.commandline.Main.main(Main.java:129)

I used the documentation for the maven task, because I thought this would be the way to go.

Can't find jdbc driver when useing new-plugin-mechanism

When I use the format

plugins {
  id "org.liquibase.gradle" version "1.2.1"
}

in the build.gradle,I got an error:

Cannot find database driver: org.postgresql.Driver

So,I must add this line

buildscript {
  dependencies {
    classpath 'org.postgresql:postgresql:9.4.1207.jre7'
  }
}

before the plugins targets.Is there another way to set the JDBC driver classpath ?

relativeToChangelogFile="true" doesn't work inside sqlFile-tag

When I'm trying to execute my changelogs using gradle, there is always the exception thrown:
File doesn't exist.

<sqlFile dbms="postgresql"
            encoding="utf8" 
	    relativeToChangelogFile="true"
            path="/databasePostgreSQL/001_classicaldbstruct/create_tables.sql"/>
<rollback>

My Gradle-file:

task('dev') << {
	println "executing dev"
	liquibase {
		activities {
	        main {
	        	ext.extProgram = new Properties()
				extProgram.load(new FileInputStream("$projectDir/config/configJenkins/system.properties"))
	            changeLogFile '/src/database/changelog/db.changelog-master.xml'
	            url extProgram['DB_URL']
	            username extProgram['DB_LOGIN']
	            password extProgram['DB_PWD']
	            classpath "$projectDir"
	        }
	    }
		runList = 'main'
	}
}

consistent filename value between gradle plugin and liquibase java integration.

I just hit same problem as described in http://stackoverflow.com/questions/36217437/liquibase-changeset-filename-format-differences-between-war-deployment-on-applic

I normally have liquibase integrated with application, running at application startup. Now I decided to use liquibase gradle plugin. Updating DB on application startup is convenient for development, but requires DDL rights for application user (not secure, not suitable for production).

When liquibase is run from application runtime, value of DATABASECHANGELOG.FILENAME is
classpath:/changelog/something.xml

Gradle plugin configured with

liquibase {
    activities {
        main {
            ...changeLogFile 'src/main/resources/db.changelog.xml'

generates FILENAME src/main/resources/changelog/something.xml

Gradle plugin configured with

 changeLogFile 'db.changelog.xml'
            classpath 'src/main/resources/'

generates FILENAME changelog/something.xml. That is close do output from java runtime, but not the same.

This causes conflicts, re-runs, etc. I see no way to resolve this. It seems one must stick to one method (liquibase from application runtime, or liquibase from gradle).

Could you improve gradle liquibase plugin to have configurable prefix for filename?
It seems that just addming prefix classpath:/ to generated filename would resolve my issue. Naming fill be consistent between java runtime and gradle plugin.

rollback plugin parameter

I'd like to add rollback parameter to liquibase gradle like it is in maven, but I could not understand inside code how plugin process the require values such as username, password and url. Could you help me, please?

lbDropAll schema

Only public schema is flushed using lbDropAll task. Custom schemes stay untouched.
db: PostgreSQL.

includeAll doesn't work with relativeToChangelogFile="true"

Including files works properly with following ways:

<includeAll path="src/main/resources/db/changelog/SQL/Evolutions/" relativeToChangelogFile="false"/>

<include file="SQL/Evolutions/2.sql" relativeToChangelogFile="true"/>

<include file="src/main/resources/db/changelog/SQL/Evolutions/1.sql" relativeToChangelogFile="false"/>

But doesn't work by:
<includeAll path="SQL/Evolutions/" relativeToChangelogFile="true" />

Giving incoming message:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':update'.

liquibase.exception.LiquibaseException: Unexpected error running Liquibase: Cannot find base path '/home/LiquibaseBugTestCase/src/main/resources/db/changelog/db.changelog.xml'

Steps to reproduce:

  1. Configure test database (Database name: 'userdb', username 'userdb', password 'userdb')
  2. Unzip file LiquibaseBugTestCase.zip
  3. Invoke gradle update

Some special properties

In jhipster we will have the following activities:

project.ext.diffChangelogFile = 'src/main/resources/config/liquibase/changelog/' + new Date().format('yyyyMMddHHmmss') + '_changelog.xml'

liquibase {
    activities {
        main {
            driver 'org.postgresql.Driver'
            url 'jdbc:postgresql://localhost:5432/liquibasepostgres'
            username 'liquibasepostgres'
            password ''
            changeLogFile 'src/main/resources/config/liquibase/master.xml'
            defaultSchemaName ''
            logLevel 'debug'
            classpath 'src/main/resources/'
        }
        diffLog {
            driver 'org.postgresql.Driver'
            url 'jdbc:postgresql://localhost:5432/liquibasepostgres'
            username 'liquibasepostgres'
            password ''
            changeLogFile project.ext.diffChangelogFile
            referenceUrl 'hibernate:spring:com.mycompany.myapp.domain?dialect=org.hibernate.dialect.PostgreSQL82Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'
            defaultSchemaName ''
            logLevel 'debug'
            classpath 'src/main/resources/'
            excludeObjects 'oauth_access_token, oauth_approvals, oauth_client_details, oauth_client_token, oauth_code, oauth_refresh_token'
        }
    }

    runList = project.ext.runList
}

It would be cool have e.g. a special property diffChangelogFile (like in the maven plugin) such that there could be one activity. Furthermore adding the excludeObjects property to an activity and executing e.g. liquibaseValidate the execution will fail as excludeObjects is not allowed for non diff commands. I don't know how the maven plugin is doing it, but I guess they are looking the command to execute it and only forward the arguments that are supported by the command to the cli. I could try a PR if you also think thats a valid feature request.

problem adding OutputEnablingLiquibaseRunner in liquibase block

Hi,
I'm trying to see some log/console during liquibase execution but I get this error adding mainClassName 'org.liquibase.gradle.OutputEnablingLiquibaseRunner':

Task :update FAILED
liquibase-plugin: Running the 'myAct1' activity...
Error: Could not find or load main class org.liquibase.gradle.OutputEnablingLiquibaseRunner

liquibase plugin 2.0.1
liquibase core 3.6.2
java 8

build.gradle

buildscript {
	repositories {...}
	dependencies {
		...
		classpath "org.liquibase:liquibase-gradle-plugin:2.0.1"
	}
}
dependencies {
	liquibaseRuntime "org.postgresql:postgresql:${POSTGRESQL_VERS}"
	liquibaseRuntime "org.liquibase:liquibase-core:3.6.2"
	liquibaseRuntime "org.yaml:snakeyaml:1.23"
}
liquibase {
	activities {
		myAct1 {
			...
		}
	}
	runList = liquibase_runList
	mainClassName 'org.liquibase.gradle.OutputEnablingLiquibaseRunner'
}

Am I doing something wrong?

Unknown parameter: 'referenceDefaultSchemaName'

When trying to specify schema for a ./gradlew diff:

liquibase {
    activities {
        main {
            changeLogFile "src/sql/changelog.groovy"

            url 'foo'
            username 'u'
            password 'p'

            referenceUrl 'bar'
            referenceUsername 'ru'
            referencePassword 'rp'
            referenceDefaultSchemaName 'schema'
        }
    }
}

It fails with:

...

13:51:15.211 [DEBUG] [org.gradle.api.Project] liquibase-plugin: Running 'liquibase --logLevel=info --changeLogFile=src/sql/changelog.groovy --url=foo --username=u --password=p --referenceUrl=bar --referenceUsername=ru --referencePassword=rp --referenceDefaultSchemaName=schema diff'
13:51:15.211 [ERROR] [system.err] Errors:
13:51:15.211 [ERROR] [system.err]   Unknown parameter: 'referenceDefaultSchemaName'
13:51:15.212 [ERROR] [system.err] 
13:51:15.212 [ERROR] [system.err] Usage: java -jar liquibase.jar [options] [command]

...

13:51:15.234 [ERROR] [system.err] Optional Diff Parameters:
13:51:15.234 [ERROR] [system.err]  --defaultCatalogName=<name>                Default database catalog to use
13:51:15.235 [ERROR] [system.err]  --defaultSchemaName=<name>                 Default database schema to use
13:51:15.235 [ERROR] [system.err]  --referenceDefaultCatalogName=<name>       Reference database catalog to use
13:51:15.235 [ERROR] [system.err]  --referenceDefaultSchemaName=<name>        Reference database schema to use
13:51:15.235 [ERROR] [system.err]  --schemas=<name1,name2> 

Note that this does work if using org.liquibase:liquibase-core:3.4.1.

gradle clean task error - Unable to delete file IOException in Windows 7 + Java 1.8

Facing issue with liquibase plugin enabled in a multi project gradle clean task - which disappears when I dont use this 1.2.1 or 1.2.0 of the plugin

Find below the stacktrace for the error:

``
C:\ccviews\repos\api_starter_parent (master)
λ gradle clean build --stacktrace

Environment is set to 'local' <<
env: local
:clean
:features:clean
:modules:clean
:features:feature-caching:clean
:features:feature-database:clean FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':features:feature-database:clean'.

    Unable to delete file: C:\ccviews\repos\api_starter_parent\features\feature-database\build\libs\feature-database-0.0.1-SNAPSHOT.jar

  • Try:
    Run with --info or --debug option to get more log output.

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':features:feature-database:clean'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:74)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:55)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:82)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:59)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:49)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.HintGCAfterBuild.execute(HintGCAfterBuild.java:44)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:240)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    Caused by: org.gradle.api.file.UnableToDeleteFileException: Unable to delete file: C:\ccviews\repos\api_starter_parent\features\feature-database\build\libs\feature-database-0.0.1-SNAPSHOT.jar
    at org.gradle.api.internal.file.delete.Deleter.handleFailedDelete(Deleter.java:109)
    at org.gradle.api.internal.file.delete.Deleter.doDeleteInternal(Deleter.java:86)
    at org.gradle.api.internal.file.delete.Deleter.doDeleteInternal(Deleter.java:81)
    at org.gradle.api.internal.file.delete.Deleter.doDeleteInternal(Deleter.java:81)
    at org.gradle.api.internal.file.delete.Deleter.delete(Deleter.java:66)
    at org.gradle.api.tasks.Delete.clean(Delete.java:67)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:133)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:126)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:115)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:623)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:606)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 68 more

BUILD FAILED

Total time: 5.794 secs
``

Adding files to the plugin classpath

It will be more convenient if it will be possible to modify classpath directly from the plugin configuration instead of Gradle buildscript configuration.

The Liquibase plugin requires at least DB connector jar to be added to the classpath and often other jars/files as well and putting them into the general configuration makes configuration less tidy.

rollbackCount do not Working. do not drop table.

liquibase-core: 3.5.5
liquibase-groovy-dsl:2.0.1
liquibase-gradle-plugin:2.0.1
mysql-connector-java:5.1.34
java: 8
gradle: 4.8.1

liquibase config

liquibase {
    activities {
        main {
            driver 'com.mysql.jdbc.Driver'
            changeLogFile 'src/main/resources/liquibase/master.groovy'
            url 'jdbc:mysql://localhost:3306/baike?useUnicode=true&amp;characterEncoding=utf-8'
            username 'root'
            password '123456'
        }
    }
}

master.groovy

databaseChangeLog {
    clobType = 0
    changeSet(id: 1, author: 'baike') {
        createTable(tableName: 'test', remarks: 'test') {
            column(name: 'id', type: 'bigint', autoIncrement: true) {
                constraints(nullable: false, primaryKey: true)
            }
            column(name: 'name', type: 'varchar(255)') {
                constraints(nullable: true)
            }
        }
        rollback "DROP TABLE test"
    }
    changeSet(id: 2, author: 'baike') {
        createTable(tableName: 'test2', remarks: 'test2') {
            column(name: 'id', type: 'bigint', autoIncrement: true) {
                constraints(nullable: false, primaryKey: true)
            }
            column(name: 'name', type: 'varchar(255)') {
                constraints(nullable: true)
            }
        }
        rollback "DROP TABLE test2"
    }

}

Execution script

gradlew rollbackCount -PrunList=main -PliquibaseCommandValue=1 --info

output

Initialized native services in: C:\Users\Charles\.gradle\native
Found daemon DaemonInfo{pid=17596, address=[ea7d9fe2-c208-46b5-a271-12cd7d7fa803 port:56478, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1537350690284, context=DefaultDaemonContext[uid=1
d8e5897-e2dd-4e54-af24-444cfc63bca8,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=17596,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfM
emoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=56475,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desi
red criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Users\Charles\scoop\apps\oraclejdk11\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=11724,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMem
oryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
Actual: DefaultDaemonContext[uid=1d8e5897-e2dd-4e54-af24-444cfc63bca8,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=17596,idleTimeout=1080000
0,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=56475,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

  Looking for a different daemon...
Found daemon DaemonInfo{pid=16468, address=[96622893-dc1d-4351-8d08-ef1122f7a105 port:56722, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1537350770013, context=DefaultDaemonContext[uid=f
d88774e-c9a5-4880-8c87-381af4079cb6,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=16468,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfM
emoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=56717,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desi
red criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Users\Charles\scoop\apps\oraclejdk11\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=11724,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMem
oryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
Actual: DefaultDaemonContext[uid=fd88774e-c9a5-4880-8c87-381af4079cb6,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=16468,idleTimeout=1080000
0,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=56717,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

  Looking for a different daemon...
Found daemon DaemonInfo{pid=17704, address=[3aeae49a-56cd-4c83-9f1f-31b53c699f65 port:58082, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1537351192915, context=DefaultDaemonContext[uid=5
afa29bc-0451-449c-8be0-d94f16376487,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=17704,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfM
emoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=58078,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desi
red criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Users\Charles\scoop\apps\oraclejdk11\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=11724,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMem
oryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
Actual: DefaultDaemonContext[uid=5afa29bc-0451-449c-8be0-d94f16376487,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=17704,idleTimeout=1080000
0,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=58078,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

  Looking for a different daemon...
Found daemon DaemonInfo{pid=8728, address=[1a9daaaf-65c4-49d8-918c-7d5eadb76bd0 port:58470, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1537351283729, context=DefaultDaemonContext[uid=1c
abe6f0-b6f6-4fa4-95e2-ceb00f9cee34,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=8728,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMem
oryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=58467,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desire
d criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Users\Charles\scoop\apps\oraclejdk11\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=11724,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMem
oryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
Actual: DefaultDaemonContext[uid=1cabe6f0-b6f6-4fa4-95e2-ceb00f9cee34,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=8728,idleTimeout=10800000
,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=58467,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

  Looking for a different daemon...
Found daemon DaemonInfo{pid=19168, address=[92f1b9ce-d0c0-488b-89c8-20e129e84d7b port:49701, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1537354875532, context=DefaultDaemonContext[uid=e
6c59b1a-89b4-42d8-8344-d12e9a0b6b56,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=19168,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfM
emoryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Users\Charles\scoop\apps\oraclejdk11\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=11724,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMem
oryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
Actual: DefaultDaemonContext[uid=e6c59b1a-89b4-42d8-8344-d12e9a0b6b56,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=19168,idleTimeout=1080000
0,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

  Looking for a different daemon...
Found daemon DaemonInfo{pid=2520, address=[d57e2c6a-c1f1-413a-b7b1-f98b686f30d5 port:57273, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1537350921619, context=DefaultDaemonContext[uid=8b
49d75f-407a-4fa2-800b-6e0d4cc95e45,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=2520,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMem
oryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=57105,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desire
d criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Users\Charles\scoop\apps\oraclejdk11\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=11724,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMem
oryError,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
Actual: DefaultDaemonContext[uid=8b49d75f-407a-4fa2-800b-6e0d4cc95e45,javaHome=C:\Users\Charles\scoop\apps\oraclejdk8u\current,daemonRegistryDir=C:\Users\Charles\.gradle\daemon,pid=2520,idleTimeout=10800000
,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=57105,-Xmx1024m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.language=zh,-Duser.variant]

  Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 14472). The daemon log file: C:\Users\Charles\.gradle\daemon\4.8.1\daemon-14472.out.log
Starting 79th build in daemon [uptime: 4 hrs 6 mins 23.075 secs, performance: 100%, no major garbage collections]
Using 4 worker leases.
Starting Build
Settings evaluated using settings file 'E:\JavaWk\baike\settings.gradle'.
Projects loaded. Root project using build file 'E:\JavaWk\baike\build.gradle'.
Included projects: [root project 'baike']

> Configure project :
Evaluating root project 'baike' using build file 'E:\JavaWk\baike\build.gradle'.
Applying dependency management to configuration 'annotationProcessor' in project 'baike'
Applying dependency management to configuration 'apiElements' in project 'baike'
Applying dependency management to configuration 'archives' in project 'baike'
Applying dependency management to configuration 'bootArchives' in project 'baike'
Applying dependency management to configuration 'compile' in project 'baike'
Applying dependency management to configuration 'compileClasspath' in project 'baike'
Applying dependency management to configuration 'compileOnly' in project 'baike'
Applying dependency management to configuration 'default' in project 'baike'
Applying dependency management to configuration 'implementation' in project 'baike'
Applying dependency management to configuration 'runtime' in project 'baike'
Applying dependency management to configuration 'runtimeClasspath' in project 'baike'
Applying dependency management to configuration 'runtimeElements' in project 'baike'
Applying dependency management to configuration 'runtimeOnly' in project 'baike'
Applying dependency management to configuration 'testAnnotationProcessor' in project 'baike'
Applying dependency management to configuration 'testCompile' in project 'baike'
Applying dependency management to configuration 'testCompileClasspath' in project 'baike'
Applying dependency management to configuration 'testCompileOnly' in project 'baike'
Applying dependency management to configuration 'testImplementation' in project 'baike'
Applying dependency management to configuration 'testRuntime' in project 'baike'
Applying dependency management to configuration 'testRuntimeClasspath' in project 'baike'
Applying dependency management to configuration 'testRuntimeOnly' in project 'baike'
Applying dependency management to configuration 'providedCompile' in project 'baike'
Applying dependency management to configuration 'providedRuntime' in project 'baike'
Applying dependency management to configuration 'liquibaseRuntime' in project 'baike'
All projects evaluated.
Selected primary task 'rollbackCount' from project :
Tasks to be executed: [task ':rollbackCount']
:rollbackCount (Thread[Daemon worker Thread 23,5,main]) started.

> Task :rollbackCount
Task ':rollbackCount' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Resolving global dependency management for project 'baike'
Excluding []
liquibase-plugin: Running the 'main' activity...
Starting process 'command 'C:\Users\Charles\scoop\apps\oraclejdk11\current\bin\java.exe''. Working directory: E:\JavaWk\baike Command: C:\Users\Charles\scoop\apps\oraclejdk11\current\bin\java.exe -Dfile.enc
oding=GBK -Duser.country=CN -Duser.language=zh -Duser.variant -cp C:\Users\Charles\.gradle\caches\modules-2\files-2.1\org.liquibase\liquibase-core\3.5.5\c65051f327382018bd09c30380f25eac96f210da\liquibase-co
re-3.5.5.jar;C:\Users\Charles\.gradle\caches\modules-2\files-2.1\org.liquibase\liquibase-groovy-dsl\2.0.1\8726704b9b689d014074a9c12498dc391a8b3460\liquibase-groovy-dsl-2.0.1.jar;C:\Users\Charles\.gradle\cac
hes\modules-2\files-2.1\mysql\mysql-connector-java\5.1.34\46deba4adbdb4967367b013cbc67b7f7373da60a\mysql-connector-java-5.1.34.jar;C:\Users\Charles\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.19
\2d998d3d674b172a588e54ab619854d073f555b5\snakeyaml-1.19.jar;C:\Users\Charles\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-sql\2.4.15\591ed2582868cb47fcac04eb50923faf52bfd231\groovy-sql-2.4
.15.jar;C:\Users\Charles\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy\2.4.15\74b7e0b99526c569e3a59cb84dbcc6204d601ee6\groovy-2.4.15.jar liquibase.integration.commandline.Main --logLevel=inf
o --driver=com.mysql.jdbc.Driver --changeLogFile=src/main/resources/liquibase/master.groovy --url=jdbc:mysql://localhost:3306/baike?useUnicode=true&amp;characterEncoding=utf-8 --username=root --password=123
456 rollbackCount 1
Successfully started process 'command 'C:\Users\Charles\scoop\apps\oraclejdk11\current\bin\java.exe''
INFO 2018/9/19 下午7:22: liquibase: Successfully acquired change log lock
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/C:/Users/Charles/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.4.15/74b7e0b99526c569e3a59cb84dbcc620
4d601ee6/groovy-2.4.15.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO 2018/9/19 下午7:23: liquibase: Reading from baike.DATABASECHANGELOG
INFO 2018/9/19 下午7:23: liquibase: Successfully released change log lock
Liquibase Rollback Successful
:rollbackCount (Thread[Daemon worker Thread 23,5,main]) completed. Took 2.619 secs.

But table test2 not droped.

ClassCastException with Logger

Hi,
I experience this on java 10, linux, liqubase 3.6.1, liquibase-plugin 1.2.4.
Do you have any plans on fixing this? I think the approach there is fine.

Add warning message when plugin isn't configured.

When one applies liquibase plugin, not configures it, and runs "update" task - the console output displays a message "BUILD SUCCESSFUL".
It could be great if plugin displayed a warning that "plugin has not been configured" instead.

DataSource support

Is it possible to use a jndi dataSource instead of Username and Password?

How to specify --difftypes

I want to get started on an existing DB, which has been built from existing sql scripts to contain only the initial data. I ran generateChangelog and got an acceptable xml change log for the DDL including pirmary keys and foreign keys etc. However, none of the data was included. http://forum.liquibase.org/topic/difftypes-questions and other stuff out there seems to suggest I need to add "data" to the --difftypes option... but I can't find any documentation of how to specify this either here, or in the example workshop.

Unable to perform diff with Spring Boot

build.gradle:

id 'org.liquibase.gradle' version '2.0.0'
liquibaseRuntime('org.liquibase:liquibase-core:3.6.2')
liquibaseRuntime('org.liquibase.ext:liquibase-hibernate5:3.6')
liquibaseRuntime('mysql:mysql-connector-java:5.1.46')
liquibaseRuntime("org.springframework.boot:spring-boot:2.0.1.RELEASE")
liquibaseRuntime('org.springframework:spring-orm:5.0.5.RELEASE')
liquibaseRuntime('javax.validation:validation-api:2.0.1.Final')
liquibase {
    activities {
        main {
            driver 'com.mysql.jdbc.Driver'
            url 'jdbc:mysql://my.company:3306/my_database'
            username 'myUsername'
            password 'myPassword'
            changeLogFile 'src/main/resources/db/changelog/changelog-master.xml'
            referenceUrl 'hibernate:spring:my.company' +
                    '?dialect=org.hibernate.dialect.MySQL5Dialect' +
                    '&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy' +
                    '&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'
        }
    }
}
18:08:12: Executing task 'diff'...


> Task :diff FAILED
liquibase-plugin: Running the 'main' activity...
Starte Liquibase am Mi, 18 Jul 2018 18:08:13 MESZ (Version 3.6.2, kompiliert am 2018-07-03 11:28:09)
Unerwarteter Fehler bei der Ausführung von Liquibase: Unable to resolve persistence unit root URL
liquibase.exception.DatabaseException: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
	at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:132)
	at liquibase.integration.commandline.Main.createReferenceDatabaseFromCommandParams(Main.java:1408)
	at liquibase.integration.commandline.Main.doMigration(Main.java:1005)
	at liquibase.integration.commandline.Main.run(Main.java:191)
	at liquibase.integration.commandline.Main.main(Main.java:129)
Caused by: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
	at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:637)
	at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.preparePersistenceUnitInfos(DefaultPersistenceUnitManager.java:459)
	at liquibase.ext.hibernate.database.HibernateSpringPackageDatabase.createEntityManagerFactory(HibernateSpringPackageDatabase.java:79)
	at liquibase.ext.hibernate.database.HibernateEjb3Database.buildMetadataFromPath(HibernateEjb3Database.java:51)
	at liquibase.ext.hibernate.database.HibernateDatabase.buildMetadata(HibernateDatabase.java:136)
	at liquibase.ext.hibernate.database.HibernateDatabase.setConnection(HibernateDatabase.java:75)
	at liquibase.database.DatabaseFactory.findCorrectDatabaseImplementation(DatabaseFactory.java:129)
	at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:149)
	at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:97)
	... 4 common frames omitted
Caused by: java.io.FileNotFoundException: class path resource [] cannot be resolved to URL because it does not exist
	at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
	at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.determineDefaultPersistenceUnitRootUrl(DefaultPersistenceUnitManager.java:633)
	... 12 common frames omitted


Bitte verwenden Sie die '--logLevel'-Option, um mehr Informationen zu erhalten.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':diff'.
> Process 'command '/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.172-9.b11.fc28.x86_64/bin/java'' finished with non-zero exit value 255

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
1 actionable task: 1 executed
Process 'command '/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.172-9.b11.fc28.x86_64/bin/java'' finished with non-zero exit value 255
18:08:13: Task execution finished 'diff'.

This seems to be related to liquibase/liquibase-hibernate#170

I cant find a solution for this problem. Does anybody have a working example with a Spring Boot application?

Add possibility to use extensions such as liquibase-hibernate5

It would be great if we could use extension as liquibase-hibernate5 like done for the liquibase-maven-plugin.

We can configure the maven plugin with dependencies like this :

<plugins>
    <plugin>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-maven-plugin</artifactId>
        <version>3.4.1</version>
        <configuration>                  
            <propertyFile>src/main/resources/liquibase.properties</propertyFile>
        </configuration> 
        <dependencies>
            <dependency>
                <groupId>org.liquibase.ext</groupId>
                <artifactId>liquibase-hibernate4</artifactId>
                <version>3.5</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>4.1.7.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-jpa</artifactId>
                <version>1.7.3.RELEASE</version>
            </dependency>
        </dependencies>               
    </plugin> 
</plugins>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.