Closed
Description
I wrote a spring application with multiple main classes. When I try to run it as follows:
mvn spring-boot:run \
-Dspring-boot.run.profiles=profile2 \
-Dspring-boot.run.main-class=com.example.demo.DemoApplication2
I get this error:
Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.1.5:run failed: Unable to find a single main class from the following candidates [com.example.demo.DemoApplication2, com.example.demo.DemoApplication]
If I remove the following from my pom.xml
:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<relativePath/>
</parent>
then it works! seems like a bug.