Spring Boot в IntelliJ создается не той версии

Проект реализует версию Spring Boot 2.1.8, хотя в пом указана другая. Пробовала пересобирать проект с разными версиями от 2 до 4, все та же ошибка. Создавала проект через spring initializr У меня джава 17, apache-maven-4.0.0-rc-5-bin пом:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.2.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <url/>
    <licenses>
        <license/>
    </licenses>
    <developers>
        <developer/>
    </developers>
    <scm>
        <connection/>
        <developerConnection/>
        <tag/>
        <url/>
    </scm>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

вывод при запуске приложения:

"C:\Program Files\Eclipse Adoptium\jdk-17.0.16.8-hotspot\bin\java.exe" 
"-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2025.2.3\lib\idea_rt.jar=52286" 
-Dfile.encoding=UTF-8 
-classpath "C:\Users\Admin\demo (3)\out\production\main;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-web-5.1.9.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-context-5.1.9.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\wicket-util-9.0.0.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\wicket-core-9.0.0.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-beans-5.1.9.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\jackson-datatype-jsr310-2.9.9.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\wicket-auth-roles-9.0.0.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\log4j-to-slf4j-2.11.2.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\cglib-nodep-3.3.0.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\tomcat-embed-core-9.0.24.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\commons-fileupload-1.4.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\junit-platform-commons-1.6.2.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\tomcat-embed-websocket-9.0.24.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\snakeyaml-1.23.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\wicket-spring-boot-starter-3.0.4.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\logback-core-1.2.3.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-webmvc-5.1.9.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-boot-starter-2.1.8.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-jcl-5.1.9.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\asm-8.0.1.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\jul-to-slf4j-1.7.28.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\asm-analysis-8.0.1.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\commons-collections4-4.4.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\commons-io-2.6.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-context-support-5.1.9.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\jackson-annotations-2.9.0.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\wicket-request-9.0.0.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\apiguardian-api-1.1.0.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\opentest4j-1.2.0.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-boot-2.1.8.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-boot-starter-web-2.1.8.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\wicket-spring-9.0.0.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-boot-starter-tomcat-2.1.8.RELEASE.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\logback-classic-1.2.3.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\slf4j-api-1.7.25.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\validation-api-2.0.1.Final.jar;
C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\jdk-serializable-functional-1.9.0.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-expression-5.1.9.RELEASE.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-boot-autoconfigure-2.1.8.RELEASE.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\openjson-1.0.12.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\wicket-ioc-9.0.0.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\jackson-core-2.9.9.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\jackson-datatype-jdk8-2.9.9.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-boot-starter-logging-2.1.8.RELEASE.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-core-5.1.9.RELEASE.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\tomcat-embed-el-9.0.24.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\asm-tree-8.0.1.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\javax.annotation-api-1.3.2.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\hibernate-validator-6.0.17.Final.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\jackson-module-parameter-names-2.9.9.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\log4j-api-2.11.2.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\junit-jupiter-engine-5.6.2.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\asm-util-8.0.1.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\junit-platform-engine-1.6.2.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\wicket-spring-boot-context-3.0.4.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\jackson-databind-2.9.9.3.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\classmate-1.3.4.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-aop-5.1.9.RELEASE.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\junit-jupiter-api-5.6.2.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\jboss-logging-3.3.2.Final.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\javax.inject-1.jar;C:\Users\Admin\demo (3)\apache-maven-4.0.0-rc-5-bin\apache-maven-4.0.0-rc-5\spring-boot-starter-json-2.1.8.RELEASE.jar" com.example.demo.DemoApplication


  .   ____          _            __ _ _ /\ / _' __ _ ()_ __  __ _ \ \ \ ( ( )__ | '_ | '| | ' / ` | \ \ \  \/  _)| |)| | | | | || (_| |  ) ) ) )  '  || .|| ||| |_, | / / / / =========||==============|_/=//_// :: Spring Boot ::        (v2.1.8.RELEASE)

2025-12-04 04:34:21.030  INFO 15408 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication on KOMPUTER with PID 15408 (started by Admin in C:\Users\Admin\demo (3))
2025-12-04 04:34:21.032  INFO 15408 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2025-12-04 04:34:21.124  WARN 15408 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException:
 Failed to read candidate component class: file [C:\Users\Admin\demo (3)\out\production\main\com\example\demo\DemoApplication.class]; 
nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: 
file [C:\Users\Admin\demo (3)\out\production\main\com\example\demo\DemoApplication.class];
 nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 61
2025-12-04 04:34:21.300 ERROR 15408 --- [           main] o.s.boot.SpringApplication               : Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: 
Failed to read candidate component class: file [C:\Users\Admin\demo (3)\out\production\main\com\example\demo\DemoApplication.class]; nested exception is org.springframework.core.NestedIOException: 
ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\Users\Admin\demo (3)\out\production\main\com\example\demo\DemoApplication.class]; 
nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 61
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:454) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:316) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:275) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:287) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:242) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) ~[spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[main/:na]Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\Users\Admin\demo (3)\out\production\main\com\example\demo\DemoApplication.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 61
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:57) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:123) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:430) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 20 common frames omitted
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 61
    at org.springframework.asm.ClassReader.<init>(ClassReader.java:184) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.asm.ClassReader.<init>(ClassReader.java:166) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.asm.ClassReader.<init>(ClassReader.java:152) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.asm.ClassReader.<init>(ClassReader.java:273) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:54) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 23 common frames omitted

Process finished with exit code 1

Апдейт: скачала другую версию мавен 3.9.11, пересобрала проект, делала все то же самое, но теперь программа в целом не запускается. Выводит, что не видит библиотеки бут:

C:\Users\Admin\demo\src\main\java\com\example\demo\DemoApplication.java:3:32
java: package org.springframework.boot does not exist
C:\Users\Admin\demo\src\main\java\com\example\demo\DemoApplication.java:4:46
java: package org.springframework.boot.autoconfigure does not exist
C:\Users\Admin\demo\src\main\java\com\example\demo\DemoApplication.java:6:2
java: cannot find symbol
  symbol: class SpringBootApplication
C:\Users\Admin\demo\src\main\java\com\example\demo\DemoApplication.java:10:9
java: cannot find symbol
  symbol:   variable SpringApplication
  location: class com.example.demo.DemoApplication

пом выглядит так:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>4.0.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <url/>
    <licenses>
        <license/>
    </licenses>
    <developers>
        <developer/>
    </developers>
    <scm>
        <connection/>
        <developerConnection/>
        <tag/>
        <url/>
    </scm>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webmvc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webmvc-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


Ответы (1 шт):

Автор решения: Анастасия

Проблема решилась сама собой, настройки мавен по какой-то причине не сохранялись и возвращались не к той версии, позже получилось изменить и все заработало

→ Ссылка