Error message
2023-02-14 14:28:07.198 INFO 15724 --- [ main] com.longyi.ruiji.RuiJiApplication : Starting RuiJiApplication using Java 19.0.2 on 龙一 with PID 15724 (**\RuiJi TakeOut\target\classes started by LongYi in **\RuiJi TakeOut)
2023-02-14 14:28:07.200 INFO 15724 --- [ main] com.longyi.ruiji.RuiJiApplication : No active profile set, falling back to default profiles: default
2023-02-14 14:28:07.280 WARN 15724 --- [ main] ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [**\RuiJi TakeOut\target\classes\com\longyi\ruiji\RuiJiApplication.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 63
2023-02-14 14:28:07.295 ERROR 15724 --- [ main] o.s.boot.SpringApplication : Application run failed
Project context and problem analysis
When working on the St. Regis takeaway project, an error was reported when starting the startup project when building the spring project under maven. An error is reported after only writing one line of log code. It is speculated that it may be a configuration error.
After investigation: It is found that if the properties tag in the Pom file contains the following custom quantities, an error will be reported.
<properties>
<java.version>1.9</java.version>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
It is understood that the following attribute values are used to set the Java compiler version in Maven, and it is not clear why an error is reported.
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
Solution
Comment out the above two property values.