Execution default of goal
org.springframework.boot:spring-boot-maven-plugin:1.0.1.RELEASE:repackage
failed:
Unable to find a single main class from the following candidates
我的项目有多个具有main
方法的类。我如何告诉Spring Boot Maven插件它应该使用哪些类作为主类?
发布于 2014-04-22 18:41:22
在pom中添加start类:
<properties>
<!-- The main class to start by executing java -jar -->
<start-class>com.mycorp.starter.HelloWorldApplication</start-class>
</properties>
或
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.mycorp.starter.HelloWorldApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
发布于 2015-06-25 11:19:16
对于使用Gradle (而不是Maven)的用户:
springBoot {
mainClass = "com.example.Main"
}
发布于 2014-07-07 16:22:48
如果您不使用spring-boot-starter-parent pom,那么从Spring documentation
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.1.3.RELEASE</version>
<configuration>
<mainClass>my.package.MyStartClass</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
https://stackoverflow.com/questions/23217002
复制相似问题