Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

First decide whether the class’s source file should be skipped entirely or whether the code should remain analyzed while a known duplicate is allowed. For Java projects using the Maven PMD Plugin’s Copy/Paste Detector (CPD), use <excludes> to skip files, or configure CPD’s excludeFromFailureFile to allow specified class-level duplication cases. These settings are specific to the tool and execution path; the PMD CLI and jscpd use different options.

Choose the right kind of exclusion

What you want Use Effect
Skip a generated or out-of-scope class entirely Maven PMD Plugin file patterns or an excluded source root The excluded file is no longer scanned, so CPD cannot report any duplication involving its code. The shared plugin configuration may also affect other PMD checks.
Keep classes in analysis but allow known duplicate cases Maven CPD’s excludeFromFailureFile CPD still analyzes the sources, but the listed class-level duplicate cases are allowed by the Maven check.
Ignore only a code region The detector’s region suppression feature Only supported marked regions or matching text are excluded; syntax and language support vary by tool.

Check which command or CI goal actually produces the finding before changing configuration. Maven PMD Plugin settings do not automatically configure a separately invoked PMD CLI or another duplication detector.

Skip a class’s source file with the Maven PMD Plugin

For this method, “exclude a class” means exclude the Java source file that contains it. Maven PMD Plugin <excludes> patterns are matched against paths relative to each source root and support Ant-style wildcards. <excludeRoots> can exclude a whole source directory. The documented parameters are in the Maven PMD Plugin CPD goal reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<configuration>
  <excludes>
    <exclude>**/LegacyAdapter.java</exclude>
    <exclude>**/generated/*.java</exclude>
  </excludes>
  <excludeRoots>
    <excludeRoot>target/generated-sources/stubs</excludeRoot>
  </excludeRoots>
</configuration>

Put the configuration in the existing Maven PMD Plugin setup and retain its current version and executions. The plugin’s violation-exclusions example notes that configuration may need to live in pluginManagement so both build and site lifecycle executions receive it.

#1 Best Overall
GameStop Physical Gift Card
  • Redeemable at US GameStop, EB Games, Babbage's, Electronic Boutique, EBX, Planet X, and Software Etc. stores. Also redeemable online at and GameStop.com and EBGames.com.
  • Over 6,100 stores located throughout the United States.
  • GameStop. Power to the Players.
  • Redemption: Instore and Online
  • No returns and no refunds on gift cards.

Check the path and scope

  • **/LegacyAdapter.java matches source files by path; it does not target one method or block.
  • **/generated/*.java may not match files several directories below generated. Match the actual source-root-relative depth and verify the result.
  • Nested classes normally share their enclosing class’s source file, so a path exclusion cannot skip only the nested class.
  • Excluding a file hides every duplication involving its code. Also, shared Maven PMD configuration can affect other PMD checks using that configuration, not just a single CPD finding.

Allow known class-level duplicates in Maven CPD

If the classes should remain part of analysis, configure excludeFromFailureFile on the cpd-check execution. This is Maven PMD Plugin behavior, not a general CPD or command-line exception-file format. The parameter has been available since Maven PMD Plugin 3.7, according to the CPD goal reference.

<execution>
  <goals>
    <goal>cpd-check</goal>
  </goals>
  <configuration>
    <excludeFromFailureFile>exclude-cpd.properties</excludeFromFailureFile>
  </configuration>
</execution>

For example, exclude-cpd.properties could contain:

com.example.ClassA,com.example.ClassB
com.example.ClassWithInternalDuplication
  • Class names on the same comma-separated line allow duplication between those classes.
  • A class name on its own line allows duplication within that class.

This is a class-level allowance, not a way to silence only one method or line. Configure it on the check that fails in CI; a separate report execution may not carry the setting. See the plugin’s violation-exclusions documentation for the format.

Rank #2
Xbox Physical Gift Card
  • XBOX GIFT CARD: Buy full digital game downloads, game add-ons, in-game currency, memberships, devices, apps, movies, TV shows, and more.
  • DIGITAL GAMES: Choose from hundreds of games, from AAA to indie options. Start playing the moment your most anticipated game is available when you pre-order and pre-download it.
  • GAME AD-ONS: Extend the experience of your favorite games with add-ons and in-game currency.
  • MOVIES & TV SHOWS: Rent or buy new and popular movies and TV shows from a massive library.
  • PERFECT GIFT: Great as a gift for a friend or yourself. Xbox Gift Cards are easy to use, never expire, and give the freedom to pick the gift they want. Enjoy more ways to play without a credit card attached to your Microsoft account.

Exclude paths with the PMD CLI

If CI invokes PMD directly rather than the Maven plugin, use the CLI’s file-path options, not Maven’s class exception file. The current PMD CLI reference documents --exclude for paths and --exclude-file-list for a file containing ignored paths, one per line. These options override files included through --dir, --file-list, or --uri.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Availability depends on the PMD release: the reference lists these options for CPD since 7.0.0 and PMD since 7.14.0. For PMD, --ignore-list was renamed to --exclude-file-list in 7.14.0; use the current name for new configurations. CLI exclusions are file-level exclusions, not Maven’s class-pair allowance.

Rank #3
$100 XBOX Gift Card [Digital Code]
  • THE PERFECT GAMING GIFT — Buy an XBOX Gift Card for yourself or a friend and let them choose the games, add‑ons, subscriptions, and accessories they want most.
  • USE FOR GAMES & CONTENT — Redeem for thousands of digital XBOX games, from backward compatible classics to the latest new releases, plus DLC and in‑game currency.
  • GAME PASS READY — Apply your balance toward XBOX Game Pass Ultimate to play new titles on day one* and access a library of hundreds of high‑quality console games.
  • PRE‑ORDER & PRE‑INSTALL GAMES — Use your balance to pre‑order and pre‑download upcoming titles so you’re ready to play the moment they launch.
  • NO FEES OR EXPIRATION — XBOX Gift Cards never expire and have no service fees, so your balance is ready whenever you are.

Suppress only a region with PMD CPD

When a small block is the issue, a region-level suppression may be narrower than excluding the entire file. PMD’s CPD suppression documentation describes comment-based markers and their language-specific use. Follow the exact syntax for the language being scanned. The page also describes Java’s @SuppressWarnings("CPD-START") and @SuppressWarnings("CPD-END") form as a legacy approach with placement limitations, and favors comment-based suppression instead.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

If the project uses jscpd

jscpd has its own configuration and suppression syntax; PMD settings do not apply. Its configuration guide supports ignore glob patterns, for example:

Rank #4
Fortnite Physical Gift Card
  • An Epic Games account is required to redeem an Epic Games Store Card code
  • If playing on a console platform (PlayStation Network, Xbox Live, Nintendo Switch or Mobile) you need to link your Epic Games account to that gaming platform (one time) to redeem your gift card code
  • The 16 digit code on the back of the card WILL NOT work if redeemed directly through your gaming platform (PlayStation Network, Xbox Live, Nintendo Switch, Mobile, etc.)
  • Note: Nintendo devices do not support Fortnite Shared Wallet, so V-Bucks purchased using your account balance will not show up on your Nintendo device. However, if you purchase items in the web Item Shop — or another platform where you play Fortnite — those items will be available in your Locker across all platforms.
  • Redemption: Online
{
  "ignore": ["**/node_modules/**", "**/dist/**"]
}

For code regions or matching text, jscpd documents jscpd:ignore-start / jscpd:ignore-end comments and the --ignore-pattern option in its detection guide. These are jscpd-specific mechanisms, not universal static-analysis syntax.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
GameStop Physical Gift Card
GameStop Physical Gift Card
Over 6,100 stores located throughout the United States.; GameStop. Power to the Players.; Redemption: Instore and Online
$25.00
Bestseller No. 2
Xbox Physical Gift Card
Xbox Physical Gift Card
MOVIES & TV SHOWS: Rent or buy new and popular movies and TV shows from a massive library.
$25.00
Bestseller No. 3
$100 XBOX Gift Card [Digital Code]
$100 XBOX Gift Card [Digital Code]
Gift cards are region‑specific (U.S. only) and cannot be transferred once redeemed.
$100.00
Bestseller No. 4
Fortnite Physical Gift Card
Fortnite Physical Gift Card
An Epic Games account is required to redeem an Epic Games Store Card code; Redemption: Online
$50.00
Bestseller No. 5
$25 PlayStation Store Gift Card [Digital Code]
$25 PlayStation Store Gift Card [Digital Code]
Redeem for anything on PlayStationStore: games, add-ons, PlayStationPlus and more.; Everything you want to play. Choose from the largest library of PlayStation content.
$25.00
Best Value
$25 PlayStation Store Gift Card [Digital Code]
  • Redeem for anything on PlayStationStore: games, add-ons, PlayStationPlus and more.
  • Everything you want to play. Choose from the largest library of PlayStation content.
  • Use gift card funds to contribute towards PlayStationPlus memberships.

Verify the change in the enforcing check

  1. Run the same Maven goal, CLI command, or CI task that originally reported the duplicate.
  2. For a file exclusion, inspect the report or input list to confirm the intended source file is absent.
  3. For excludeFromFailureFile, confirm the expected class-level case no longer fails and that unrelated findings remain visible.
  4. Check that files are still being analyzed. For jscpd, --fail-on-empty makes the command exit with code 1 if filters leave no files; without it, an empty scan warns and exits 0, as noted in the configuration guide.

Troubleshoot an exclusion that does not work

  • The source still appears: confirm the pattern is relative to a source root and matches the file’s actual depth and name.
  • Only one Maven task respects it: place the setting where the report and check executions that need it can inherit it, and configure the class exception directly on cpd-check when that is the failing goal.
  • An inner class is still detected: it shares the enclosing source file; file patterns cannot independently remove it.
  • The CLI ignores a class exception file: Maven’s excludeFromFailureFile is not the CLI path-exclusion option. Use CLI path exclusions or the suppression mechanism supported by the actual detector.
  • Duplicates remain but identifiers or literals differ: rather than excluding a class, review the Maven CPD goal’s documented comparison options. Changing how identifiers, annotations, or literals are compared can alter duplicate detection across the project, not just for one class; see the CPD parameter reference.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.