springboot多模块打包报错问题根因分析:Unable to find main class
问题背景:
项目结构为springboot多模块,其中有四个模块bean、utils、user、ems,其中user和ems模块为主程序,包含启动类,其他两个模块为其服务,提供依赖

问题分析:
查看utils和bean模块的目录结构,发现里边添加了打包插件,但是没有主启动类,所以插件在打包可执行jar的时候找不到主启动类报错!
通过执行mvn package也可以发现,其实普通的jar包已经存在,可执行的jar包只有1kb,是无法可用的。

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
</plugins>
</build>
总结:
对于多模块的springboot项目
如果只是提供依赖,打包成普通jar包就可以了,不需要可执行的jar包,因此就不要springboot打包插件和主启动类,相当于该模块为一个普通的maven项目
如果即需要普通的jar,也需要可执行的jar,就需要添加打包插件,并且增加springboot主启动类,然后就打包成两个jar包
springboot多模块打包报错问题根因分析:Unable to find main class的更多相关文章
- webpack 打包报错:One CLI for webpack must be installed. These are recommended choices, delivered as separate packages
webpack 打包报错: One CLI for webpack must be installed. These are recommended choices, delivered as sep ...
- LoadXml 加载XML时,报错:“根级别上的数据无效。 行1,位置1“
==XML=================================== <?xml version="1.0" encoding="utf-8" ...
- 新建SpringBoot项目运行页面报错Whitelabel Error Page This application has no explicit mapping for /error, so yo
新建SpringBoot项目运行页面报错Whitelabel Error Page This application has no explicit mapping for /error, so yo ...
- springboot 启动的时候报错 Error creating bean with name 'solrClient'
springboot 启动的时候报错: org.springframework.beans.factory.BeanCreationException: Error creating bean wit ...
- 解决xcode10打包报错:That command depends on command in Target ‘xxx’:scrpit phase"[CP] Copy Pods Resources"
问题:使用xcode10打包报错,提示 error:Multiple commands produce ‘xxxx/xxx.app’ 1)Target ‘xx’ has create director ...
- maven install 打包 报错 Cannot run program "gpg.exe": CreateProcess error
打包报错, mvn install后加上参数-Dgpg.skip,例如:mvn install -Dgpg.skip 即可解决. 我们也可以去掉 这个 插件 <plugin> ...
- python 导入模块的坑。为什么整个项目能运行,单独运行某个文件模块就报错?多层目录不同文件夹怎么导入?
一些文章介绍了python不同目录怎么导入问题,但py文件运行起点却从来没有文章说过!这是相当重要的!! 这个连接是网上99%的所讲的导入 https://www.cnblogs.com/luoye0 ...
- vue-cli 打包报错:Unexpected token: punc (()
vue-cli 打包报错: ERROR in static/js/vendor.ed7d2353f79d28a69f3d.js from UglifyJs Unexpected token: punc ...
- [one day one question] webpack 打包报错 Cannot assign to read only property 'exports' of object '#<Object>'
问题描述: webpack 打包报错 Cannot assign to read only property 'exports' of object '#<Object>',这怎么破? 解 ...
- Mac Angular打包报错xcode-select: error: tool 'xcodebuild' requires Xcode
Mac Angular打包报错: Error: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer ...
随机推荐
- Python异步编程之yield from
yield from 简介 yield from 是Python3.3 后新加的语言结构,可用于简化yield表达式的使用. yield from 简单示例: >>> def gen ...
- 可用性库存(CO09)排除库存地点增强
1.业务需求 1.1.业务背景 1.2.对应方案: 2.测试BAPI 首先运行事务代码CO09,查看结果 运行BAPI_MATERIAL_AVAILABILITY 3.增强实现 3.1.增强思路 3. ...
- 用 three.js 绘制三维带箭头线 (线内箭头)
在LineMaterial.js基础上修改的ArrowLineMaterial.js代码: /** * @author WestLangley / http://github.com/WestLang ...
- 【ToolChains】| CMake 技巧
判断 CMake 编译环境 编译类型 CMAKE_BUILD_TYPE 可取值为:Debug, Release, RelWithDebInfo, MinSizeRel 等预设值 if (CMAKE_B ...
- Hbase结构和原理
Hbase是什么? HBase是一种构建在Hadoop HDFS之上的分布式.面向列的存储系统.在需要实时读写.随机访问超大规模数据集时,可以使用HBase. HBase依赖Zookeeper,默认 ...
- 【Qt】开源一键代码开光神器,一行代码给你的项目施加祝福,减少Bug
年底啦,没什么项目,想摸鱼划水没见到什么好玩的东西,看到有人分享这个,直接做个库来玩下,之后说不定会嵌到公司的项目里面去.... 效果如下,佛光普照! 输入也只需要一行命令 magic_spells: ...
- freeswitch-1.10.7性能测试
概述 freeswitch 是一款简单好用的开源软交换平台. freeswitch-1.10.7是比较新的版本,使用时间比较短,需要一个可参考的性能指标,作为实际使用过程中的配置指导. 环境 cent ...
- java进阶(21)--集合基础
一.基本概念 1.数组其实是一个集合,二集合是一个容器 2.集合不能直接存储基本数据类型,也不能存java对象,存储的是引用数据类型 list.add(100); //自动装箱Integer 3.ja ...
- Dubbo入门1:Spirngboot+Dubbo2.6.0整合
整合springboot+dubbo2.6.0 demo 本文简要说明了springboot和dubbo整合的配置文件的写法 目录结构 整体目录 如下图所示:整体项目是一个父子工程,common作为一 ...
- Prime Time - 介绍
Prime Time是对timing进行分析 Prime Time使用的是STA方法进行分析 工具会有更新,但是核心内容是不变的 Prime Time(intro to STA) 没有PT工具的时候, ...