intelliJ 스프링부트 실행이 안안된다.
C:\Users\user01\.jdks\corretto-17.0.4.1\bin\java.exe -XX:TieredStopAtLevel=1 -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2024.2.3\lib\idea_rt.jar=61616:C:\Program Files\JetBrains\IntelliJ IDEA 2024.2.3\bin" -Dfile.encoding=UTF-8 @C:\Users\user01\AppData\Local\Temp\idea_arg_file1501926487 qsol.digital_water.DigitalWaterApplication
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
at qsol.digital_water.DigitalWaterApplication.main(DigitalWaterApplication.java:16)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 1 more
Process finished with exit code 1
빌드가 안되어 main 클래스를 못찾는거다.
Gradle clean 하고 build 하면 된다고 해서 시도함.
clean 은 잘 지나다고
build 하면 에러
Execution failed for task ':test'.
> Process 'Gradle Test Executor 5' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 10s
7 actionable tasks: 7 executed
test 작업에서 에러 난다고 정확한 원인을 확인 해보자
> ./gradlew test --warning-mode all
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'digital-water'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.3.0.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.3.0
> Dependency requires at least JVM runtime version 17. This build uses a Java 8 JVM.
* Try:
> Run this build using a Java 17 or newer JVM.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 5s
java17 이상의 버전으로 빌드를 실행 해야 한다고 한다
IntelliJ 사용중이라서 설정 확인
IntelliJ IDEA 설정: IntelliJ IDEA 내에서 프로젝트가 사용할 JDK를 명시적으로 설정해 줍니다.
**File (파일) → Project Structure (프로젝트 구조)**로 이동합니다.
SDKs 섹션에서 Java 17 이상의 JDK가 등록되어 있는지 확인합니다.
Project 섹션에서 Project SDK를 Java 17 이상으로 선택합니다.
IntelliJ Gradle 설정 확인
IntelliJ가 빌드를 실행할 때 특정 JDK를 사용하도록 설정할 수도 있습니다.
File (파일) → Settings (설정) (macOS는 IntelliJ IDEA → Preferences)로 이동합니다.
Build, Execution, Deployment → Build Tools → Gradle로 이동합니다.
Gradle JVM 항목을 Java 17 이상으로 변경합니다.
설정은 잘 되어 있어서 변경하진 않았다.
./gradlew test --stacktrace
A problem occurred configuring root project 'digital-water'. > Could not resolve all artifacts for configuration ':classpath'. > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.3.0. > Dependency requires at least JVM runtime version 17. This build uses a **Java 8 JVM**.
계속 JVM 버전을 맞추라고 만 한다.
IntelliJ java 업데이트 알림 뜨길래 17.0.4 -> 17.0.17로 업그레이드 했다.
intelliJ Settings -> build -> gradle 에서
build and run using 과 run test using 을 Gradle 에서 intelliJ IDEA 로 변경해보았다.
그래도 빌드 안됨.
IntelliJ 껏다가 다시 실행했다.
다시 재빌드
오전 10:38:03: Executing 'build'...
Download https://services.gradle.org/distributions/gradle-8.8-bin.zip, took 26 s 726 ms
Starting Gradle Daemon...
먼가를 다시 받으면서 빌드가 실행된다.
오류 수정하고 다시 빌드
오전 11:06:05: Executing 'build'...
> Task :compileJava
> Task :processResources UP-TO-DATE
> Task :classes
> Task :resolveMainClassName
> Task :bootJar
> Task :jar
> Task :assemble
> Task :compileTestJava UP-TO-DATE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2025-12-02T11:06:47.592+09:00 INFO 56308 --- [ionShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler : Stopping...
2025-12-02T11:06:47.593+09:00 INFO 56308 --- [ionShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler : BrokerAvailabilityEvent[available=false, SimpleBrokerMessageHandler [org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry@7231c423]]
2025-12-02T11:06:47.593+09:00 INFO 56308 --- [ionShutdownHook] q.d.websocket.WebSocketEventListener : Broker availability event: false
2025-12-02T11:06:47.593+09:00 INFO 56308 --- [ionShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler : Stopped.
2025-12-02T11:06:47.631+09:00 INFO 56308 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2025-12-02T11:06:47.634+09:00 INFO 56308 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2025-12-02T11:06:47.681+09:00 INFO 56308 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
> Task :test
> Task :check
> Task :build
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 42s
7 actionable tasks: 5 executed, 2 up-to-date
오전 11:06:48: Execution finished 'build'.
결론은 IntelliJ java 설정 잘 확인하고, 그래도 안되면 껏다 켜보는거다.
