loadData not recognised using gradle plugin

I’m trying to upgrade our product from liquibase 3.8.9 and liquibase-gradle-plugin 2.0.4. When I move to liquibase 4.16.1 and liquibase-gradle-plugin 2.1.1 I get the following error with one of our upgrade scripts
Caused by: liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: liquibase.parser.core.ParsedNodeException: Error parsing data/PCS-20632.xml: Unknown change type 'loadData'. Check for spelling or capitalization errors and missing extensions such as liquibase-commercial.

This is the change:

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
		http://www.liquibase.org/xml/ns/dbchangelog-ext
		http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
  <changeSet id="PCS-20632.standardizePKI.2" author="vxd" dbms="PostgreSQL">
    <preConditions onFail="MARK_RAN">
      <viewExists viewName="user_indexes"/>
    </preConditions>
    <loadData tableName="tmp_reference_pks"
              file="./tmp_reference_pks.csv"
              separator="," relativeToChangelogFile="true">
      <column header="table_name" name="table_name" type="STRING"/>
      <column header="constraint_name" name="constraint_name" type="STRING"/>
    </loadData>
  </changeSet>
</databaseChangeLog>

Running liquibase from the command line is fine, I only get the error running from gradle. Running from gradle with 3.8.9 was fine.

As per the plugin notes I added the following as dependencies:

    liquibaseRuntime 'info.picocli:picocli:4.6.1'
    liquibaseRuntime group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
    liquibaseRuntime("ch.qos.logback:logback-core:1.2.11")
    liquibaseRuntime("ch.qos.logback:logback-classic:1.2.11")

Any clues what I’m missing here?

Thanks
Doug

I think you need to add com.opencsv:opencsv:5.7.0 as an additional dependency. It’s not strictly required so it’s not added automatically, but it is needed by loadData.

If you add that dependency does it work?

Nathan

Note: This dependency is now included as part of the 4.17.0 release, so it can be resolved by updating.

1 Like

Thanks for the response. I’ll bear that in mind when I come back to it.

I was in a bit of a hurry to get things working, so abandoned loadData and just scripted inlines inserts to get it working