LiquiBase - 将参数从命令行或属性传递到变更集 XML
LiquiBase - Passing Parameter From CommandLine Or Properties to Changeset XML
我正在尝试将更新命令中的参数以及 liquibase 属性文件传递到我的变更集。由于某种原因,它不将占位符识别为参数,而是将其解析为值。
这是我调用 changeLog 的方式(成功运行):
@echo off
call Liquibase --changeLogFile=myChangeLogFile.xml update -Dparamname=value
myChangeLogFile.xml:
<changeSet author="tobi" id="preMigration" runAlways="true">
<executeCommand executable="C:\myBatFile.bat">
<arg value="${liquibase.properties.Dparamname}"/>
<arg value="${liquibase.properties.url}"/>
</executeCommand>
</changeSet>
脚本无法将 ${liquibase.properties.Dparamname} 或 ${liquibase.properties.url} 识别为占位符。
我的 Liquibase.properties 文件有
url:jdbc:oracle:thin:@xyz:1521:ORCL
参数设置。
知道如何访问属性或命令行参数吗?
谢谢
非常感谢您的反馈。
托比亚斯
而不是在你的更新日志中使用它:
<changeSet author="tobi" id="preMigration" runAlways="true">
<executeCommand executable="C:\myBatFile.bat">
<arg value="${liquibase.properties.Dparamname}"/>
<arg value="${liquibase.properties.url}"/>
</executeCommand>
</changeSet>
它应该看起来更像这样:
<changeSet author="tobi" id="preMigration" runAlways="true">
<executeCommand executable="C:\myBatFile.bat">
<arg value="${paramname}"/>
<arg value="${url}"/>
</executeCommand>
</changeSet>
命令行上的 -D
是用于设置系统属性的标准 java 机制,但访问它们时您只需使用 属性 名称。我相当确定您也不需要使用 liquibase.properties
前缀。
我有一个要求,比如使用 liquibase 升级脚本的参数调用 .bat 文件。
同样这也应该 运行 只有一次像更改集一样。
谢谢,
贾加迪斯
我正在尝试将更新命令中的参数以及 liquibase 属性文件传递到我的变更集。由于某种原因,它不将占位符识别为参数,而是将其解析为值。
这是我调用 changeLog 的方式(成功运行):
@echo off
call Liquibase --changeLogFile=myChangeLogFile.xml update -Dparamname=value
myChangeLogFile.xml:
<changeSet author="tobi" id="preMigration" runAlways="true">
<executeCommand executable="C:\myBatFile.bat">
<arg value="${liquibase.properties.Dparamname}"/>
<arg value="${liquibase.properties.url}"/>
</executeCommand>
</changeSet>
脚本无法将 ${liquibase.properties.Dparamname} 或 ${liquibase.properties.url} 识别为占位符。
我的 Liquibase.properties 文件有
url:jdbc:oracle:thin:@xyz:1521:ORCL
参数设置。
知道如何访问属性或命令行参数吗?
谢谢
非常感谢您的反馈。
托比亚斯
而不是在你的更新日志中使用它:
<changeSet author="tobi" id="preMigration" runAlways="true">
<executeCommand executable="C:\myBatFile.bat">
<arg value="${liquibase.properties.Dparamname}"/>
<arg value="${liquibase.properties.url}"/>
</executeCommand>
</changeSet>
它应该看起来更像这样:
<changeSet author="tobi" id="preMigration" runAlways="true">
<executeCommand executable="C:\myBatFile.bat">
<arg value="${paramname}"/>
<arg value="${url}"/>
</executeCommand>
</changeSet>
命令行上的 -D
是用于设置系统属性的标准 java 机制,但访问它们时您只需使用 属性 名称。我相当确定您也不需要使用 liquibase.properties
前缀。
我有一个要求,比如使用 liquibase 升级脚本的参数调用 .bat 文件。 同样这也应该 运行 只有一次像更改集一样。
谢谢, 贾加迪斯