[doc] Mention PMD_JAVA_OPTS

This commit is contained in:
Andreas Dangel
2019-03-16 11:39:35 +01:00
parent d7aa1b1742
commit e36e01c093
3 changed files with 25 additions and 3 deletions

View File

@ -150,6 +150,16 @@ The tool comes with a rather extensive help text, simply running with `-help`!
%}
</table>
## Additional Java Runtime Options
PMD is executed via a Java runtime. In some cases, you might need to set additional runtime options, e.g.
if you want to analyze a project, that uses one of OpenJDK's [Preview Language Features](http://openjdk.java.net/jeps/12).
Just set the environment variable `PMD_JAVA_OPTS` before executing PMD, e.g.
export PMD_JAVA_OPTS="--enable-preview"
./run.sh pmd -d ../../../src/main/java/ -f text -R rulesets/java/quickstart.xml
## Exit Status
Please note that if PMD detects any violations, it will exit with status 4 (since 5.3).

View File

@ -178,11 +178,15 @@ The default format is a text report, and there's also a `csv` report.
Note that CPD is pretty memory-hungry; you may need to give Java more memory to run it, like this:
$ export HEAPSIZE=512m
$ export PMD_JAVA_OPTS=-Xmx512m
$ ./run.sh cpd --minimum-tokens 100 --files /usr/local/java/src/java
In order to change the heap size under Windows, you'll need to edit the batch file `cpd.bat` set the "OPTS"
variable to `-Xmx512m`.
In order to change the heap size under Windows, you'll need to edit the batch file `cpd.bat` or
set the environment variable `PMD_JAVA_OPTS` prior to starting CPD:
C:\ > cd C:\pmd-bin-{{site.pmd.version}}\bin
C:\...\bin > set PMD_JAVA_OPTS=-Xmx512m
C:\...\bin > .\cpd.bat --minimum-tokens 100 --files c:\temp\src
If you specify a source directory but don't want to scan the sub-directories, you can use the non-recursive option:

View File

@ -56,6 +56,14 @@ The designer will still be shipped with PMD's binaries.
### API Changes
#### Command Line Interface
The start scripts `run.sh`, `pmd.bat` and `cpd.bat` support the new environment variable `PMD_JAVA_OPTS`.
This can be used to set arbitrary JVM options for running PMD, such as memory settings (e.g. `PMD_JAVA_OPTS=-Xmx512m`)
or enable preview language features (e.g. `PMD_JAVA_OPTS=--enable-preview`).
The previously available variables such as `OPTS` or `HEAPSIZE` are deprecated and will be removed with PMD 7.0.0.
#### Deprecated API
* {% jdoc core::renderers.CodeClimateRule %} is deprecated in 7.0.0 because it was unused for 2 years and