Showing content from https://docs.pmd-code.org/latest/pmd_devdocs_building_netbeans.html below:
Building PMD with Netbeans | PMD Source Code Analyzer
Table of Contents Import PMD Project
This needs to be done only once.
- Install Apache Netbeans
- Select File > Open Project⦠and choose the already checked out PMD source folder.
- 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 git@github.com:your_user_name/pmd-designer.git
- Select File > Open Project⦠and choose the pmd-designer source folder.
- Navigate to class
DesignerStarter
- Select âRun Fileâ
- 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.
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4