Skip to content

Commit

Permalink
Merge pull request #3119 from liquibase/maven-duplicate-file-mode
Browse files Browse the repository at this point in the history
Added duplicateFileMode setting for maven plugin
  • Loading branch information
nvoxland committed Aug 2, 2022
2 parents 9c3666a + a768cd6 commit 05b3f1b
Showing 1 changed file with 15 additions and 0 deletions.
Expand Up @@ -2,6 +2,7 @@
// Copyright: Copyright(c) 2007 Trace Financial Limited
package org.liquibase.maven.plugins;

import liquibase.GlobalConfiguration;
import liquibase.Liquibase;
import liquibase.Scope;
import liquibase.configuration.core.DeprecatedConfigurationValueProvider;
Expand All @@ -17,6 +18,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

/**
* A Liquibase MOJO that requires the user to provide a DatabaseChangeLogFile to be able
Expand Down Expand Up @@ -92,6 +94,16 @@ public abstract class AbstractLiquibaseChangeLogMojo extends AbstractLiquibaseMo
@PropertyElement(key = "liquibase.hub.mode")
protected String hubMode;


/**
* How to handle multiple files being found in the search path that have duplicate paths.
* Options are WARN (log warning and choose one at random) or ERROR (fail current operation)
*
* @parameter property="liquibase.duplicateFileMode" default-value="ERROR"
*/
@PropertyElement
protected String duplicateFileMode;

@Override
protected void checkRequiredParametersAreSpecified() throws MojoFailureException {
super.checkRequiredParametersAreSpecified();
Expand Down Expand Up @@ -122,6 +134,9 @@ protected void performLiquibaseTask(Liquibase liquibase) throws LiquibaseExcepti
if (StringUtil.isNotEmpty(hubMode)) {
DeprecatedConfigurationValueProvider.setData(HubConfiguration.LIQUIBASE_HUB_MODE.getKey(), hubMode);
}
if (StringUtil.isNotEmpty(duplicateFileMode)) {
DeprecatedConfigurationValueProvider.setData(GlobalConfiguration.DUPLICATE_FILE_MODE.getKey(), GlobalConfiguration.DuplicateFileMode.valueOf(duplicateFileMode.toUpperCase(Locale.ROOT)));
}
}

@Override
Expand Down

0 comments on commit 05b3f1b

Please sign in to comment.