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

 
  • PMD 7.25.0
  • Release date: 29-May-2026
  • About
    • Home
    • Release notes
    • Release notes (PMD 7)
    • 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
    • Decisions
    • Project management
      • Infrastructure
      • Release process
      • Merging pull requests
      • Main Landing page

Building PMD with Netbeans

Table of Contents

Import PMD Project

This needs to be done only once.

  1. Install Apache Netbeans
  2. Select File > Open Project… and choose the already checked out PMD source folder.
  3. After a while, you should see under “Projects > PMD > Modules” all the modules. You can then open individual projects.

Running Unit Tests

  • Right-click on an open project, e.g. “PMD Java” and select “Test”. Netbeans then uses maven to execute the unit tests.
  • You can also run individual test classes.

Note: When executing tests, NetBeans actually calls Maven with surefire:test goal.

Running / Debugging PMD

  • Open the project “PMD CLI” and navigate to the class PmdCli.
  • Right-click on the class and select “Run File”. This runs PMD without any commands and just shows the help text.
  • In the output window at the bottom, click the double yellow arrow to open a “Run Maven” dialog and configure the arguments as e.g. exec.appArgs=check --help. Also change the classpath scope to exec.classpathScope=test.
  • In the “Run Maven” dialog, use the “Add >” button to add the debug configuration - then you can set breakpoints and run in the debugger. Unfortunately, this doesn’t work correctly, as Netbeans seems to start maven with the debugger instead of the executed java app. Therefore, instead of using jpda.listen=maven, we use exec.vmArgs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000. This will stop PMD at the beginning to wait for the debugger. Then you can run in NetBeans “Debug > Attach Debugger…”, select “SocketAttach” using port “8000”.

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

Import the code style settings (formatter) so that it conforms with our Checkstyle config. To do that, go to Tool > Options and the use the button “Import…” and the bottom. Choose the file netbeans/formatting.zip 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 > Open Project… and choose the pmd-designer source folder.
  2. Navigate to class DesignerStarter
  3. Select “Run File”
  4. In the output window at the bottom, click the double yellow arrow to open a “Run Maven” dialog and configure the profiles: “running,with-javafx”

Known Issues

  • There is no Kotlin support for Netbeans. As some parts of PMD use Kotlin, there is no IDE support. See kotlin-netbeans#122.
  • There is no recent checkstyle plugin for Netbeans.
  • When executing tests, the test results are not always recognized by Netbeans. It sometimes says no tests executed although surefire did run tests.
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.