Git Product home page Git Product logo

gradle-liquibase-plugin's Introduction

News

###May 25, 2015 We're pleased to announce that the Liquibase Gradle Plugin is now a part of the Liquibase organization. I'll still maintain the code, it will just live in a different Git repository. Bringing this project into the larger Liquibase family will help keep all things Liquibase together in one place and make the project easier to find for all Liquibase users. The new home for the Liquibase Gradle Plugin is https://github.com/liquibase/liquibase-gradle-plugin

As part of this move, the Liquibase Gradle Plugin is now available through the official Gradle Plugin Portal.

I'll update existing issues in this repository as they get addressed, but new issues should be reported in the new repository.

Thank you all for your continued support,

Steve Saliman

gradle-liquibase-plugin's People

Contributors

haraldradi avatar stevesaliman avatar tlberglund 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

Watchers

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

gradle-liquibase-plugin's Issues

customize databaseChangeLogTableName

Dear All,

i would like to customize the following params ;

-Dliquibase.databaseChangeLogTableName=VE_DATABASECHANGELOG ^
-Dliquibase.databaseChangeLogLockTableName=VE_DATABASECHANGELOGLOCK

how to that with this plugin ?

Best regards,
Yuri

No way to specify connection between database and changelog

We use several different databases in each environment of our system. On a typical deploy, we thus want to run a specific changelog for each database. I can see no way to achieve this, as every specified changelog is applied to each database.

In other words, I want to say "run this particular changelog on this particular database."

How disable validation of changelog XML file

Hello!
I have such issue. I need to disable changelog xml file validation. For it I set following parameter for command 'update':
gradle update -PvalidateXmlChangelogFiles=false

But in logs we seeing that validation has not been disabled.

Unexpected error running Liquibase: schema_reference.4: Failed to read schema document 'http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema.
liquibase.exception.ChangeLogParseException: Error parsing line 5 column 138 of src/main/resources/db/db.changelog-master.xml: schema_reference.4: Failed to read schema document 'http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not xsd:schema.
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:120)
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:15)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.commandline.Main.doMigration(Main.java:1205)
at liquibase.integration.commandline.Main.run(Main.java:191)
at liquibase.integration.commandline.Main.main(Main.java:129)
at liquibase.integration.commandline.Main$main.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
at org.liquibase.gradle.OutputEnablingLiquibaseRunner.main(OutputEnablingLiquibaseRunner.groovy:48)

Usage documentation would be helpful

I'm interested in using this plugin but I'm not clear from the README.md how I should be using it? Specifically it would be useful if you could cover things like where I can obtain the plugin from e.g. maven central?

Would it be possible to update the README.md to include a full example of a build.gradle? I think that would be really useful for me and for others.

Also, the README.md refers to a 0.7 release of the plugin but the most recent version I can find in Maven Central is 0.6.1 (and 0.7.6 of the liquibase-dsl). Has 0.7 been released yet?

Many thanks,

Edd

Compatibility between gradle-liquibase-plugin and liquibase 3.0.X

I use liquibase and gradle and found therefore this plugin. I encountered the problem bellow when executing "gradle update". In liquibase 2.0.5 the method CommandLineUtils.createDatabaseObject expected 8 arguments from the version 3.0.X on an additional argument "defaultCatalogName" has been added.

Is therefore this plugin not compatibel with liquibase 3.0.X?

--- Stacktrace ---
Liquibase Update Failed: liquibase.integration.commandline.CommandLineUtils.crea
teDatabaseObject(Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/String;Ljav
a/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/S
tring;)Lliquibase/database/Database;
SEVERE 31.07.13 23:49:liquibase: liquibase.integration.commandline.CommandLineUt
ils.createDatabaseObject(Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Str
ing;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljav
a/lang/String;)Lliquibase/database/Database;
java.lang.NoSuchMethodError: liquibase.integration.commandline.CommandLineUtils.
createDatabaseObject(Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/String;
Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/la
ng/String;)Lliquibase/database/Database;
at com.augusttechgroup.gradle.liquibase.Main.doMigration(Main.java:614)
at com.augusttechgroup.gradle.liquibase.Main.main(Main.java:119)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)

