2

I am trying to generate a change log on an existing DB through Liquibase and Spring Boot.

In the terminal window when I run mvn liquibase:generateChangeLog I can see the XML output of the entire change log getting generated and scrolling through but the file is not getting generated in src/main/resources folder even after specifying the path in the liquibase-maven-plugin plugin configuration in the pom.

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>

Terminal Logs (after executing mvn liquibase:generateChangeLog command)

<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>
6
  • src/main/resources does not exist at runtime Commented Mar 26, 2019 at 20:11
  • You can use "/resource/log" folder to create log files. Spring also writes logs at '/tmp/Spring.log' file. Commented Mar 26, 2019 at 20:15
  • 1
    @Jens - I pointed to a folder that already exists C:\\Logs\\dbChangeLog.xml but still there is no file getting generated there. Commented Mar 27, 2019 at 14:11
  • @Bibek - I tried putting in /resource/log folder but I do not see this getting generated anywhere. Commented Mar 27, 2019 at 14:15
  • Search you file system for a file named dbChangeLog.xml. Maybe it got created elsewhere? Also check for exceptions in your log. When liquibase is having problems to create your changelog file there might be exceptions in your log that could help you... Commented Mar 28, 2019 at 9:37

2 Answers 2

1

I had the same issue. Checked the xmldoc of the maven plugin, and it happens you have to use the parameter <outputChangeLogFile> instead of <changeLogFile>.

Sign up to request clarification or add additional context in comments.

Comments

0

Try different version of Liquibase that might help you.

  <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>
            <version>3.0.5</version>
            <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>

1 Comment

Tried different versions here 3.0.5, 3.5.5. But no luck. The file just doesn't get generated. To me this looks like some configuration issue from my side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.