언어·프레임워크/Spring Boot
[Spring Boot][Trouble Shooting] gradlew build 실패
DandyNow
2022. 9. 13. 01:06
728x90
반응형
gradlew build
gradlew test는 성공했는데 gradlew build 명령어 실행 시 아래와 같은 에러와 함께 빌드가 실패했다. 프로젝트에 main 클래스가 2개가 있어서 발생한 에러였다.
Microsoft Windows [Version 10.0.19044.1889]
(c) Microsoft Corporation. All rights reserved.
C:\Users\J\Documents\GitHub\spring-boot-webservice-java11\spring-webservice>gradlew build
> Task :bootJarMainClassName FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootJarMainClassName'.
> Unable to find a single main class from the following candidates [com.tistory.postforty.book.SpringWebserviceApplication, com.tistory.postforty.book.springboot.Application]
* 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
BUILD FAILED in 3s
3 actionable tasks: 1 executed, 2 up-to-date
C:\Users\J\Documents\GitHub\spring-boot-webservice-java11\spring-webservice>
build.gradle
build.gradle에 아래 코드를 추가, 메인 클래스를 지정해 주었다.
springBoot {
mainClass = 'com.tistory.postforty.book.springboot.Application'
}
이상의 조치 후 빌드가 성공하였다.
C:\Users\J\Documents\GitHub\spring-boot-webservice-java11\spring-webservice>gradlew build
BUILD SUCCESSFUL in 3s
8 actionable tasks: 3 executed, 5 up-to-date
C:\Users\J\Documents\GitHub\spring-boot-webservice-java11\spring-webservice>
Spring Boot Gradle Plugin Reference Guide
To manage dependencies in your Spring Boot application, you can either apply the io.spring.dependency-management plugin or use Gradle’s native bom support. The primary benefit of the former is that it offers property-based customization of managed versio
docs.spring.io
728x90
반응형