Liquibase无法从Spring Boot中现有数据库的src / main / resources文件夹中生成changeLog文件

时间:2019-03-26 20:09:03

标签: java spring maven spring-boot liquibase

我正在尝试通过DBLiquibase在现有Spring Boot上生成更改日志。

在终端窗口中,当我运行mvn liquibase:generateChangeLog时,可以看到整个变更日志的XML输出已生成并滚动浏览,但是即使在src/main/resources文件夹中也没有生成文件在pom的liquibase-maven-plugin插件配置中指定路径后。

application.properties

spring.datasource.url=jdbc:oracle:thin:@//person-db:6136/person-sid
spring.datasource.username=abc
spring.datasource.password=def
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver

pom.xml

  <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>2.0.0.RELEASE</version>
      <relativePath/> <!-- lookup parent from repository -->
  </parent>

  <dependency>
     <groupId>org.liquibase</groupId>
     <artifactId>liquibase-core</artifactId>
  </dependency>

  <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <configuration>
                    <changeLogFile>src/main/resources/dbChangeLog.xml</changeLogFile>
                    <driver>oracle.jdbc.OracleDriver</driver>
                    <url>jdbc:oracle:thin:@//person-db:6136/person-sid</url>
                    <username>abc</username>
                    <password>def</password>
                </configuration>
            </plugin>
        </plugins>
    </build>

终端日志(在执行mvn liquibase:generateChangeLog命令之后)

<databaseChangeLog>
    .....
    <changeSet author="R649526 (generated)" id="1553629923684-9">
            <createTable tableName="APPL_SNDER_TRGR_CNTL" tablespace="TS_USRT_DEV_SML_DATA">
                <column name="RECEIVING_APPL_ID" type="VARCHAR2(8 BYTE)">
                    <constraints primaryKey="true" primaryKeyName="SYS_C0067672"/>
                </column>
                <column name="SNDING_APPL_ID" type="VARCHAR2(8 BYTE)">
                    <constraints primaryKey="true" primaryKeyName="SYS_C0067672"/>
                </column>
                <column name="RECEIVING_APPL_CHNL_ID" type="VARCHAR2(2 BYTE)">
                    <constraints primaryKey="true" primaryKeyName="SYS_C0067672"/>
                </column>
                <column name="LINK_DIR_CD" type="VARCHAR2(1 BYTE)"/>
                <column name="SNDING_APPL_TRGR_NM" type="VARCHAR2(80 BYTE)">
                    <constraints nullable="false"/>
                </column>
                <column name="LAST_UPDT_TS" type="TIMESTAMP(6)">
                    <constraints nullable="false"/>
                </column>
            </createTable>
        </changeSet>
        <changeSet author="R649526 (generated)" id="1553629923684-10">
            <createTable tableName="BAT_APPL_FILE_CNTL" tablespace="TS_USRT_DEV_SML_DATA">
                <column name="APPL_ID" type="VARCHAR2(8 BYTE)">
                    <constraints primaryKey="true" primaryKeyName="SYS_C0067673"/>
                </column>
                <column name="BAT_FILE_CNTL_TS" type="TIMESTAMP(6)">
                    <constraints primaryKey="true" primaryKeyName="SYS_C0067673"/>
                </column>
                <column name="LINK_DIR_CD" type="VARCHAR2(1 BYTE)">
                    <constraints primaryKey="true" primaryKeyName="SYS_C0067673"/>
                </column>
                <column name="BAT_FILE_NB" type="NUMBER">
                    <constraints primaryKey="true" primaryKeyName="SYS_C0067673"/>
                </column>
                <column name="BAT_FILE_CRE_TS" type="TIMESTAMP(6)">
                    <constraints nullable="false"/>
                </column>
                <column name="BAT_FILE_MSG_CNT" type="NUMBER">
                    <constraints nullable="false"/>
                </column>
                <column name="BAT_FILE_PROC_TS" type="TIMESTAMP(6)"/>
                <column name="BAT_FILE_STS_CD" type="VARCHAR2(1 BYTE)">
                    <constraints nullable="false"/>
                </column>
                <column name="BAT_FILE_RJCT_RSN_TX" type="VARCHAR2(80 BYTE)"/>
                <column name="LAST_UPDT_TS" type="TIMESTAMP(6)"/>
            </createTable>
        </changeSet>
</databaseChangeLog>

1 个答案:

答案 0 :(得分:0)

尝试其他版本的Liquibase可能会对您有所帮助。

Thread Running