Skip to content

This project demonstrates how to run Liquibase from a Java application using a PostgreSQL database. It supports Java 8 and above and can be executed either with Maven or as a standalone Java application.

Notifications You must be signed in to change notification settings

Rhytech/liquibase-from-java-main

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Liquibase from Java with PostgreSQL (Using XML-Based Change Logs)

This project demonstrates how to run Liquibase from a Java application using a PostgreSQL database. It supports Java 8 and above and can be executed either with Maven or as a standalone Java application.

πŸ”§ Features

  • Supports any Java version β‰₯ 8
  • PostgreSQL integration via JDBC
  • XML-based Liquibase changelogs
  • Configurable changelog and target schema
  • Maven and non-Maven execution options

πŸ—‚ Project Overview

  • Uses a PostgreSQL database connection.
  • Change log schema and target schema are configurable in the Main.java file.
  • Supports easy migration to MySQL or other databases by replacing the PostgreSQL JDBC dependency in pom.xml.
  • Java-based Liquibase runner with XML changelogs
  • Archiving table data through controlled change sets
  • Versioned database schema changes (tables, constraints, indexes)
  • Maintain and deploy stored procedures/functions as part of database migrations
  • Supports PostgreSQL (can be extended to MySQL or others)

βš™οΈ Configuration

  1. Database Settings:

    • Update the database connection properties in src/main/resources/db.properties.
  2. Liquibase Schema:

    • To store the DATABASECHANGELOG table in a schema other than public, update Main.java accordingly.
    • Ensure the schema exists in the database before running the application.
  3. Java Version (Maven Builds Only):

    • If using Maven, ensure the correct Java version is set under the Maven Compiler Plugin in pom.xml:
      <properties>
          <maven.compiler.source>1.8</maven.compiler.source>
          <maven.compiler.target>1.8</maven.compiler.target>
      </properties>
    • This step is not required when running the application directly via Main.java.

πŸš€ Running the Project

In the root directory of the project, execute the following command:

mvn clean compile exec:java

πŸ“„ License

Β© 2025 Rhythm Pangotra. All rights reserved.

This project is not open source. No part of this codebase may be copied, modified, distributed, or used without the express written permission of the author.

For licensing inquiries, contact: rhythmpangotra.be@gmail.com

About

This project demonstrates how to run Liquibase from a Java application using a PostgreSQL database. It supports Java 8 and above and can be executed either with Maven or as a standalone Java application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published