Disable Liquibase execution at startup using Jetty + Spring (not Spring boot!)

1.1k Views Asked by At

I'm working in an application developed with Spring5 (not Spring boot!) that runs on Jetty. This application has module that uses the plugin liquibase-maven-plugin.

We generate a image from a dockerfile (base image jetty:9-jre8), where we add the application (war file) in the jetty application directory.

In some specific environments, where I deploy the application, I want to be able to disable that execution.

Is it possible to do so? I've seen on spring boot documentation, that it's possible to do so by defining the property spring.liquibase.enabled (or liquibase.enabled on Spring4) to false, but that seems that doesn't work:

I've tried to define them at the properties file, define them as env properties and also as java options (-Dspring.liquibase.enabled=false).

This has the same behavior when I deploy the container, or when I execute locally the maven command: mvn jetty:run

Do you have any ideas or hints how to do this?

Thank you in advance

1

There are 1 best solutions below

0
On

Well I just discovered that it's possible to disable the execution of liquibase by adding the JAVA_OPTION
-Dliquibase.shouldRun=false

For more details see here

I will keep this quesion anyway, in case someone has the same problem I did.