Unable to find a single main class from the following candidates

简介: 关于start-class,spring boot官方手册是这么说明的: The plugin rewrites your manifest, and in particular it manages the Main-Class and Start-Class entries, so if ...

关于start-class,spring boot官方手册是这么说明的:

The plugin rewrites your manifest, and in particular it manages the Main-Class and Start-Class entries, so if the defaults don't work you have to configure those there (not in the jar plugin). The Main-Class in the manifest is actually controlled by the layout property of the boot plugin, e.g.

<build>
  ...
  <plugins>
    ...
    <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>1.4.0.RELEASE</version> <configuration> <mainClass>${start-class}</mainClass> <layout>ZIP</layout> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> ... </plugins> ... </build>

所以,当你的默认方式不好用的时候,在properties中,加入一个start-class的属性,用于告诉spring boot maven plugin哪个类是入口类即可。



文/BeeNoisy(简书作者)
原文链接:http://www.jianshu.com/p/b521f819b06a
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。

 

相关文章
|
小程序 开发者
微信小程序:引入工具库lodash
微信小程序:引入工具库lodash
1627 0
微信小程序:引入工具库lodash
|
3月前
|
Ubuntu 关系型数据库 MySQL
Ubuntu 22.04.1上安装MySQL 8.0及设置root密码的注意事项
这些是在Ubuntu 22.04.1 系统上安装MySQL 8.0 及设置root密码过程中必须考虑的关键点。正确的遵循这些步骤可确保MySQL的安装过程既顺利又安全。
739 20
|
Java Apache
java依赖冲突解决问题之NoClassDefFoundError异常如何解决
java依赖冲突解决问题之NoClassDefFoundError异常如何解决
|
7月前
|
人工智能 Kubernetes 安全
Nacos 3.0 正式发布:MCP Registry、安全零信任、链接更多生态
Nacos 3.0正式发布,作为云原生时代的基础设施级产品,不仅提升了技术能力,还以更高效、安全的方式帮助用户构建云原生AI应用架构。此次更新重点包括:升级MCP Registry,支持多种类型注册与动态管理;增强安全架构,默认开启鉴权并支持零信任方案;扩展多语言生态,覆盖Python、GoLang、Rust等主流开发语言;提供Nacos-MCP-Router实现MCP动态发现与自动安装。此外,3.0版本改进了安全部署架构,加强K8S生态同步,并推出实验性功能如分布式锁和服务配置模糊订阅。Nacos致力于简化微服务管理和AI应用开发,欢迎加入社区共建!
1252 43
|
11月前
|
JSON fastjson 数据格式
com.alibaba.fastjson.JSONException:expect':'at 0 ,actual = 是什么导致的?
com.alibaba.fastjson.JSONException:expect':'at 0 ,actual = 是什么导致的?
2106 3
|
前端开发 Java UED
Java中的同步与异步编程详解
Java中的同步与异步编程详解
|
Prometheus 监控 Cloud Native
Java 服务挂掉,服务器异常宕机问题排查
Java 服务挂掉,服务器异常宕机问题排查
2682 1
|
Java 微服务 Spring
Spring Boot中获取配置参数的几种方法
Spring Boot中获取配置参数的几种方法
1302 2
|
SQL 关系型数据库 Java
分库分表:中间件方案对比
分库分表:中间件方案对比
3366 85
分库分表:中间件方案对比