解决:You have to use a classifier to attach supplemental artifacts to the project instead of replacing them,jenkins发版[WARNING] JAR will be empty - no content was marked for inclusion!

  • 背景
    • 起因
    • 排查过程
    • 解决问题

背景

因为最近是新项目的开发,所以环境特别的不稳定,经常出各种错误,这次记录一下,帮助一下可能帮助到的伙计们

起因

在21年4月22号的时候,我突然发现我发版发不了了,发版报错:[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default-jar) on project biz-payment: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them. -> [Help 1]
经过我向上排查,定位到了报错的模块名。

再往上定位发现有一个警告提示:[WARNING] JAR will be empty - no content was marked for inclusion!

排查过程

  1. 首先想到的就是百度,先百度了报错提示的【You have to use a classifier to attach supplemental artifacts to the project instead of replacing them】,都是让在打包插件那里加配置,参数,比方加package
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><version>3.0.2</version><executions><execution><id>service-jar</id><phase>package</phase><goals><goal>jar</goal></goals><configuration><classifier>bak</classifier> <!-- 生成deploy-0.0.1-SNAPSHOT-bak.jar --><classesDirectory>${project.build.directory}/webservice/</classesDirectory></configuration></execution></executions>
</plugin>

或者设置bak,发现都没有用

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><version>3.0.2</version><executions><execution><id>service-jar</id><phase>package</phase><goals><goal>jar</goal></goals><configuration><classifier>bak</classifier> <!-- 生成deploy-0.0.1-SNAPSHOT-bak.jar --><classesDirectory>${project.build.directory}/webservice/</classesDirectory></configuration></execution></executions>
</plugin>
  1. 百度warning的 JAR will be empty - no content was marked for inclusion。都是说是因为模块里面没有内容,导致报错的,后面我尝试在提示报错的模块加了一个test.java的内容。果然可以正常编译,到下一个空模块才报错,但是因为模块比较多,我不可能每个都去加,比较费时间,加上之前是没有问题的。就是22号之后才有问题的,上次成功发版是在20号。
  2. 我打算对比一下20-22号的代码,看看是否有改动pom文件之类的,导致发版不成功,对比中,以当时的想法是并没有发现有调整打包相关插件
  3. 最后只能用最笨的办法,对比上一次成功的发版,和本次失败的jenkins发版日志有什么不同,最后真让我发现了问题,成功和失败的发版,maven插件的版本号不同
    失败:

    成功:

    这下就有了明确的目标。
  4. 这时候再去看pom文件的依赖,发现之前同事为了解决一个问题,引入了
    <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.2.5.RELEASE</version><relativePath/></parent>

点进去看了一下版本号发现和失败的maven插件一直,所以至此定位到是版本的问题。

解决问题

1、第一种方法就是将每一个模块都填充一个test.java。就是比较耗费时间
2、第二种方法,既然是版本的问题,那我们就替换版本号就完了,但是发现引入的是parent的标签,并不能通过标签去排除再重新引入。谷歌,百度查了一些资料。最后是将注释掉

    <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.2.5.RELEASE</version><relativePath/></parent>

加入:

<dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>1.5.4.RELEASE</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId><version>2.2.5.RELEASE</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement>

至此问题解决。
有问题欢迎伙计们留言讨论,不对的地方也欢迎伙计们指出。

转载请注明出处

