在特定环境上执行Liquibase(maven+;spring引导)
我的应用程序(maven+spring启动)有一个liquibase,但我只需要在开发环境中执行。 在另一个环境(例如prod、CI)上,我需要阻止执行 我能做这个吗 tks.有两种选择:在特定环境上执行Liquibase(maven+;spring引导),maven,liquibase,Maven,Liquibase,我的应用程序(maven+spring启动)有一个liquibase,但我只需要在开发环境中执行。 在另一个环境(例如prod、CI)上,我需要阻止执行 我能做这个吗 tks.有两种选择: 对于prod环境,可以使用spring.liquibase.enabled=falseproperties。这将完全禁用Liquibase,并且不会执行任何变更集 使用液化上下文。在执行maven脚本时,您可以添加-Dliquibase.contexts=dev_context属性(对于spring引导,它将
spring.liquibase.enabled=false
properties。这将完全禁用Liquibase,并且不会执行任何变更集-Dliquibase.contexts=dev_context
属性(对于spring引导,它将是spring.liquibase.contexts=dev_context
)上下文
属性:
<changeSet id="foo" author="bar" context="dev_context">
<!-- your logic here -->
</changeSet>
这样,您的变更集将仅对开发上下文执行有两个选项:
对于prod环境,可以使用spring.liquibase.enabled=false
properties。这将完全禁用Liquibase,并且不会执行任何变更集
使用液化上下文。在执行maven脚本时,您可以添加-Dliquibase.contexts=dev_context
属性(对于spring引导,它将是spring.liquibase.contexts=dev_context
)
在变更集中,您可以指定上下文
属性:
<changeSet id="foo" author="bar" context="dev_context">
<!-- your logic here -->
</changeSet>
这样,您的变更集将仅针对dev\u上下文执行
tk以获得答案
我试过了,但没用
我想问题出在我的pom.xml上。
如果删除标签,液化酶就不起作用
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.8.4</version>
<configuration>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
org.liquibase
liquibase maven插件
3.8.4
假的
src/main/resources/liquibase.properties
过程资源
更新
Tks获取答案
我试过了,但没用
我想问题出在我的pom.xml上。
如果删除标签,液化酶就不起作用
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.8.4</version>
<configuration>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
org.liquibase
liquibase maven插件
3.8.4
假的
src/main/resources/liquibase.properties
过程资源
更新