Until this time I started the Variations project only from Eclipse. Some days ago I downloaded the whole code and compiled it in the command line and wanted to start the packaged jar file — however I couldn’t. The cause was a NoClassDefFoundError.
The integration with Spring is not a big thing. You only have to configure your data source, the Liquibase bean and that’s it. OK, this sounds simple but there are really some pitfalls if you’ve never done this.
I will tell you about a not very common Liquibase pitfall what happened to me lately.
Liquibase has a property for its changesets: failOnError. You can set it to false, if you expect that your changeset can eventually fail. How it comes?
After a brief introduction into Liquibase I continue the topic with using this framework.
There are many options to use Liquibase, I’ll show you some (command line, maven and Java execution) but feel free to look at the website of the tool to get a more detailed documentation of the usages.
As told before, we’ll take a closer look at Liquibase, and create the database with this tool. The documentation at the website is very good, they have a lot of tutorials for all needs, so I’ll give you only a short introduction how to convert the showed SQL script to Liquibase, how to run the change sets (from command line and Maven), and give some personal opinions. Later with the examples I’ll include the liquibase execution into the application, so it updates the database automatically at startup. Continue reading