preserve-classpath-prefix-in-normalized-paths

The --preserve-classpath-prefix-in-normalized-paths global parameter is a Boolean value. It forces Liquibase to preserve the prefix classpath: while it normalizes the resource path you have specified in --classpath. It is available in Liquibase 4.30.0 and later.

The default value of --preserve-classpath-prefix-in-normalized-paths is false.

Note: This parameter only affects resources you specify in the Liquibase parameter --classpath. It does not affect any resources you specify in --search-path.

Uses

Liquibase uses the Java Virtual Machine (JVM) to resolve resource paths like your classpath, which is a list of file paths where changelogs, configuration files, and JAR files (bundles of Java classes) are stored. The JVM uses the classpath to search for, load into memory, and link each of those resources to prepare them for use in Liquibase.

Liquibase lets you set the classpath using the global parameter --classpath. Liquibase normalizes the classpath value you specify by converting it to a consistent format. By default, if your classpath contains the prefix classpath:, Liquibase removes the prefix. Then Liquibase sends the normalized classpath to the ResourceAccessor.

However, you may be trying to implement a custom ResourceAccessor that needs to accept an abstract URL as the Liquibase classpath. For example, you may want to specify a root resource path containing a nested (hierarchical) classpath as the value of --classpath instead of a relative or absolute path directly connected to the file system. If Liquibase strips the classpath: protocol, your custom class cannot access the correct sub-resource locations.

If you want to preserve the classpath: prefix in your Liquibase resource path, set --preserve-classpath-prefix-in-normalized-paths to true. This way, Liquibase path normalization does not strip classpath: from the resource path it sends to the ResourceAccessor.

Syntax

You can set this parameter in the following ways:

Option Syntax
Liquibase properties file (defaults file)
liquibase.preserveClasspathPrefixInNormalizedPaths: <true|false>
Global flow file argument (example)
stages:
  Default:
    actions:
      - type: liquibase
        command: update
        globalArgs: { preserve-classpath-prefix-in-normalized-paths: "<true|false>" }
Global CLI parameter
liquibase
 --preserve-classpath-prefix-in-normalized-paths=<true|false> update
 --changelog-file=example-changelog.xml

JVM system property (JAVA_OPTS Environment Variable)

JAVA_OPTS=-Dliquibase.preserveClasspathPrefixInNormalizedPaths=<true|false>
Liquibase Environment Variables
LIQUIBASE_PRESERVE_CLASSPATH_PREFIX_IN_NORMALIZED_PATHS=<true|false>

For more information, see Working with Command Parameters.

Related links