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:treemvn 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重复引用导致的诡异问题排查的更多相关文章

  1. json中$ref对象重复引用问题

    FastJson提供了SerializerFeature.DisableCircularReferenceDetect这个序列化选项,用来关闭引用检测.关闭引用检测后,重复引用对象时就不会被$ref代 ...

  2. com.android.dex.DexException: Multiple dex files define(jar包重复引用) 错误解决

    前段时间开始转入Android studio,不料果真使用时候遇到些错误,在此记下! 出现这个错误往往是在libs目录下有个jar包,然后在gradle文件中又引用了,即: 共同引用了. 解决方法: ...

  3. Fastjson-fastjson中$ref对象重复引用问题:二

    import java.util.ArrayList; import java.util.List; import com.alibaba.fastjson.JSON; import com.alib ...

  4. Fastjson-fastjson中$ref对象重复引用问题

    当你有城市数据,你需要按国内.国际.热门城市分成数组的形式给出并输出为json格式. 第一个问题,你的数据格式,需要按字母类别划分,比如: "int": { "C&quo ...

  5. Fastjson.tojsonString中$ref对象重复引用问题

    import java.util.ArrayList; import java.util.List; import com.alibaba.fastjson.JSON; import com.alib ...

  6. (六)Net Core项目使用Controller之一 c# log4net 不输出日志 .NET Standard库引用导致的FileNotFoundException探究 获取json串里的某个属性值 common.js 如何调用common.js js 筛选数据 Join 具体用法

    (六)Net Core项目使用Controller之一 一.简介 1.当前最流行的开发模式是前后端分离,Controller作为后端的核心输出,是开发人员使用最多的技术点. 2.个人所在的团队已经选择 ...

  7. 解Bug之路-记一次中间件导致的慢SQL排查过程

    解Bug之路-记一次中间件导致的慢SQL排查过程 前言 最近发现线上出现一个奇葩的问题,这问题让笔者定位了好长时间,期间排查问题的过程还是挺有意思的,正好博客也好久不更新了,就以此为素材写出了本篇文章 ...

  8. 解决FastJson中"$ref重复引用"的问题方法

    对象的引用重复使用造成了重复引用问题,Fastjson默认开启引用检测将相同的对象写成引用的形式: 1 2 3 4 5 {"$ref": "$"} // 引用根 ...

  9. rabbitmq 重复ACK导致消息丢失

    rabbitmq 重复确认导致消息丢失 背景 rabbitmq 在应用场景中,大多采用工作队列 work-queue的模式. 在一个常见的工作队列模式中,消费者 worker 将不断的轮询从队列中拉取 ...

随机推荐

  1. 使用Runnable接口创建线程

    实现Runnable接口的类必须使用Thread类的实例才能创建线程.通过Runnable接口创建线程分为两步: 1.将实现Runnable接口的类实例化. 2.建立一个Thread对象,并将第一步实 ...

  2. Codeforces Round #312 (Div. 2) E. A Simple Task 线段树

    E. A Simple Task 题目连接: http://www.codeforces.com/contest/558/problem/E Description This task is very ...

  3. python使用递归实现一个分形图形

    代码如下: import turtle def main(): t = turtle.Turtle() t.hideturtle() t.speed(10) level = 12 fract(t,-8 ...

  4. CentOS下KVM网卡设置成网桥时获取镜像端口的流量

    首先,网桥配置好之后就能实现一个简单的交换机,而交换机的特点就是MAC地址学习,那么KVM的网卡设置成网桥之后,也就是相当于连接到了交换机上. 此时如果要实现在二层交换机或三层交换机做端口镜像,并把这 ...

  5. CentOS下的apache配置支持php

    修改Apache的配置文件httpd.conf(vi /etc/httpd/conf/httpd.conf) DirectoryIndex index.html index.php #添加index. ...

  6. Unity中Web.Config文件的配置与调用

    在上一篇文章“Unit简单依赖注入”我们可以实现构造对象和被依赖对象之间的 松耦合,使我们的抽象层(Player)能够保持稳定,但是在并没有把客户类和Player类之间彻底解耦,即当我们不想使用MP3 ...

  7. Technical Information ARM-related JTAG / SWD / SWV / ETM Target Interfaces

    https://www.computex.co.jp/eg/products/pdf/technical_pdf/arm_if01_gijutsu_eng.pdf

  8. USB2.0 速度识别--区分低速-高速-全速

    USB2.0是向下兼容USB1.X的,即USB2.0支持高速,全速,低速的USB设备 (HIGH-SPEED,FULL-SPEED,LOW-SPEED),而USB1.X不支持高速设备. 因此如果高速设 ...

  9. the difference between an embOS interrupt and a zero latency interrupt

    the difference between an embOS interrupt and a zero latency interrupt is the interrupt priority lev ...

  10. oracle 11g wm_concat 、 listagg 函数的使用(合并数据)

    方法一 wn_concat() 函数 1.把以下图中Name一样的数据合并为一条,而且NO的值要这样显示如 C.1,C.2 2.实现这种效果的操作如下,先把Name的值进行分组(group by),再 ...