LiquiBase - Passing Parameter From CommandLine Or Properties to Changeset XML

前端 未结 2 1257
自闭症患者
自闭症患者 2021-01-25 02:43

I am trying to pass a parameter from my update command as well as the liquibase properties file to my changeset. For some reason, it does not recognise the placeholder as a para

相关标签:
2条回答
  • 2021-01-25 03:01

    I have a requirement like calling a .bat file with parameters from liquibase upgrade scripts. Also also this should run only one time like change set.

    Thanks, Jagadeesh

    0 讨论(0)
  • 2021-01-25 03:18

    Rather than using this in your changelog:

    <changeSet author="tobi" id="preMigration" runAlways="true">
        <executeCommand executable="C:\myBatFile.bat">
            <arg value="${liquibase.properties.Dparamname}"/>
            <arg value="${liquibase.properties.url}"/>
        </executeCommand>  
    </changeSet>
    

    it should look more like this:

    <changeSet author="tobi" id="preMigration" runAlways="true">
        <executeCommand executable="C:\myBatFile.bat">
            <arg value="${paramname}"/>
            <arg value="${url}"/>
        </executeCommand>  
    </changeSet>
    

    The -D on the command line is the standard java mechanism for setting system properties, but when accessing them you just use the property name. I am fairly certain that you don't need to use the liquibase.properties prefix either.

    0 讨论(0)
提交回复
热议问题