deprecated dynamic property warning

When using gradle-liquibase-plugin 0.6.1 with Gradle 1.2, we receive the following warning:

Dynamic properties are deprecated: http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html
Deprecated dynamic property: "args" on "task ':updateCount'", value: "[null]".

As you know, the deprecation warning mechanism itself was introduced by Gradle prior to its 1.0 release. And the warning in this project signifies a possible bug. The warning/bug was fixed by commit
03072b7 of this project, but has not yet been released.

Latest plugin change 1.0.1 Cannot find parser that supports groovy

I've been using the 1.0.0 (Liquibase 3.1.x) version happily with a full configuration structure for multiple schemas and a mix of .groovy and .xml changelogs and custom extensions.

Simply changing the plugin to 1.0.1 to pick up the latest Liquibase versions throws this error on update:
Error:
Unexpected error running Liquibase: Cannot find parser that supports /home/vagrant/workspace/project/Liquibase/install/core/core-changelog.groovy

As part of the upgrade is there anything else I would need to change for it to just work as it has been?

Thanks
Warren

CommandLineParsingException occurs in 1.0.0-SNAPSHOT rev 4f4a824

Hi,

I'm testing the 1.0.0-SNAPSHOT
(rev 4f4a824)
and get a CommandLineParsingException when I run "gradle status"

Any ideas?

$ gradle status --stacktrace
:status
liquibase-plugin: Running the 'main' activity...
:status FAILED

FAILURE: Build failed with an exception.

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

    liquibase/exception/CommandLineParsingException

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

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':status'.
    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:289)
    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:86)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:46)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at org.gradle.launcher.Main.main(Main.java:37)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    Caused by: java.lang.NoClassDefFoundError: liquibase/exception/CommandLineParsingException
    at com.augusttechgroup.gradle.liquibase.LiquibaseTask.class$(LiquibaseTask.groovy)
    at com.augusttechgroup.gradle.liquibase.LiquibaseTask.$get$$class$com$augusttechgroup$gradle$liquibase$Main(LiquibaseTask.groovy)
    at com.augusttechgroup.gradle.liquibase.LiquibaseTask.runLiquibase(LiquibaseTask.groovy:96)
    at com.augusttechgroup.gradle.liquibase.LiquibaseTask$_liquibaseAction_closure2.doCall(LiquibaseTask.groovy:57)
    at com.augusttechgroup.gradle.liquibase.LiquibaseTask.liquibaseAction(LiquibaseTask.groovy:56)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 43 more
    Caused by: java.lang.ClassNotFoundException: liquibase.exception.CommandLineParsingException
    ... 56 more

Here's how I'm using the plugin in my gradle script:

apply plugin: 'groovy'
apply plugin: 'liquibase'

buildscript {
repositories {
mavenCentral()
flatDir {
dir 'lib'
}
}
dependencies {
classpath 'com.augusttechgroup:gradle-liquibase-plugin:1.0.0-SNAPSHOT'
classpath 'mysql:mysql-connector-java:5.1.21'
}
}

liquibase {
activities {
main {
changeLogFile 'changelogs.groovy'
url jdbcUrl
username jdbcUser
password jdbcPassword
}
}
}

Plugin reports success even if changesets fail

When a changeset fails for whatever reason, a stack trace is printed on the console, but Gradle reports a successful build. Aside from being an incorrect status, this can cause issues. For example, suppose you have a CI server set to build and test your project. If the "gradle update" fails, ther's no sense trying to run the project's tests, but that is currently what would happen because the Liquibase plugin didn't report a failure.

I think the heart of the matter is in Main.java around lines 136 and again about 20 lines later. In both cases, we're in a catch block where the exception is logged, then eaten. I think the exception should be thrown so that Gradle registers this as a failure. If we throw the exception out to Gradle, we might not need to log the exception, which would clean up the code even further. Even cleaner still, we could skip the whole try/catch thing altogether since we need to throw exceptions to get Gradle to report failure anyway.

What do you think?

Steve

