Closed ChristianHuff-DEV closed 7 months ago
Is the issue with the generateSQL
task?
If so, then this isn't a gradle plugin issue because your task doesn't use the plugin - it calls Liquibase directly.
You said that there was no file, but that when you left out the output file, it gave you SQL on the console. That makes me wonder if the SQL script is being generated, just in a different location. I don't know why it works differently calling liquibase from the CLI vs a JavaExec. The only things I can think of is argument order or classpath differences.
Yes, the issue is the generateSQL
task.
I searched the whole hard drive but couldn't find the generated file anywhere.
Since it works when I'm using the CLI I assumed it should also work when calling it directly. Furthermore when I change the parameter name to something other than --outputFile
(i.e. --output-file
), an error occurs. So it appears to be parsed successfully but then discarded.
SEVERE: Unexpected error running Liquibase: Unknown option: 'output-file'
liquibase.exception.CommandLineParsingException: Unknown option: 'output-file'
at liquibase.integration.commandline.Main.parseOptionArgument(Main.java:1268)
at liquibase.integration.commandline.Main.parseOptions(Main.java:1180)
at liquibase.integration.commandline.Main$1.run(Main.java:284)
at liquibase.integration.commandline.Main$1.run(Main.java:230)
at liquibase.Scope.child(Scope.java:193)
at liquibase.Scope.child(Scope.java:169)
at liquibase.integration.commandline.Main.run(Main.java:230)
at liquibase.integration.commandline.Main.main(Main.java:166)
I switched to using the Docker image.
I'm trying to write a Gradle task that takes in a changeLogFile and creates a Microsoft SQL compatible script.
The problem is that the parameter
--outputFile
is seemingly being ignored. The task itself finishes successful but no file is created. If I run the task without the parameter the SQL is printed to the console.It appears this has been already a problem in the past. (See https://github.com/liquibase/liquibase-gradle-plugin/issues/90.)
Here is the (reduced)
build.gradle
I'm using. (I created an example Project to reproduce the issue.) The project is using Liquibase4.24.0
(Spring Boot3.2.2
).This is a simplified example. In the real application I have a folder that contains multiple change log files (one for each version of the application). A Gradle task iterates over the change log files and generates the SQL script. This way I have one SQL script for each version.
Using the Liquibase CLI directly (https://hub.docker.com/r/liquibase/liquibase) the parameter is taken into account and the file created.