adangel commented on issue #752:
URL: 
https://github.com/apache/maven-pmd-plugin/issues/752#issuecomment-6881391840

   So, what will be working once 3.29.0 is released:
   
   Assuming you want to use Java 21 for your project:
   
   1. Configure toolchains (see 
https://maven.apache.org/guides/mini/guide-using-toolchains.html) - make sure 
you have a toolchain for java 21 configured
   2. Then configure the property 
`<maven.compiler.release>21</maven.compiler.release>` (under 
project/properties) (this will be picked up by maven-compiler-plugin)
   3. Configure pmd's targetJdk to use java 21:
   ```xml
         <plugin>
           <artifactId>maven-pmd-plugin</artifactId>
           <version>3.29.0</version>
           <configuration>
             <targetJdk>${maven.compiler.release}</targetJdk>
           </configuration>
         </plugin>
   ```
   
   With such a configuration, the warning will not show up, because the 
maven-pmd-plugin uses the toolchain configuration to figure out, where java21 
is installed and uses that for the auxclasspath when calling PMD.
   
   Note: This works of course only for the next version of the plugin.
   
   ----
   
   Workaround (not recommended):
   
   Configure jrt-fs.jar explicitly as a system dependency:
   
   ```xml
         <plugin>
           <artifactId>maven-pmd-plugin</artifactId>
           <version>3.28.0</version>
           <configuration>
             <targetJdk>${maven.compiler.release}</targetJdk>
           </configuration>
           <dependencies>
             <dependency>
               <groupId>java21</groupId>
               <artifactId>java21-jrt-fs</artifactId>
               <version>21</version>
               <scope>system</scope>
               <systemPath>/path/to/jdk-21/lib/jrt-fs.jar</systemPath>
             </dependency>
           </depenencies>
         </plugin>
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to