# Enum DuplicatesStrategy

java.lang.Object
java.lang.Enum<DuplicatesStrategy>
org.gradle.api.file.DuplicatesStrategy

All Implemented Interfaces:
  `Serializable, Comparable<DuplicatesStrategy>, Constable`

public enum DuplicatesStrategy extends Enum<DuplicatesStrategy>
Strategies for dealing with the potential creation of duplicate files or archive entries.

Since:
  1.7

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class Enum

  `Enum.EnumDesc<E>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `EXCLUDE`
  Do not allow duplicates by ignoring subsequent items to be created at the same path.
  `FAIL`
  Throw a `DuplicateFileCopyingException` when subsequent items are to be created at the same path.
  `INCLUDE`
  Do not attempt to prevent duplicates.
  `INHERIT`
  Uses the same strategy as the parent copy specification.
  `WARN`
  Do not attempt to prevent duplicates, but log a warning message when multiple items are to be created at the same path.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static DuplicatesStrategy`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static DuplicatesStrategy[]`
  `values()`
  Returns an array containing the constants of this enum type, in the order they are declared.

  ### Methods inherited from class Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### INCLUDE

    public static final DuplicatesStrategy INCLUDE
    Do not attempt to prevent duplicates.

    If the destination of the operation supports duplicates (e.g. zip files) then a duplicate entry will be created. If the destination does not support duplicates, the existing destination entry will be overridden with the duplicate.

    Since:
      1.7

  - ### EXCLUDE

    public static final DuplicatesStrategy EXCLUDE
    Do not allow duplicates by ignoring subsequent items to be created at the same path.

    If an attempt is made to create a duplicate file/entry during an operation, ignore the item. This will leave the file/entry that was first copied/created in place.

    Since:
      1.7

  - ### WARN

    public static final DuplicatesStrategy WARN
    Do not attempt to prevent duplicates, but log a warning message when multiple items are to be created at the same path.

    This behaves exactly as INCLUDE otherwise.

    Since:
      1.8

  - ### FAIL

    public static final DuplicatesStrategy FAIL
    Throw a `DuplicateFileCopyingException` when subsequent items are to be created at the same path.

    Use this strategy when duplicates are an error condition that should cause the build to fail.

    Since:
      1.8

  - ### INHERIT

    public static final DuplicatesStrategy INHERIT
    Uses the same strategy as the parent copy specification. This is the default behavior.
    Since:
      5.0

- ## Method Details

  - ### values

    public static DuplicatesStrategy[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.
    Returns:
      an array containing the constants of this enum type, in the order they are declared

  - ### valueOf

    public static DuplicatesStrategy valueOf(String name)
    Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum type has no constant with the specified name
      `NullPointerException` - if the argument is null