그레이들을 기반으로 스프링 부트 프로젝트 스크립트를 하나하나 작성하다보니 장애하나를 접했다.
$ ./gradlew clean build
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':c-app:bootJar'.
> The value of a manifest attribute must not be null (Key=Start-Class). // (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
BUILD FAILED in 1s
10 actionable tasks: 10 executed
-
Start-Class
눈치가 있는 분이라면 (Key=Start-Class)
항목이 눈에 띌 것이다. 스프링 부트 그레이들 플러그인에서 bootJar
태스크를 실행하는 과정에서 시작 클래스를 찾지 못했다. 이 문제가 발생할 당시에 메인클래스를 작성하지 않았다(혹은 public static void main(String[] args)
메서드가 작성되지 않았을 때 발생).
public class Application {
public static void main(String[] args) {}
}
다음과 같은 형태로 간단한 메인클래스를 작성하면 빌드는 정상적으로 진행된다.