apache / apache/maven-pmd-plugin

[MPMD-392] Allow skip maven toolchain configuration

Open
#360 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:minor
Dominant language
Java
Stars
66
Forks
55
Avg merge
8d 16h
Merged PRs (30d)
7

Description

**[Roberto Araujo](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=andrioli)** opened **[MPMD-392](https://issues.apache.org/jira/browse/MPMD-392?redirect=false)** and commented

I think it's a good idea allow skip the usage of maven toolchain, let me give my use case:

I'm working on a "legacy" java application. The application is compiled targeting Java 6. Our build requires Java 17, so we are using the JDK 6 toolchain (via Maven Toolchain plugin) to compile the source code (Note that Java 17 compiler can't target Java 6 bytecode).

The problem is that PMD Plugin will use the configured toolchain. Obviously, the latest version is not compatible with Java 6 so the execution fails with  the following exception:

```
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/plugins/pmd/exec/PmdExecutor : Unsupported major.minor version 52.0
```

One option is to configure a new toolchain just to  PMD plugin and use the ``option (https://maven.apache.org/plugins/maven-pmd-plugin/pmd-mojo.html#jdkToolchain). A Much more portable solution is to skip the usage of configured toolchain, so we don't depend of the `settings.xml` file.

If this makes sense, I can try to work on it and fire a PR on the GitHub repository.

---
No further details from [MPMD-392](https://issues.apache.org/jira/browse/MPMD-392?redirect=false)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the Maven PMD plugin's jdkToolchain documentation and the Maven Toolchain plugin behavior described in the issue, then inspect the plugin's existing toolchain configuration and tests. Done means users can explicitly skip the configured toolchain, while the current jdkToolchain option remains understandable and the legacy Java 6 scenario is covered by verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.