api重复引用导致的诡异问题排查
api重复引用导致的诡异问题排查
最近一个项目上线前开发环境、测试环境都能正常打包并运行。然而到了准生产环境和生产环境则报一些诡异的错误信息:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project xxx: Compilation failure: Compilation failure:
[ERROR] /data/release/xxx/xxx/src/main/java/com/xxx/testmodel/util/ZipRsaCiph.java:[19,15] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] /data/release/xxx/xxx/src/main/java/com/xxx/testmodel/util/ZipRsaCiph.java:[19,15] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] /data/release/xxx/xxx/src/main/java/com/xxx/testmodel/util/ZipRsaCiph.java:[19,15] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] /data/release/xxx/xxx/src/main/java/com/xxx/testmodel/util/ZipRsaCiph.java:[19,15] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] /data/release/xxx/xxx/src/main/java/com/xxx/testmodel/util/ZipRsaCiph.java:[64,9] BASE64Decoder is internal proprietary API and may be removed in a future release
[ERROR] /data/release/xxx/xxx/src/main/java/com/xxx/testmodel/aop/Author.java:[95,90] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
咋一看莫名其妙,代码怎么找也找不到问题所在。查看代码修改部分,发现是重新引入了一个新的api。
通过mvn dependency:tree发现,同时引用了 test-api:jar:2.0.0 和 test-api:jar:3.12.0 两个版本的api。
而通过mvn dependency:analyze查看的结果为:
[WARNING] Used undeclared dependencies found:
[WARNING] com.xxx.auth:xxx-api:jar:2.0.0:compile
[WARNING] Unused declared dependencies found:
[WARNING] com.xxx.auth:xxx-api:jar:3.12.0:compile
发现并没有引用新的api。
Used undeclared dependencies :指那些在项目中直接使用到的,但没有在POM中配置的依赖。
Unused declared dependencies :供我们参考,这表示那些我们配置了,但并未直接使用的依赖。
后来分析发现是有个第三方 api 引用了相同的api,从而导致这一诡异问题的出现。因而在引用api前可通过:
mvn dependency:tree 和 mvn dependency:analyze 看是否存在重复引用的api,如果存在重复引用的情况可将不需要的版本api排除掉即可。
<dependency>
<groupId>xxx</groupId>
<artifactId>xxx-api</artifactId>
<version>1.0</version>
<exclusions>
<exclusion>
<groupId>test</groupId>
<artifactId>test-api</artifactId>
</exclusion>
</exclusions>
</dependency>
api重复引用导致的诡异问题排查的更多相关文章
- json中$ref对象重复引用问题
FastJson提供了SerializerFeature.DisableCircularReferenceDetect这个序列化选项,用来关闭引用检测.关闭引用检测后,重复引用对象时就不会被$ref代 ...
- com.android.dex.DexException: Multiple dex files define(jar包重复引用) 错误解决
前段时间开始转入Android studio,不料果真使用时候遇到些错误,在此记下! 出现这个错误往往是在libs目录下有个jar包,然后在gradle文件中又引用了,即: 共同引用了. 解决方法: ...
- Fastjson-fastjson中$ref对象重复引用问题:二
import java.util.ArrayList; import java.util.List; import com.alibaba.fastjson.JSON; import com.alib ...
- Fastjson-fastjson中$ref对象重复引用问题
当你有城市数据,你需要按国内.国际.热门城市分成数组的形式给出并输出为json格式. 第一个问题,你的数据格式,需要按字母类别划分,比如: "int": { "C&quo ...
- Fastjson.tojsonString中$ref对象重复引用问题
import java.util.ArrayList; import java.util.List; import com.alibaba.fastjson.JSON; import com.alib ...
- (六)Net Core项目使用Controller之一 c# log4net 不输出日志 .NET Standard库引用导致的FileNotFoundException探究 获取json串里的某个属性值 common.js 如何调用common.js js 筛选数据 Join 具体用法
(六)Net Core项目使用Controller之一 一.简介 1.当前最流行的开发模式是前后端分离,Controller作为后端的核心输出,是开发人员使用最多的技术点. 2.个人所在的团队已经选择 ...
- 解Bug之路-记一次中间件导致的慢SQL排查过程
解Bug之路-记一次中间件导致的慢SQL排查过程 前言 最近发现线上出现一个奇葩的问题,这问题让笔者定位了好长时间,期间排查问题的过程还是挺有意思的,正好博客也好久不更新了,就以此为素材写出了本篇文章 ...
- 解决FastJson中"$ref重复引用"的问题方法
对象的引用重复使用造成了重复引用问题,Fastjson默认开启引用检测将相同的对象写成引用的形式: 1 2 3 4 5 {"$ref": "$"} // 引用根 ...
- rabbitmq 重复ACK导致消息丢失
rabbitmq 重复确认导致消息丢失 背景 rabbitmq 在应用场景中,大多采用工作队列 work-queue的模式. 在一个常见的工作队列模式中,消费者 worker 将不断的轮询从队列中拉取 ...
随机推荐
- mybatis generator修改默认生成的sql模板
相关连接: mybatis-generator扩展教程系列 -- 自定义sql xml文件 git项目地址
- InnoDB的锁机制浅析(一)—基本概念/兼容矩阵
InnoDB锁的基本概念 文章总共分为五个部分: InnoDB的锁机制浅析(一)-基本概念/兼容矩阵 InnoDB的锁机制浅析(二)-探索InnoDB中的锁(Record锁/Gap锁/Next-key ...
- MOXA的Nport5600初始密码
今天第一次弄Nport,看了半天手册没找到初始密码,网上也搜不到,按照说明书上想打电话问问,发现根本是空号... 后来灵感一来试了一下,居然是:moxa
- C语言应用操作之文件
文件是C语言中德中的重点,小编在学习C语言基础知识的时候,大多数的输入输出操作是在屏幕上进行的,现在总算在文件学习上感觉到高大上的样纸.在以前数据量很小时,我们通常将信息从键盘在屏幕上进行输入输出的, ...
- BZOJ.4407.于神之怒加强版(莫比乌斯反演)
题目链接 Description 求\[\sum_{i=1}^n\sum_{j=1}^m\gcd(i,j)^K\ \mod\ 10^9+7\] Solution 前面部分依旧套路. \[\begin{ ...
- BZOJ3956: Count
Description Input Output Sample Input 3 2 0 2 1 2 1 1 1 3 Sample Output 0 3 HINT M,N<=3*10^ ...
- Ulipad安装、配置使用教程(附Ulipad下载)
一.安装Ulipad 因为ulipad编辑器使用的是wxpython编写的gui,所以我们需要第三方库wxpython的支持,这里我们先讲一下Ulipad在Windows系统环境下的安装: 1. 确实 ...
- Answer Sheet - Both, Either & Neither
http://www.usingenglish.com/quizzes/answers.php?quiz_id=44 This page displays the answers to the 'Bo ...
- java之jvm学习笔记十三(jvm基本结构) 通俗易懂的JVM 文件,没有之一
http://blog.csdn.net/yfqnihao/article/details/8289363
- 理解 process.initgroups(user, extra_group)
这个函数是对 linux C函数 initgroups() 的包装 node.js 官方文档非常含糊,还是看 linux C函数文档的解释!非常清楚明确. The initgroups() fun ...