Es sollte so etwas wie (von liquibase.integration.spring.SpringLiquibase Quelle entnommen) sein:
java.sql.Connection c = YOUR_CONNECTION;
Liquibase liquibase = null;
try {
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(c))
liquibase = new Liquibase(YOUR_CHANGELOG, new FileSystemResourceAccessor(), database);
liquibase.update();
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
if (c != null) {
try {
c.rollback();
c.close();
} catch (SQLException e) {
//nothing to do
}
}
}
Es gibt mehrere Implementierung von ResourceAccessor je nachdem, wie Sie Ihre Changelog-Dateien gefunden werden sollte.
Haben Sie http://forum.liquibase.org/topic/using-liquibase-directly-from-java angeschaut? – artbristol