4
votes

I have a spring-boot application on jdk 11 ,using maven, with following liquibase dependency :

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

The changelog main file is named db.changelog.xml , is located under PROIECTTEST\src\main\resources\db with the following configuration on application.properties :

spring.liquibase.change-log=classpath:/db/db.changelog.xml
spring.liquibase.default-schema=public
liquibase.parameters.schema=public

and looks like :

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">

    <include relativeToChangelogFile="true" file="changelog/initial/test.xml"/>     
</databaseChangeLog>

My changeset test.xml file located on PROIECTTEST\src\main\resources\db\changelog\initial looks like :

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
    <changeSet author="test" id="1540963204914-19">
    <sql > 
    select * from ${schema}.test
    </sql>

    </changeSet>

</databaseChangeLog>

When i start the spring-boot server using command mvn spring-boot:run the liquibase sql is failing with the following error : syntax error at or near "$" .

Am i missing something ? From what i read the property on application.properties is all that is needed and using it by ${propertyName} in your changelog files.

2

2 Answers

5
votes

I found it out in some time ... , just my mystake i used liquibase.parameters.schema instead of spring.liquibase.parameters.schema .

0
votes

It might be because of public is the keyword in liquibase. try with some different name instead of public.