PS: I would have taken a stab at fixing the issue and issuing a pull request, but version 0.7-SNAPSHOT always fails, reporting "could not find method changelogs() for arguments..." when I try to run it, and that error was beyond my limited Gradle expertise to fix.

namepace the liquibase tasks

I feel like some of the liquibase tasks have common task names (update for example) and it would be useful to have them namespaced.

gradle update

to

gradle db-update

parameters of commands must be added at the end of args

using version 0.7

>gradle -Dliquibase.count='1' rollback

doesn't work.

As I can see in LiquibasePlugin.groovy the value of "liquibase.count" is added as an option.

...
      if(System.properties['liquibase.count']) {
        command = 'rollbackCount'
        options = [ System.properties['liquibase.count'] ]
      }
...

but it has to be a parameter after the command. Documentation of command line says:

...
Usage: java -jar liquibase.jar [options] [command]
...
rollback <tag> ...

A possible implementation will be:

...
      if(System.properties['liquibase.count']) {
        command = 'rollbackCount'
        parameter = [ System.properties['liquibase.count'] ]
      }
...

and then in LiquibaseBaseTask.groovy something like this:

...
      if (options) {
        args += options
      }

      if(command) {
        args += command
      }

      if(parameter) {
        args += parameter
      }

      Main.main(args as String[])
...

Inserting change set filename into database change log results in build failure for long file paths

We're getting the following error:
Liquibase Update Failed: ORA-12899: value too large for column "SCHEMA"."DATABASECHANGELOG"."FILENAME" (actual: 203, maximum: 200)

Would it be possible to truncate the filename and have this be a warning instead of a build failure?

Or, since we're providing the files in the change log as relative, only have the relative path instead of the full path? That's what's really causing this failure.

authentication failed for user "net.saliman.gradle.liquibase.Activity@5d046243"

I have the following block:
activities {
main {
changeLogFile 'fileXML.xml'
url dbUrl
username dbUserName
password dbPassword
}
another {
changeLogFile 'anotherFile.xml'
url dbUrl
username dbUsername
password dbPassword
}
runList = "main,another"
}

dbUrl, dbUserName and dbPassword are defined in the gradle.properties file. When I run gradlew update it runs the first activity just fine, but for the second one I get:

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

    liquibase.exception.LiquibaseException: Liquibase Update Failed: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "net.saliman.gradle.liquibase.Activity@5d046243"

Any clues?

generateChangelog is destructive by default

The default behavior of the generateChangelog task is to append to changelog files if they currently exist.

I feel like this is a contradiction of http://www.liquibase.org/manual/command_line and https://github.com/tlberglund/groovy-liquibase/blob/master/howto.md which both state that generateChangelog should write to stdout.

It gets more interesting when there are multiple changelogs defined in the build.gradle file. GenerateChangelog writes to all the files mentioned in the changelogs section with identical data.

Thanks,

Steve

Add diffChangeLog Gradle task

Hi,

Thanks for the plugin, it is awesome!

I wanted to set up an automated schema updating mechanism with the help of 'diffChangeLog' and 'update'.

Is there any chance that the missing 'diffChangeLog' task will make it to the plugin?

Kind regards,
Peter

conversion to Gradle plugin extension is not released

Commit 03072b7 made the conversion from convention to extension. This is great since it means the configuration for this plugin is scoped inside a liquibase block. However this plugin has not been released since that commit.

Please let us know if there is anything we can do to help resolve any blocking issues. @dstine @mbruner

Pass value to liquidbase command

How to pass a command value like to the rollbackCount?

I have execute a gradle command line like so but it didn't work.
gradle -b database.gradle rollbackCount -PlilquibaseCommandValue=1
:rollbackCount FAILED

FAILURE: Build failed with an exception.

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

    The Liquibase 'rollbackCount' command requires a value

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

BUILD FAILED

Total time: 3.877 secs

You have any idea why?

thanks

merge with liquibase fork

Hello,

can you image that official fork will be merged to your repository and you'll move it under liquibase org?

This fork makes things more complicated and It would be nice to make it "official".

What do you think?

Parameters issue

Seems like loading '-Dxxx' parameters is not working. It throws: Unexpected value null: parameters must start with a '--'

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.