问题背景:

项目结构为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的更多相关文章

  1. 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 ...

  2. LoadXml 加载XML时,报错:“根级别上的数据无效。 行1,位置1“

    ==XML=================================== <?xml version="1.0" encoding="utf-8" ...

  3. 新建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 ...

  4. springboot 启动的时候报错 Error creating bean with name 'solrClient'

    springboot 启动的时候报错: org.springframework.beans.factory.BeanCreationException: Error creating bean wit ...

  5. 解决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 ...

  6. maven install 打包 报错 Cannot run program "gpg.exe": CreateProcess error

    打包报错, mvn install后加上参数-Dgpg.skip,例如:mvn install -Dgpg.skip   即可解决. 我们也可以去掉 这个 插件   <plugin>    ...

  7. python 导入模块的坑。为什么整个项目能运行,单独运行某个文件模块就报错?多层目录不同文件夹怎么导入?

    一些文章介绍了python不同目录怎么导入问题,但py文件运行起点却从来没有文章说过!这是相当重要的!! 这个连接是网上99%的所讲的导入 https://www.cnblogs.com/luoye0 ...

  8. vue-cli 打包报错:Unexpected token: punc (()

    vue-cli 打包报错: ERROR in static/js/vendor.ed7d2353f79d28a69f3d.js from UglifyJs Unexpected token: punc ...

  9. [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>',这怎么破? 解 ...

  10. Mac Angular打包报错xcode-select: error: tool 'xcodebuild' requires Xcode

    Mac Angular打包报错: Error: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer ...

随机推荐

  1. 【vue3】创建vue3项目的两种方式 setup函数 ref和reactive 计算和监听属性 生命周期 hooks toRefs script setup的作用和lang=ts 后台管理模板

    目录 昨日回顾 今日内容 1 vue3介绍 2 创建vue3项目的两种方式 vue-cli创建Vue3项目 Vite创建Vue3项目 Vue3目录结构 Vite的优点 3 setup函数 Vue3创建 ...

  2. C# Task 多任务:C# 扩展TaskScheduler实现独立线程池,支持多任务批量处理,互不干扰,无缝兼容Task

    先上源码: https://gitee.com/s0611163/TaskSchedulerEx     为什么编写TaskSchedulerEx类? 因为.NET默认线程池只有一个线程池,如果某个批 ...

  3. Spring注解@Resource和@Autowired区别对比 (附 Maven 引入方法)

    @Resource 导入方法: <dependency> <groupId>javax.annotation</groupId> <artifactId> ...

  4. AtCoder Regular Contest 119 (ABC题)

    比赛链接:Here A - 119 × 2^23 + 1 注意到 \(2^{60} > 10^{18}\)​ ,所以我们可以直接枚举 \(0\) ~ \(59\) int main() { ci ...

  5. SpringBoot发布https服务

    一.生成SSL证书 1.进入本地jdk的路径 cd D:\Program\jdk1.8.0_77\jre\lib\security cmd窗口生成证书HSoftTiger.keystore到D盘 ke ...

  6. 3 Englishi 词根

    1 -able 能..的:具有...性质的 useable moveable adaptable 2 -al  具有...性质的; 属于...的 personal natural regional - ...

  7. 2 Englishi 词根

    11 mis 错 misuse misfortune misunderstand 12 out 超过: 外 outnumber outspend outdoor 13 over 过度 overprai ...

  8. uni-app项目打包成H5部署到服务器(超详细步骤)

    https://blog.csdn.net/weixin_49577940/article/details/118058899?spm=1001.2101.3001.6650.1&utm_me ...

  9. freeswitch的mod_xml_curl模块动态获取dialplan

    概述 freeswitch是一款简单好用的VOIP开源软交换平台. mod_xml_curl模块支持从web服务获取xml配置,本文介绍如何动态获取dialplan配置. 环境 centos:Cent ...

  10. fusionpbx简介

    概述 fusionpbx是以freeswitch作为底层框架开发而成的开源PBX,在freeswitch的基础上,优化了GUI的易用性. fusionpbx可用作高可用性的单租户或基于域的多租户 PB ...