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 for posting this, Steve. I don't like the append behavior at all. Liquibase itself handles XML appending with a little bit of string manipulation (or something similar—I don't remember precisely) which is not available to me here. What would you say to having the plugin just fail if the changelog already exists? I think I prefer this behavior anyway. I've always thought of generateChangeLog as a bootstrapping command, such that appending isn't really meaningful. We have diff commands for that.
I agree. If you've got a project that already has a changelog, especially more than one, it means you've already plugged your project into the Liquibase universe. Appending to a changelog would be kind of meaningless at best, and at worst it would really confuse things with multiple changesets trying to do the same thing.
Failing if the changelog exists is a good way to tell the user "hey, this has already been done"
This is now fixed in 1.0.0