Roberto Araujo created MPMD-392:
-----------------------------------

             Summary: Allow skip maven toolchain configuration
                 Key: MPMD-392
                 URL: https://issues.apache.org/jira/browse/MPMD-392
             Project: Maven PMD Plugin
          Issue Type: New Feature
            Reporter: Roberto Araujo


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 
`<jdkToolchain>`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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to