I have a Maven project with Liquibase that I want to run by executing the jar file. Currently, I can only make it work during the build phase using version 3.10.3 of the Liquibase Maven plugin. I tried using newer versions of the plugin, but I couldn’t make it work.
Here’s my current pom.xml file:
<project>
<!-- project details -->
<properties>
<liquibase.propertyFile>${project.basedir}/src/main/resources/liquibase.properties</liquibase.propertyFile>
</properties>
<dependencies>
<!-- dependencies -->
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<!-- assembly plugin details -->
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.10.3</version>
<configuration>
<propertyFile>${liquibase.propertyFile}</propertyFile>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.1.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
I have a Maven project with Liquibase that I want to run by executing the jar file. Currently, I can only make it work during the build phase using version 3.10.3 of the Liquibase Maven plugin. I tried using newer versions of the plugin, but I couldn’t make it work.
Here’s my current pom.xml file:
<project>
<!-- project details -->
<properties>
<liquibase.propertyFile>${project.basedir}/src/main/resources/liquibase.properties</liquibase.propertyFile>
</properties>
<dependencies>
<!-- dependencies -->
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<!-- assembly plugin details -->
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.10.3</version>
<configuration>
<propertyFile>${liquibase.propertyFile}</propertyFile>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.1.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
How can I make Liquibase work when I execute the jar file instead of during the build phase? And is there a way to make it work with newer versions of the Liquibase Maven plugin?
I believe it can be done using exec-maven-plugin, but so far I haven’t been able to do it.
Thank you in advance for your help!