解决jenkins发版报错:JAR will be empty - no content was marked for inclusion相关推荐

  1. npm发版报错(404)

    解决方法:使用了npm淘宝镜像导致连接不上https://registry.npmjs.org.修改.npmrc文件内容为registry=http://registry.npmjs.org/.再次发 ...

  2. 解决python发邮件报错(554, 'DT:SPM 163 smtp11,D8CowA..

    报错信息如下: 将发送人邮箱也加入收件人地址中即可解决报错. 更改之前代码: import smtplib from email.mime.text import MIMEText from emai ...

  3. 关于发邮件报错535 Error:authentication failed解决方法

    关于发邮件报错535 Error:authentication failed解决方法 参考文章: (1)关于发邮件报错535 Error:authentication failed解决方法 (2)ht ...

  4. Jenkins安装插件报错解决方法

    Jenkins安装插件报错解决方法 1.报错场景 2.场景分析 3.问题解决(不一定能全解决,看运气) 1.报错场景 按正常方式安装完Jenkins后安装插件会报错如下: // An highligh ...

  5. Jenkins发版常见问题:ERROR: Exception when publishing, exception message [Failure]

    Jenkins 报错日志: ERROR: Exception when publishing, exception message [Failure] Build step 'Send build a ...

  6. jenkins构建项目报错:java:[17,37] package xx.xx.xxx does not exist

    场景描述 今天遇到了一个很奇怪的问题,在IDEA运行正常的项目,发布到jenkins就会报错: [ERROR] COMPILATION ERROR : [INFO] ----------------- ...

  7. x-http-wrapper: 如何解决每次发版时,修改http相关代码造成的错误!(Android、iOS、h5)...

    其实是我做了个开源工具(^__^),拿出来给大家鉴赏下,欢迎大家提意见 项目:github.com/xuyt11/x-ht- 欢迎关注和star . 功能:这是一个http相关代码的创建工具. 现在我 ...

  8. jenkins 远程启动tomcat报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

    异常现象: jenkins 远程启动tomcat报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 解决 ...

  9. (已解决)wamp + Apache报错:出现403Forbidden You don't have permission to access / on this server.

    文章目录 `解决办法:` `*** `附件 · 延伸阅读 · 参考: 解决办法: 注意: 案例环境:win7 x64 或 win10 仅仅只需要修改apache配置文件httpd.conf 即可. 上 ...

最新文章

  1. python package_Python之package、module
  2. Angularjs 开始之Hello world
  3. ubuntu中关闭防火墙
  4. 流量一天一个台阶,谈映客直播服务端架构优化之路
  5. JXTA中定义自己的成员服务
  6. 创建可维护的自动化验收测试
  7. 卡方检验详解分析与实例
  8. pdf 转图片 php,php如何实现pdf转换成图片
  9. windows 远程桌面无法连接的问题
  10. DVB-S2 DVB-S2X DVB-DSNG 发射机 接收机FPGA IP
  11. vue 后台翻译_vue国际化 自动百度翻译,优先本地语言库
  12. python实现动态壁纸_70 行 python 代码实现壁纸批量下载
  13. 我的家乡潍坊HTML静态网页 学生个人网页设计作品 学生家乡网页模板 简单个人主页成品
  14. windows10下面 Prolific USB转串口没法使用的解决
  15. go 源码工具解析-英文单复数变化 Inflection
  16. 【520表白日】程序员如何表白吗?程序员表白教程送给你!
  17. linux 无法创建文件,无法创建文件系统以及无法创建PV时怎么办?
  18. MySQL在线环境,[MySQL FAQ]系列 — 线上环境到底要不要开启query cache
  19. js -- 车牌号对应的归属地js文件
  20. ES集群搭建主机规划

热门文章

  1. 服务器卡logo显示2f,战争机器4卡LOGO界面解决办法
  2. 一文读懂循环冗余校验(CRC)原理
  3. 远程链接linux桌面的软件,远程linux桌面软件
  4. Compilation failure:错误: 找不到符号
  5. 无法启动此程序,因为计算机中丢失api-ms-win-crt-runtime-l1-1-0.dll。尝试重新安装该程序以解决此问题。
  6. 数据仓库(二) 数仓理论(重点核心)
  7. Nginx stream 配置代理(Nginx TCP/UDP 负载均衡)
  8. 【数据库】Redis
  9. raid功能中spanning和striping模式有什么区别?
  10. 【方法/函数】 矩阵相乘