How to Apply Your Liquibase Pro License Key
Liquibase Pro offers all the functionality of Liquibase Open Source as well as the following features:
- Targeted Rollbacks for one change or set of changes
- Enhanced Stored Logic capabilities
- Enhanced database drift detection
- Policy Checks
- Native executors for PSQL, SQL Plus, and SQLCMD
- Remote file access with S3
- Secrets Management
- Portable and centralized workflows
- Structured Logging
- Operation Reports
For more information about Liquibase Pro features, see Liquibase Pro.
Note: To take advantage of all Liquibase Pro features, it is recommended to use the latest version of Liquibase.
Apply your Liquibase Pro license key
Tip: It is best to use a Secrets Management tool like Hashicorp Vault or AWS Secrets Manager to keep Liquibase license keys secure.
There are several ways to apply the Liquibase Pro license key:
- liquibase.properties file
- CLI Parameter
- Environment Variable
- JAVA_OPTS
- Docker
- Maven pom.xml
- Azure DevOps
- Custom Java Application
Include the Liquibase Pro license key in the Liquibase properties file and save it. For example:
liquibase.licenseKey: aei76ou32thp785463214
Pass the Liquibase Pro license key as a parameter in the command line during runtime:
liquibase --license-key=[paste the Liquibase Pro license key] [command]
For example:
liquibase --license-key=aei76ou32thp785463214 update
Set the Liquibase Pro license key as an environment variable in the command line.
On Windows:
set LIQUIBASE_LICENSE_KEY=aei76ou32thp785463214
On Linux/macOS:
export LIQUIBASE_LICENSE_KEY=aei76ou32thp785463214
Set the Liquibase Pro license key with the JAVA_OPTS Environment Variable in the command line:
JAVA_OPTS="Dliquibase.licenseKey=<enter license key here>"
Pass the Liquibase Pro license key while using a Docker container. Docker allows the use of --env
in the command.
docker run --env LIQUIBASE_LICENSE_KEY=<enter license key here>... \
-it liquibase/liquibase:latest sh
If you use Maven, include the Liquibase Pro license key in the <properties>
section of your pom.xml
file:
<liquibaseLicenseKey>key-goes-here</liquibaseLicenseKey/>
For example:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>0-SNAPSHOT</version>
<configuration>
<changelogFile>com/example/changelog_v4.6.xml</changelogFile>
<liquibaseLicenseKey>key-goes-here</liquibaseLicenseKey>
</configuration>
</plugin>
Note: In older versions of Liquibase, you must use the syntax <liquibaseProLicenseKey>
instead of <liquibaseLicenseKey>
.
If you use Azure DevOps and pass your license key as an environment variable, you can set the value of LIQUIBASE_LICENSE_KEY
in your Azure DevOps pipeline setting file:
script: |
echo "Running Policy Checks"
liquibase checks run --changeLogFile=mysqlChangelog.xml
displayName: 'Run Policy Checks'
env:
LIQUIBASE_LICENSE_KEY: $(LiquibaseKey)
In this example, LiquibaseKey
is the name of the Azure DevOps project variable whose value is the license key.
You can directly embed your Liquibase Pro license key (myProLicenseKey
) in a custom Java application by following these steps:
- In your Maven
pom.xml
file, point toliquibase-commercial.jar
as a dependency: - In your custom Java file, import the following:
- In your custom Java file, call on the
LiquibaseLabsConfiguration
class. For example, to specify your license key so that you can run the Liquibase Proupdate-one-changeset
command:
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-commercial</artifactId>
<version>4.30.0</version>
</dependency>
import com.datical.liquibase.ext.config.LiquibaseLabsConfiguration;
Scope.child(LiquibaseLabsConfiguration.LICENSE_KEY.getKey(), "myProLicenseKey", () ->
new CommandScope(UpdateOneChangeSetSqlCommandStep.COMMAND_NAME)
.addArgumentValue(DbUrlConnectionArgumentsCommandStep.DATABASE_ARG, liquibase.getDatabase())
.addArgumentValue(DatabaseChangelogCommandStep.CHANGELOG_FILE_ARG, "/db_schema/changelog.xml")
.addArgumentValue(UpdateOneChangeSetCommandStep.CHANGESET_AUTHOR_ARG, "fl")
.addArgumentValue(UpdateOneChangeSetCommandStep.CHANGESET_ID_ARG, "1")
.addArgumentValue(UpdateOneChangeSetCommandStep.CHANGESET_PATH_ARG, "/db_schema/changelog.xml")
.execute()
);
For information on running Liquibase commands in Java files, see liquibase.command.CommandScope
.
To verify that your Liquibase Pro license key works as expected and to check its expiration date, you can run the status command.
Note: The syntax liquibase.pro.licenseKey
(rather than liquibase.licenseKey
) is deprecated by Liquibase, but still works.