I think the configurations for java 8 with maven-compiler-plugin and java 17 with maven-compiler-plugin are to be done in different ways.
For java 8 and lower version it is as below,
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
For java 9+ version the configurations are as below,
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
References: