-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Roberto Araujo opened MPMD-392 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 <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.
No further details from MPMD-392