I configured different version for main and test.
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
<maven.compiler.release>${maven.compiler.target}</maven.compiler.release>
<maven.compiler.testSource>17</maven.compiler.testSource>
<maven.compiler.testTarget>${maven.compiler.testSource}</maven.compiler.testTarget>
<maven.compiler.testRelease>${maven.compiler.testTarget}</maven.compiler.testRelease>
When I do the site, the plugin complains.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:4.0.0-M3:site (default-site) on project ...: Error generating maven-javadoc-plugin:3.4.1:test-aggregate-no-fork report:
[ERROR] Exit code: 1 - Loading source files for package ...
[ERROR] Loading source files for package ...
[ERROR] Loading source files for package ...
[ERROR] /.../src/test/java/.../Some.java:16: warning: as of release 10, 'var' is a restricted type name and cannot be used for type declarations or as the element type of an array
[ERROR] final var found = repositoryInstance().findAllBy...(' ', Pageable.unpaged());
[ERROR] ^
I tried with following execution and got no luck.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<configuration>
</configuration>
<executions>
<execution>
<id>default-test-aggregate-no-fork</id>
<configuration>
<source>${maven.compiler.testSource}</source>
</configuration>
</execution>
</executions>
</plugin>