简体   繁体   中英

Building maven project fails on invalid target version 17.0.5

I am upgrading application from Java 11 to Java 17.0.5

In my java project, I have set below properties

<properties>
        <maven.compiler.source>17.0.5</maven.compiler.source>
        <maven.compiler.target>17.0.5</maven.compiler.target>  
      <java.version>17.0.5<java.version>                                            
</properties>   

                                                                                                         

On building the project, it failed saying

invalid target release 17.0.5

java -version prints

"Java version 17.0.5"

and mvn -version prints

Java 17.0.5

Please advise

The version is only the major version. So you have to specify only 17 as version

<properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>  
    <java.version>17<java.version>                                            
</properties>    

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM