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 VS Code | PMD Source Code Analyzer

 
  • PMD 7.30.0
  • Release date: 27-November-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 VS Code

Table of Contents

Warning

It is not recommend to use VS Code for developing. See Known Issues below.

Import PMD Project

This needs to be done only once.

  1. Install Visual Studio Code
  2. Select File > Open Folder… and choose the already checked out PMD source folder.
  3. Install Extension Pack for Java
  4. After a while, you should see in the Explorer under “Java Projects” all the modules. This is the “Java Project Explorer”.

Running Unit Tests

  • Navigate to a test class and select “Run Test”.

Note

You’ll get the notification “Build failed”. You can try to ignore the error and continue, but you might end up with “Unresolved compilation problems”. See below under “Known Issues” for more information.

PMD currently is still built for Java 8 and the VS Code plugin chooses a Java 8 runtime. For building however, we use Java 21 and also the tests require some Java 21 features. You might need to override the java version manually: Ctlr+Shift+P and enter “configure java runtime”. There you can override the java version for each project/module.

Running / Debugging PMD

  • Navigate to the class PmdCli.
  • Click on the “Run” link just above the main-method.
  • To customize the options, open the “Run and Debug” window (Ctlr+Shift+D) and click the link “create a launch.json file”. Add the following configuration:
          {
              "type": "java",
              "name": "PmdCli with args",
              "request": "launch",
              "mainClass": "net.sourceforge.pmd.cli.PmdCli",
              "projectName": "pmd-cli",
              "args": "check --help",
              "classPaths": ["$Test"]
          },
    
  • Select the run configuration “PmdCli with args” in the dropdown and use File > Start Debugging or File > Run Without Debugging.

Note

If you want to run/debug other PMD modules than PMD Java, then you need to add additional dependencies to PMD CLI as scope test, e.g.

       <dependency>
           <groupId>net.sourceforge.pmd</groupId>
           <artifactId>pmd-apex</artifactId>
           <version>${project.version}</version>
           <scope>test</scope>
       </dependency>

Formatter configuration

Select File > Preferences > Settings and search for “java format settings”. Then enter the full path to eclipse/pmd-eclipse-code-formatter.xml from the “build-tools” repository.

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
  1. Select File > Add Folder to Workspace… and choose the pmd-designer source folder.
  2. Wait until the project has been successfully imported.
  3. Navigate to class DesignerStarter and run it.

Known Issues

  • Some Java files in PMD cannot be compiled with VS Code. The Java plugin for VS Code is based on the Eclipse Java Plugin which uses an own compiler (ejc). This compiler has some subtle differences when dealing with type inference and generics and sometimes cannot compile PMD source code correctly. PMD source is valid, it compiles with openjdk, but just not with ecj.

    You’ll get the notification “Build failed”. You can try to ignore the error and continue, but you might end up with “Unresolved compilation problems”.

  • There is no Kotlin support. As some parts of PMD use Kotlin, there is no IDE support.
  • There is no recent checkstyle plugin for Netbeans.
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.