GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • PMD Source Code Analyzer Project
  • Nav
  • Download
  • GitHub
  • Edit on GitHub

This view

  • Original page
  • New address

GeezerVison is showing docs.pmd-code.org — Building PMD with IntelliJ IDEA | PMD Source Code Analyzer

 
  • PMD 7.31.0-SNAPSHOT
  • Release date: 28-December-2026
  • About
    • Home
    • Release notes
    • Getting help
    • Release policies
    • Support lifecycle
    • Security
  • User Documentation
    • Migration Guide for PMD 7
    • Installation and basic CLI usage
    • Making rulesets
    • Configuring rules
    • Best practices
    • Suppressing warnings
    • Incremental analysis
    • PMD CLI reference
    • PMD Report formats
    • 3rd party rulesets
    • Signed Releases
    • CPD reference
      • Copy-paste detection
      • CPD Report formats
    • Extending PMD
      • Introduction to writing rules
      • Your first rule
      • XPath rules
      • Java rules
      • Rule designer reference
      • Defining rule properties
      • Rule guidelines
      • Testing your rules
      • Creating (XML) dump of the AST
    • Tools / Integrations
      • Maven PMD Plugin
      • Gradle
      • Ant
      • PMD Java API
      • bld PMD Extension
      • CI integrations
      • IDE Plugins
      • Other Tools / Integrations
  • Rule Reference
    • Apex Rules
      • Index
      • Best Practices
      • Code Style
      • Design
      • Documentation
      • Error Prone
      • Performance
      • Security
    • HTML Rules
      • Index
      • Best Practices
    • Java Rules
      • Index
      • Best Practices
      • Code Style
      • Design
      • Documentation
      • Error Prone
      • Multithreading
      • Performance
      • Security
    • Java Server Pages Rules
      • Index
      • Best Practices
      • Code Style
      • Design
      • Error Prone
      • Security
    • JavaScript Rules
      • Index
      • Best Practices
      • Code Style
      • Error Prone
      • Performance
    • Kotlin Rules
      • Index
      • Best Practices
      • Error Prone
    • Maven POM Rules
      • Index
      • Error Prone
    • Modelica Rules
      • Index
      • Best Practices
    • PLSQL Rules
      • Index
      • Best Practices
      • Code Style
      • Design
      • Error Prone
    • Salesforce Visualforce Rules
      • Index
      • Security
    • Scala Rules
      • Index
    • Swift Rules
      • Index
      • Best Practices
      • Error Prone
    • Velocity Template Language (VTL) Rules
      • Index
      • Best Practices
      • Design
      • Error Prone
    • WSDL Rules
      • Index
    • XML Rules
      • Index
      • Best Practices
      • Error Prone
    • XSL Rules
      • Index
      • Code Style
      • Performance
  • Language-Specific Documentation
    • Overview
    • Language configuration
    • Apex
    • C/C++
    • C#
    • CSS
    • Coco
    • Dart
    • Fortran
    • Gherkin
    • Go
    • HTML
    • Java
    • JavaScript / TypeScript
    • JSP
    • Julia
    • Kotlin
    • Lua
    • Matlab
    • Modelica
    • Objective-C
    • Perl
    • PHP
    • PLSQL
    • Python
    • Ruby
    • Rust
    • Scala
    • Swift
    • T-SQL
    • Visualforce
    • Velocity Template Language (VTL)
    • XML and XML dialects
  • Developer Documentation
    • Contributing
      • Contributing
      • Developer resources
      • Newcomers' Guide
      • Writing documentation
    • Building PMD
      • General Info
      • Building PMD from source
      • Building PMD with IntelliJ IDEA
      • Building PMD with Eclipse IDE
      • Building PMD with VS Code IDE
      • Building PMD with Netbeans IDE
    • Roadmap
    • GitHub Actions Workflows
    • How PMD works
    • Logging
    • Pmdtester
    • Rule Deprecation Policy
    • Major contributions
      • Rule Guidelines
      • Adding a new dialect
      • Adding a new language (JavaCC)
      • Adding a new language (ANTLR)
      • Adding a new CPD language
    • Experimental features
      • List of experimental Features
  • Project documentation
    • Trivia about PMD
      • PMD in the press
      • Products & books related to PMD
      • Similar projects
      • What does 'PMD' mean?
    • Logo
    • FAQ
    • License
    • Credits
    • Old Release Notes
      • Release Notes PMD 7.x
      • Detailed Release Notes PMD 7.0.0
      • Release Notes PMD 6.x
      • Release Notes PMD 5.x
      • Release Notes PMD 4.x and earlier
    • Decisions
    • Project management
      • Infrastructure
      • Release process
      • Merging pull requests
      • Main Landing page

