Digking's cave

SpringBoot 오류 해결 ] [ERROR] Failed to execute goal org.springframework.boot:Execution default-cli of goal org.springframework.boot:spring- boot-maven-plugin:2.7.5:run failed: Unable to find a single main class from the following candidates 본문

Spring/Spring 오류해결

SpringBoot 오류 해결 ] [ERROR] Failed to execute goal org.springframework.boot:Execution default-cli of goal org.springframework.boot:spring- boot-maven-plugin:2.7.5:run failed: Unable to find a single main class from the following candidates

디깅 2022. 11. 8. 15:59
728x90

 

오류

Spring Boot 프로젝트 실행 중 다음과 같은 오류가 발생했다.

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.7.5:run (default-cli) on project demo: Execution default-cli of goal org.springframework.boot:spring-
boot-maven-plugin:2.7.5:run failed: Unable to find a single main class from the following candidates [com.example.securingweb.SecuringWebApplication, com.example.demo.DemoApplication]

 

main()이 2개로 설정되어 있어서 maven에서 단일 main class를 찾지 못해서 오류가 발생하였다.

 

해결방법

main을 하나로 유지하거나 혹은 main이 여러개 일 때 기본 main을 pom.xml 내에 설정할 수 있다. 

spring-boot-main-pugin 플러그인 내에 configuration으로 메인이 되는 class를 지정해주면 된다.

 

 

반응형