java /
正文
maven打包工具类报错 Unable to find main class
2024-01-13 23:29
694 浏览
评论(0)
字体大小:
错误: 在打包工具类是报错 Unable to find main class
原因: 是工具类模块 找不到 启动类 main函数, 而工具类的作用只是共其他模块类调用, 不需要启动类,
经检查 工具类模块的 pom.xml 发现引用了springboot打包插件 spring-boot-maven-plugin
插件
项目里面包含了某些工具类的模块,而工具类模块是不需要我们启动的,只是提供给其他接口服务引用而已,不需要启动就意味着 没有main启动类,但是父工程的pom文件却引用了 springboot打包插件 spring-boot-maven-plugin,即:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
所以在打包的时候mvn会扫描所有的依赖模块,如果发现某个模块下面没有main启动类,就会报错。
解决: 这里在工具类的pom.xml 里把 spring-boot-maven-plugin
的引用去掉 再便宜即可
本文发布于程序达人 ,转载请注明出处,谢谢合作
有 0 人认为有用
0 评论
共同学习,写下你的评论
相关热点文章推荐
SpringBoot 2.0 报错: Failed to configure a DataSource: 'url' attribute is not specified and no embe...
程序达人 - chengxudaren.com
一个帮助开发者成长的社区
相关文章