Skip to content

Commit

Permalink
[doc] Update release notes and migration guide (pmd#4717)
Browse files Browse the repository at this point in the history
  • Loading branch information
adangel committed Nov 14, 2023
1 parent a0814be commit 94cdd8a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 64 deletions.
79 changes: 15 additions & 64 deletions docs/pages/pmd/userdocs/migrating_to_pmd7.md
Original file line number Diff line number Diff line change
Expand Up @@ -3138,70 +3138,21 @@ See the use case[I'm using only built-in rules](#im-using-only-built-in-rules) a

#### Maven

* Due to some changes in PMD's API, you can't simply pull in the new PMD 7 dependency using the
approach documented in [Upgrading PMD at Runtime](https://maven.apache.org/plugins/maven-pmd-plugin/examples/upgrading-PMD-at-runtime.html).
* A new maven-pmd-plugin version, that supports PMD 7 is in the works. See [MPMD-379](https://issues.apache.org/jira/browse/MPMD-379).
* As long as no new maven-pmd-plugin version with PMD 7 support is released, you can try it out using a
SNAPSHOT version:
1. Add the Apache SNAPSHOT maven repository:
```xml
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>https://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
```
2. Use the version **3.21.1-pmd-7-SNAPSHOT** of the maven-pmd-plugin
3. Override the dependencies of the plugin to use PMD 7, e.g.
```xml
<project>
<properties>
<pmdVersion>{{site.pmd.version}}</pmdVersion>
<mavenPmdPluginVersion>3.21.1-pmd-7.0.0-SNAPSHOT</mavenPmdPluginVersion>
</properties>
...
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${mavenPmdPluginVersion}</version>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-javascript</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-jsp</artifactId>
<version>${pmdVersion}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
...
</project>
```
* Due to some changes in PMD's API, you can't simply pull in the new PMD 7 dependency.
* However, there is now a compatibility module, that makes it possible to use PMD 7 with Maven. In addition to the PMD 7
dependencies documented in [Upgrading PMD at Runtime](https://maven.apache.org/plugins/maven-pmd-plugin/examples/upgrading-PMD-at-runtime.html)
you need to add additionally the following dependency (available with 7.0.0-rc4):

```xml
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-compat6</artifactId>
<version>${pmdVersion}</version>
</dependency>
```

It is important to add this dependency as the **first** in the list, so that maven-pmd-plugin sees the (old)
compatible versions of some classes.

#### Gradle

Expand Down
27 changes: 27 additions & 0 deletions docs/pages/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,31 @@ The remaining section describes the complete release notes for 7.0.0.

#### New and Noteworthy

##### Maven PMD Plugin compatibility with PMD 7

In order to use PMD 7 with [maven-pmd-plugin](https://maven.apache.org/plugins/maven-pmd-plugin/) a new
compatibility module has been created. This allows to use PMD 7 by simply adding one additional dependency:

1. Follow the guide [Upgrading PMD at Runtime](https://maven.apache.org/plugins/maven-pmd-plugin/examples/upgrading-PMD-at-runtime.html)
2. Add additionally the following dependency:

```xml
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-compat6</artifactId>
<version>${pmdVersion}</version>
</dependency>
```

It is important to add this dependency as the **first** in the list, so that maven-pmd-plugin sees the (old)
compatible versions of some classes.

Note: This compatibility modules only works for the built-in rules, that are still available in PMD 7 (you need
to review your rulesets).
As PMD 7 revamped the Java module, if you have custom rules, you need to migrate the rules.
For more information, see the [Detailed Release Notes for PMD 7]({{ baseurl }}pmd_release_notes_pmd7.html#revamped-java)
and [Migration Guide for PMD 7]({{ baseurl }}pmd_userdocs_migrating_to_pmd7.html).

#### Rule Changes

**New Rules**
Expand All @@ -62,6 +87,7 @@ The remaining section describes the complete release notes for 7.0.0.
* miscellaneous
* [#4699](https://github.com/pmd/pmd/pull/4699): Make PMD buildable with java 21
* [#4586](https://github.com/pmd/pmd/pull/4586): Use explicit encoding in ruleset xml files
* [#4741](https://github.com/pmd/pmd/pull/4741): Add pmd-compat6 module for maven-pmd-plugin
* apex-performance
* [#4675](https://github.com/pmd/pmd/issues/4675): \[apex] New Rule: OperationWithHighCostInLoop
* java-codestyle
Expand Down Expand Up @@ -440,6 +466,7 @@ See also [Detailed Release Notes for PMD 7]({{ baseurl }}pmd_release_notes_pmd7.
* [#4586](https://github.com/pmd/pmd/pull/4586): Use explicit encoding in ruleset xml files
* [#4691](https://github.com/pmd/pmd/issues/4691): \[CVEs] Critical and High CEVs reported on PMD and PMD dependencies
* [#4699](https://github.com/pmd/pmd/pull/4699): Make PMD buildable with java 21
* [#4741](https://github.com/pmd/pmd/pull/4741): Add pmd-compat6 module for maven-pmd-plugin
* ant
* [#4080](https://github.com/pmd/pmd/issues/4080): \[ant] Split off Ant integration into a new submodule
* core
Expand Down

0 comments on commit 94cdd8a

Please sign in to comment.