How do I get Liquibase to print out the SQL it generated?

Hi,

I’m using Gradle 2.7, the Liquibase 1.1.1 plugin and attempting to run my changeset on an Apache Derby (v. 10.12.1.1) in-memory database. Running the following changeSet fails immediately on the first changeSet …

[code]

[/code]

How can I configure Liquibase to output the SQL generated? Here is how I have set up the plugin …

[code]

liquibase {

activities {

main {

File propsFile = new File("${project.rootDir}/src/main/environment/${environment}/liquibase.properties")

Properties properties = new Properties()

properties.load(new FileInputStream(propsFile))

changeLogFile 'src/main/resources/db.changelog-master.xml'

url properties['url']

username properties['username']

password properties['password']

}

test {

File propsFile = new File(liquibasePropertiesFile)

Properties properties = new Properties()

properties.load(new FileInputStream(propsFile))

changeLogFile 'src/main/resources/db.changelog-master.xml'

url 'jdbc:derby:memory:test-jpa;create=true'

username 'sa'

}

runList = 'main,test'

}

}

[/code]

For what its worth, this is all Liquibase tells me when the above is run …

[code]

SEVERE 10/27/15 4:02 PM: liquibase: src/main/resources/db.changelog-master.xml: src/main/resources/db.changelog-1.0.xml::add_my_project_address::my: Change Set src/main/resources/db.changelog-1.0.xml::add_my_project_address::my failed. Error: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "," at line 1, column 224.

liquibase.exception.DatabaseException: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "," at line 1, column 224.

at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)

at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)

at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)

at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1227)

at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1210)

at liquibase.changelog.ChangeSet.execute(ChangeSet.java:550)

at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43)

at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)

at liquibase.Liquibase.update(Liquibase.java:200)

at liquibase.integration.commandline.Main.doMigration(Main.java:1044)

at liquibase.integration.commandline.Main.run(Main.java:175)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)

at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:43)

at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:88)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)

at org.liquibase.gradle.LiquibaseTask.runLiquibase(LiquibaseTask.groovy:97)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

[/code]

I don’t use gradle, but it appears from the documentation
that you would do something like this on the command line:



gradle updateSql
Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/