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.

There is no single Maven-wide setting for excluding files from static analysis. Configure the analyzer that runs in your project: PMD and Checkstyle accept plugin-specific <excludes> settings, while SpotBugs uses an XML filter to omit matching findings from reports. Find the plugin’s artifactId in your pom.xml before choosing a configuration.

Identify the analyzer before adding an exclusion

Look in the POM for the plugin that produces the report or build check. Common artifact IDs are maven-pmd-plugin, maven-checkstyle-plugin, and spotbugs-maven-plugin. Their exclusion settings do different things, so an <excludes> block copied from one plugin may not apply to another.

Also identify the goal or lifecycle that runs the analysis. A project may run a plugin during a build, when generating Maven Site reports, or in both places. The configuration must reach the execution that produces the output you want to change.

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

Exclude files from PMD

Put file patterns inside the PMD plugin’s <configuration>. This example omits one class and any file ending in Bean.java:

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-pmd-plugin</artifactId>
      <version>3.28.0</version>
      <configuration>
        <excludes>
          <exclude>com/example/LegacyAdapter.java</exclude>
          <exclude>**/*Bean.java</exclude>
        </excludes>
      </configuration>
    </plugin>
  </plugins>
</build>

PMD supports Ant-style wildcards, including **. Patterns are matched against paths relative to each source root, not the repository root. For example, use com/example/LegacyAdapter.java, not src/main/java/com/example/LegacyAdapter.java, when that file is under the standard Java source root. If a file matches both PMD’s <includes> and <excludes>, the exclusion takes precedence. See the PMD goal parameters.

To omit an entire source directory rather than particular files, use PMD’s <excludeRoots> setting. A file pattern is not the right substitute for excluding a whole source root; consult the PMD parameter reference for the configuration details.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Exclude files from Checkstyle

Checkstyle’s Maven plugin also supports <excludes>. The plugin describes it as a filter for source-file names. Here is a plugin-specific example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-checkstyle-plugin</artifactId>
      <version>3.6.0</version>
      <configuration>
        <excludes>
          <exclude>**/LegacyAdapter.java</exclude>
          <exclude>**/generated/**</exclude>
        </excludes>
      </configuration>
    </plugin>
  </plugins>
</build>

Checkstyle’s plugin parameter documentation does not describe pattern matching as explicitly as PMD’s. Verify that a pattern behaves as intended with the Checkstyle plugin version and source roots configured in your project rather than assuming PMD’s path rules apply.

Rank #3
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Exclude recognized generated sources

If the files are generated sources and your Checkstyle plugin is version 3.3.1 or later, you can use <excludeGeneratedSources>true</excludeGeneratedSources>. It defaults to false. The option helps avoid maintaining a broad filename pattern, but the files must be recognized as generated sources in the Maven project. The setting and its version requirement are documented in the Checkstyle goal parameters.

Use a SpotBugs filter for findings

SpotBugs uses a different mechanism. Configure <excludeFilterFile> to point to an XML filter file; this filters matching bug instances from reports. It is not the same as telling PMD or Checkstyle to omit source files from their selection.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

For example, a SpotBugs Maven configuration can point to a filter file in the project:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<reporting>
  <plugins>
    <plugin>
      <groupId>com.github.spotbugs</groupId>
      <artifactId>spotbugs-maven-plugin</artifactId>
      <version>4.10.4.1</version>
      <configuration>
        <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
      </configuration>
    </plugin>
  </plugins>
</reporting>

The filter file uses a FindBugsFilter root. A source-file match can look like this:

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
<FindBugsFilter>
  <Match>
    <Source name="LegacyAdapter.java"/>
  </Match>
</FindBugsFilter>

Check the SpotBugs filter format against the actual bug instances. A filter can only match information present in those instances, and some findings involve multiple classes. The SpotBugs Maven usage guide documents <excludeFilterFile>.

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

Put configuration where the active execution can use it

For build-time analysis, configure the plugin under <build><plugins> or in a configuration inherited by the executing plugin. For Maven Site reports, configure the plugin under <reporting><plugins> as appropriate. If analysis runs in both contexts, check each execution: a setting in one configuration block does not automatically establish that the other report or goal uses it.

PMD’s exclusion example recommends <pluginManagement> when sharing configuration between build and reporting use. It centralizes plugin settings, but <pluginManagement> alone does not execute a plugin; the project still needs the plugin or goal to be used. See PMD’s exclusion example.

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

Check whether the file is excluded

  1. Run the same goal or lifecycle that normally produces the analysis. Do not rely on a different report or build execution to verify the change.
  2. Inspect that execution’s output or report. Confirm the target file no longer appears for PMD or Checkstyle, or that the intended findings are absent from SpotBugs output.
  3. If the result is unchanged, trace the configuration. Confirm the block is under the correct plugin, the tested goal uses it, and the file belongs to a source root the plugin analyzes.
  4. Recheck the pattern’s path convention. For PMD, use a source-root-relative path. For Checkstyle, verify the pattern against that plugin’s version and configured source roots. For SpotBugs, confirm the filter matches details present in the bug instances.
  5. Keep the pattern narrow. A broad pattern can remove handwritten code from coverage along with generated or legacy files.

File exclusion is not the same as suppressing violations

Choose the mechanism based on what you want to stop:

  • Omit a file from PMD or Checkstyle selection: use the relevant plugin’s file exclusions; PMD also offers <excludeRoots> for entire source roots.
  • Suppress particular Checkstyle violations: use Checkstyle’s <suppressionsLocation> with a suppression XML file instead of removing the whole file from source selection.
  • Keep PMD analysis but prevent selected findings from failing the build: PMD’s <excludeFromFailureFile> concerns classes and rules excluded from failures; it is distinct from <excludes> and <excludeRoots>, which control checked files or roots.
  • Stop the entire Checkstyle check: <skip> skips the check. <failsOnError> controls whether violations fail the build. Neither setting excludes an individual file.
  • Filter SpotBugs output: use its XML filter for matching bug reports, not as a general per-file source-selection option.

Plugin-specific behavior is documented in the PMD goal reference, the Checkstyle goal reference, and the SpotBugs filter guide.

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.