Building PMD with IntelliJ IDEA

Table of Contents

Import PMD Project

  1. Download the Community Edition of IntelliJ IDEA from https://www.jetbrains.com/idea/download/other.html.
  2. Install it, that means, extract the archive
  3. Start it with bin/idea.sh
  4. In the startup dialog, choose the button Open and select the folder, into which PMD’s repository has been cloned. Then select “Trust Project”. After that, IJ will automatically detect that PMD is a maven project and import it. Make sure, you have previously built PMD on command line via ./mvnw clean verify, as described in the general info page.
  5. If you are using IJ for the first time, you’ll need to configure the path to your installed Java SDK. You have to use at least Java 21 here. If the dialog doesn’t show automatically, you can open it with menu File > Project Structure (CTRL+ALT+SHIFT+S). On the left, choose “Platform Settings > SDK” and add your Java SDK. Then choose “Project Settings > Project” and select the SDK for PMD.
  6. Finish the wizard and wait a bit, until all PMD modules appear on the left.

Running Unit Tests

  • Right click on “pmd-java” and select “Run ‘All Tests’”
  • You can run individual unit tests or a single unit test class by right-clicking, or CTRL + SHIFT + F10. You can debug the current Run configuration using SHIFT + F9.

Running / Debugging PMD

  • Navigate to the class PmdCli
  • Run it
  • Open Run > Edit Configurations… and set as program arguments eg. “check –help”
  • Instead of run, you can easily choose “Debug” to run the debugger.
  • Select the module “pmd-dist” for the classpath, so that all language modules are available while running PmdCli.

Setting up Checkstyle

If you don’t have the Checkstyle plugin:

  • Open File > Settings (CTRL+ALT+S) and navigate to “Plugins” on the left
  • Search for “Checkstyle-IDEA” and click “Install”
  • When done, restart IJ

Once you have the Checkstyle plugin:

  • Open File > Settings (CTRL+ALT+S) and navigate to “Tools > Checkstyle” on the left
  • Make sure to select the latest Checkstyle version and click Apply
  • Add a configuration file with the “+” button on top of the table
  • Choose a descriptive name e.g. “pmd checkstyle”, then tick “Use a Checkstyle file accessible via HTTP” and enter the following URL:
      https://raw.githubusercontent.com/pmd/build-tools/master/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-config.xml
    
  • Tick the “Active” checkbox for this added checkstyle configuration

Formatter and inspection configuration

Import the code style settings (formatter) so that it conforms with our Checkstyle config. To do that, go to File > Settings (CTLR+ALT+S) then navigate to “Editor > Code Style > Java”. Click on the cogwheel symbol, choose “Import Scheme > IntelliJ IDEA code style XML” and choose the file intellij-idea/PMD-code-style.xml from the build-tools repository.

Take some time to tweak the inspections so that they conform to the code style, for example flagging switch statements with no default case. This takes some time but can make your code much cleaner. To do that, go to File > Settings then navigate to “Inspections > Java”.

Running the designer

The designer lives in a separate repository, that you’ll need to fork and clone first: Designer repository

git clone [email protected]:your_user_name/pmd-designer.git

See Contributing Guide of the Designer for details.

  • You’ll need to configure SDKs and select a Project SDK.
  • We recommend using the provided run configurations like “Designer (Java 21)”.

Known Issues

  • Some compilation errors: If you didn’t build PMD from command line outside of IDEA, then the sources, that are usually generated during the build, are not available. You can right-click on the PMD project and select “Maven > Generate Sources and Update Folders”. It seems, that IDEA doesn’t use the correct JDK when executing this command. Try again - it seems, it works on the second try only. After that, the folder are there, but IDEA doesn’t use them. Select “Maven > Reimport”.
  • When editing FXML or CSS files for the designer, IJ sometimes fails to put the updated version in the classpath when running. You might need to run mvn process-resources manually before.
  • As a quickfix for the two problems above, mvn compile is quick to execute when your Maven dependency cache is up-to-date.
Tags: devdocs
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.