Maven Pom 文件中的隐式依赖导致Jar冲突
来源:互联网 发布:淘宝刷到单被骗咋追回 编辑:程序博客网 时间:2024/05/21 09:42
<span style="font-family:文泉驿等宽微米黑;font-size:14px;line-height:21px">首先在pom.xml中添加:</span><div><pre name="code" class="prettyprint linenums prettyprinted" style="font-size:13px; font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word; background-color:rgb(247,247,249); padding:10px; border:1px solid rgb(225,225,232)"><div class="linenums" style="color:rgb(30,52,123); margin-top:0px; margin-bottom:0px; padding-left:0px"><div class="L0" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="tag" style="color:#0088;"><reporting></span></code></div><div class="L1" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><plugins></span></code></div><div class="L2" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><plugin></span></code></div><div class="L3" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><groupId></span><span class="pln" style="color:#48484c;">org.apache.maven.plugins</span><span class="tag" style="color:#0088;"></groupId></span></code></div><div class="L4" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><artifactId></span><span class="pln" style="color:#48484c;"> maven-project-info-reports-plugin </span><span class="tag" style="color:#0088;"></artifactId></span></code></div><div class="L5" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"></plugin></span></code></div><div class="L6" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"></plugins></span></code></div><div class="L7" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="tag" style="color:#0088;"></reporting></span></code></div></div>
如果用的是eclipse,那就用run as-build-在Goals那个框框里输入:project-info-reports:dependencies,如果实在dos环境下,就mvn project-info-reports:dependencies。然后就会在target的文件夹下,生成一个site文件夹,里边有个dependency.html,进去就能看到详细的依赖的信息。
或者直接在eclipse中打开pom.xml文件
会看到打开的窗口中有一个dependency hie开头的选项卡。
这个选择卡页面<span style="color:#ff0000;">左半部分显示了详细的jar包依赖树</span>。右半部分则是maven将会下载的jar包。
比如我们看到<span style="color:#ff0000;">右半部分</span>有2个asm的jar,版本不同。现在需要排除其中低版本的jar(比如xwork-core下的某个jar依赖的asm版本相对较低,不一定说是xwork-core依赖,而是它的依赖的依赖,即多重依赖的asm都是可以的)
<div><pre name="code" class="prettyprint linenums prettyprinted" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word; background-color:rgb(247,247,249); padding:10px; border:1px solid rgb(225,225,232)"><div class="linenums" style="color:rgb(30,52,123); margin-top:0px; margin-bottom:0px; padding-left:0px"><div class="L0" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="tag" style="color:#0088;"><dependency></span></code></div><div class="L1" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><groupId></span><span class="pln" style="color:#48484c;">org.apache.struts.xwork</span><span class="tag" style="color:#0088;"></groupId></span></code></div><div class="L2" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><artifactId></span><span class="pln" style="color:#48484c;">xwork-core</span><span class="tag" style="color:#0088;"></artifactId></span></code></div><div class="L3" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><version></span><span class="pln" style="color:#48484c;">${struts.version}</span><span class="tag" style="color:#0088;"></version></span></code></div><div class="L4" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><exclusions></span></code></div><div class="L5" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><exclusion></span></code></div><div class="L6" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><artifactId></span><span class="pln" style="color:#48484c;">asm</span><span class="tag" style="color:#0088;"></artifactId></span></code></div><div class="L7" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"><groupId></span><span class="pln" style="color:#48484c;">asm</span><span class="tag" style="color:#0088;"></groupId></span></code></div><div class="L8" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"></exclusion></span></code></div><div class="L9" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="pln" style="color:#48484c;"></span><span class="tag" style="color:#0088;"></exclusions></span></code></div><div class="L0" style="color:rgb(190,190,197); line-height:18px; padding-left:0px; list-style-type:none"><code class="language-xml" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; word-wrap:break-word"><span class="tag" style="color:#0088;"></dependency></span></code></div></div>
以后该如何解决这种类似的问题呢。eclipse提供了对隐式依赖jar包的查看功能:在eclipse中打开一个pom文件,在Dependency Hierarchy的Tab页中,就可以查看当前pom文件中显示声明的jar包,及这些显示声明的jar中隐式引入的依赖jar包。
这样就可以查看有哪些隐式的依赖jar会导致jar包冲突了。
0 0
- Maven Pom 文件中的隐式依赖导致Jar冲突
- Maven Pom 文件中的隐式依赖导致Jar冲突
- Maven Pom 文件中的隐式依赖导致Jar冲突
- Maven的Pom文件中的隐式依赖导致Jar包冲突的问题
- 如何解决pom文件中的jar包版本依赖冲突
- Maven的隐式依赖导致Jar包冲突的问题
- pom文件中加入依赖导致冲突的问题
- maven 排除第三方jar包中pom文件中的依赖引用包
- Maven 隐式依赖包冲突导致程序报错
- maven--pom文件搜索依赖的jar包
- Maven资源库pom文件引入依赖jar包的
- springmvc 依赖的jar包 maven的pom.xml文件
- 解决pom文件依赖冲突
- maven项目中的pom文件oracle的依赖报错
- 怎样解决maven项目中依赖的jar包和tomcat中的jar包的冲突
- maven项目pom文件(3)-将项目依赖的jar拷贝到指定文件夹
- Maven解决jar包依赖冲突
- 解决jar包冲突,检查maven依赖
- CentOS6.4下安装MySql
- 码农路,渐行渐远
- iOS初学快捷键
- 数据库第二范式
- 文章标题
- Maven Pom 文件中的隐式依赖导致Jar冲突
- [俄勒冈大学]养成Python写作习惯
- Codeforces Round #338 (Div. 2)B. Longtail Hedgehog解题报告
- java中static{}块
- mybatis常用配置——resultMap
- [R] R package "benchmark"
- mysql---逻辑和数据库设计及权限
- GitHub-入门
- [学习笔记-Android]自用签到工具(一)