diff --git a/docs/_data/sidebars/pmd_sidebar.yml b/docs/_data/sidebars/pmd_sidebar.yml index 81dfb2ea53..a27d09d877 100644 --- a/docs/_data/sidebars/pmd_sidebar.yml +++ b/docs/_data/sidebars/pmd_sidebar.yml @@ -45,9 +45,20 @@ entries: - title: Suppressing url: /pmd_userdocs_suppressing.html output: web, pdf - - title: Tools / Integrations - url: /pmd_userdocs_tools.html - output: web, pdf + subfolders: + - title: Tools / Integrations + output: web, pdf + subfolderitems: + - title: Maven PMD Plugin + output: web, pdf + url: /pmd_userdocs_tools_maven.html + - title: Ant + output: web, pdf + url: /pmd_userdocs_tools_ant.html + - title: Other Tools / Integrations + output: web, pdf + url: /pmd_userdocs_tools.html + - title: FAQ url: /pmd_userdocs_faq.html output: web, pdf diff --git a/docs/pages/pmd/userdocs/tools.md b/docs/pages/pmd/userdocs/tools.md index f4b0ff7381..ab2210e8a5 100644 --- a/docs/pages/pmd/userdocs/tools.md +++ b/docs/pages/pmd/userdocs/tools.md @@ -6,8 +6,6 @@ folder: pmd/userdocs --- * IDE plugins -* build tool plugins - * [Ant Task Usage](/pmd_userdocs_ant.html) * [Continuous Integrations plugins](/pmd_userdocs_ci.html) * GUIs @@ -123,20 +121,6 @@ folder: pmd/userdocs Jiger Patel, Dale Anson - - Maven - - N/A - N/A - - - - Maven 2 and 3 - - N/A - apache.org / maven - - NetBeans SQE @@ -385,145 +369,6 @@ Also, you can change the plugin to prompt you for a directory to check by going selecting the "Ask for Directory" checkbox. -### Maven - -This section is about the maven 1 PMD plugin. The maven 2 PMD plugin page is available -[below](#Maven_2_and_3). - -#### Running the pmd plugin - -##### report - -To include the Maven report in the project reports section add the following line under -the reports element in your project.xml: - - maven-pmd-plugin - -This will add an entry to the 'project reports' section with the PMD report. - -##### manual - -To run PMD on a Maven project without adding it as a report, simply run - - maven pmd xdoc - -The PMD plugin writes the report in XML which will then be formatted into more readable HTML. - -#### Customization - -##### Changing rulesets - -To specify a set of official, built-in rulesets to be used set them in the property -maven.pmd.rulesets. You can include this setting in your project.properties file. - -A clean strategy for customizing which rules to use for a project is to write a ruleset file. -In this file you can define which rules to use, add custom rules, and -customizing which rules to include/exclude from official rulesets. More information on -writing a ruleset can be found [here](/pmd_userdocs_understanding_rulesets.html). - -Add to the root of your Maven project a pmd.xml file which contains the ruleset mentioned in -the previous paragraph. Add the following property to your project now: - - maven.pmd.rulesetfiles = ${basedir}/pmd.xml - -#### Reference - -See the PMD plugin project page here: - - - -### Maven 2 and 3 - -#### Running the pmd plugin - -##### report - -To include the mvn report in the project reports section add the following lines under -the reports element in your pom.xml: - - - - ... - - - - org.apache.maven.plugins - maven-pmd-plugin - - - - ... - - -This will add an entry to the 'project reports' section with the PMD report. - - -##### manual - -To run PMD on a Maven project without adding it as a report, simply run - - mvn pmd:pmd - -The PMD plugin writes the report in XML which will then be formatted into more readable HTML. - -#### Customization - -##### Changing rulesets - -To specify a ruleset, simply edit the previous configuration: - - - - - - org.apache.maven.plugins - maven-pmd-plugin - - - /rulesets/java/braces.xml - /rulesets/java/naming.xml - d:\rulesets\strings.xml - http://localhost/design.xml - - - - - - -The value of the 'ruleset' value can either be a relative address, an absolute address or even an url. - -A clean strategy for customizing which rules to use for a project is to write a ruleset file. -In this file you can define which rules to use, add custom rules, and -customizing which rules to include/exclude from official rulesets. More information on -writing a ruleset can be found [here](/pmd_userdocs_understanding_rulesets.html). -Note that if you include other rulesets in your own rulesets, you have to be sure that the plugin -will be able to resolve those other ruleset references. - -##### Other configurations - -The Maven 2 PMD plugin allows you to configure CPD, targetJDK, and the use of XRef to link -the report to html source files, and the file encoding: - - - org.apache.maven.plugins - maven-pmd-plugin - - true - ISO-8859-1 - 30 - 1.4 - - - -#### Reference - -For more data, please see the well documented PMD plugin project page here: - -Also, the bug tracker for this plugin is [here](http://jira.codehaus.org/browse/MPMD). - - - - ### NetBeans The [SQE](http://kenai.com/projects/sqe/) project includes PMD integration for NetBeans. diff --git a/docs/pages/pmd/userdocs/ant.md b/docs/pages/pmd/userdocs/tools/ant.md similarity index 99% rename from docs/pages/pmd/userdocs/ant.md rename to docs/pages/pmd/userdocs/tools/ant.md index 2997527ad2..d3749454cc 100644 --- a/docs/pages/pmd/userdocs/ant.md +++ b/docs/pages/pmd/userdocs/tools/ant.md @@ -1,8 +1,6 @@ --- title: Ant Task Usage -sidebar: pmd_sidebar -permalink: pmd_userdocs_ant.html -folder: pmd/userdocs +permalink: pmd_userdocs_tools_ant.html --- ## PMD diff --git a/docs/pages/pmd/userdocs/tools/maven.md b/docs/pages/pmd/userdocs/tools/maven.md new file mode 100644 index 0000000000..f3e5eae8dc --- /dev/null +++ b/docs/pages/pmd/userdocs/tools/maven.md @@ -0,0 +1,179 @@ +--- +title: Maven PMD Plugin +permalink: /pmd_userdocs_tools_maven.html +last_updated: August 2017 +--- + +## Maven 2 and 3 + +### Running the pmd plugin + +#### report + +To include the mvn report in the project reports section add the following lines under +the reports element in your pom.xml: + +``` xml + + ... + + + + org.apache.maven.plugins + maven-pmd-plugin + + + + ... + +``` + +This will add an entry to the 'project reports' section with the PMD report when you build the maven site. + + +#### manual + +To run PMD on a Maven project without adding it as a report, simply run + + mvn pmd:pmd + +The PMD plugin writes the report in XML which will then be formatted into more readable HTML. + + +#### Integrated into the build process + +You can also run PMD automatically when building your project. You even let the build fail, if +PMD finds some violations. Therefore the `check` goal is used: + +``` xml + + ... + + + + org.apache.maven.plugins + maven-pmd-plugin + + true + true + + + + + check + + + + + + + ... + +``` + +This will run PMD automatically during the `verify` phase of the build. You can additionally run CPD, if +you add `cpd-check` as a goal. + + +### Customization + +#### Changing rulesets + +To specify a ruleset, simply edit the previous configuration: + + + + + + org.apache.maven.plugins + maven-pmd-plugin + + + /rulesets/java/braces.xml + /rulesets/java/naming.xml + d:\rulesets\strings.xml + http://localhost/design.xml + + + + + + +The value of the 'ruleset' value can either be a relative address, an absolute address or even an url. + +A clean strategy for customizing which rules to use for a project is to write a ruleset file. +In this file you can define which rules to use, add custom rules, and +customizing which rules to include/exclude from official rulesets. More information on +writing a ruleset can be found [here](pmd_userdocs_understanding_rulesets.html). +Note that if you include other rulesets in your own rulesets, you have to be sure that the plugin +will be able to resolve those other ruleset references. + +#### Other configurations + +The Maven PMD plugin allows you to configure CPD, targetJDK, and the use of XRef to link +the report to html source files, and the file encoding: + + + org.apache.maven.plugins + maven-pmd-plugin + + true + ISO-8859-1 + 30 + 1.4 + + + +### Reference + +For more information, please see the well documented PMD plugin project page here: +. +Also, the bug tracker for this plugin is [here](http://jira.codehaus.org/browse/MPMD). + + +## Maven 1 + +{% include warning.html content="Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the [announcement](http://maven.apache.org/maven-1.x-eol.html). Users are encouraged to migrate to the current version of Apache Maven." %} + +This section is about the maven 1 PMD plugin. + +### Running the pmd plugin + +#### report + +To include the Maven report in the project reports section add the following line under +the reports element in your project.xml: + + maven-pmd-plugin + +This will add an entry to the 'project reports' section with the PMD report. + +##### manual + +To run PMD on a Maven project without adding it as a report, simply run + + maven pmd xdoc + +The PMD plugin writes the report in XML which will then be formatted into more readable HTML. + +#### Customization + +##### Changing rulesets + +To specify a set of official, built-in rulesets to be used set them in the property +maven.pmd.rulesets. You can include this setting in your project.properties file. + +A clean strategy for customizing which rules to use for a project is to write a ruleset file. +In this file you can define which rules to use, add custom rules, and +customizing which rules to include/exclude from official rulesets. More information on +writing a ruleset can be found [here](/pmd_userdocs_understanding_rulesets.html). + +Add to the root of your Maven project a pmd.xml file which contains the ruleset mentioned in +the previous paragraph. Add the following property to your project now: + + maven.pmd.rulesetfiles = ${basedir}/pmd.xml + +#### Reference + +See the PMD plugin project page here: +