Merge branch 'master' into pmd/7.0.x

This commit is contained in:
Andreas Dangel
2023-02-23 11:47:14 +01:00
3 changed files with 25 additions and 3 deletions

View File

@ -194,6 +194,21 @@ Just set the environment variable `PMD_JAVA_OPTS` before executing PMD, e.g.
windows="set \"PMD_JAVA_OPTS=--enable-preview\"
pmd.bat check -d src\main\java\ -f text -R rulesets/java/quickstart.xml" %}
## Additional runtime classpath
If you develop custom rules and package them as a jar file, you need to add it to PMD's runtime classpath.
You can either copy the jar file into the `lib/` subfolder alongside the other jar files, that are in PMD's
standard distribution.
Or you can set the environment variable `CLASSPATH` before starting PMD, e.g.
{% include cli_example.html
id="preview_classpath"
linux="export CLASSPATH=custom-rule-example.jar
pmd check -d ../../../src/main/java/ -f text -R myrule.xml"
windows="set CLASSPATH=custom-rule-example.jar
pmd.bat check -d ..\..\..\src\main\java\ -f text -R myrule.xml" %}
## Exit Status
Please note that if PMD detects any violations, it will exit with status 4 (since 5.3).

View File

@ -29,6 +29,8 @@ Being based on a proper Antlr grammar, CPD can:
* honor [comment-based suppressions](pmd_userdocs_cpd.html#suppression)
### Fixed Issues
* core
* [#4395](https://github.com/pmd/pmd/issues/4395): \[core] Support environment variable CLASSPATH with pmd.bat under Windows
* java-errorprone
* [#4393](https://github.com/pmd/pmd/issues/4393): \[java] MissingStaticMethodInNonInstantiatableClass false-positive for Lombok's @UtilityClass for classes with non-private fields

View File

@ -63,10 +63,15 @@ if %_needjfxlib% EQU 1 (
)
:: The wildcard will include only jar files, but we need to access also
:: property files such as javafx.properties that lay bare in the dir
set classpath=%TOPDIR%\conf;%TOPDIR%\lib\*;%JAVAFX_HOME%\lib\*;%JAVAFX_HOME%\lib\
set pmd_classpath=%TOPDIR%\conf;%TOPDIR%\lib\*;%JAVAFX_HOME%\lib\*;%JAVAFX_HOME%\lib\
) else (
set classpath=%TOPDIR%\conf;%TOPDIR%\lib\*
set pmd_classpath=%TOPDIR%\conf;%TOPDIR%\lib\*
)
if [%CLASSPATH%] NEQ [] (
set classpath=%CLASSPATH%;%pmd_classpath%
) else (
set classpath=%pmd_classpath%
)
java %PMD_JAVA_OPTS% %jreopts% -classpath %classpath% %OPTS% %MAIN_CLASS% %*
java %PMD_JAVA_OPTS% %jreopts% -classpath %pmd_classpath% %OPTS% %MAIN_CLASS% %*