文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

关于Maven依赖冲突解决之exclusions

2024-04-02 19:55

关注

Maven依赖冲突解决之exclusions

1. 背景

2. 解决方式

场景

在这里插入图片描述

假如hadoop集群中hadoop版本是3.2.1,这时候为了保证程序能够顺利操作hadoop,需要引入hadoop-client的3.2.1版本。但这里也可以看到,spark-core_2.12内部也有对hadoop-client的依赖,而且版本是低版本的2.7.4,这时候往往就会产生冲突或者未知错误。所以需要使用exclusions做依赖排除。

解决方式

使用exclusions来对某一个第三方库引入的依赖jar包做排除


<dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.12</artifactId>
            <version>${spark.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.hadoop</groupId>
                    <artifactId>hadoop-client</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

在这里插入图片描述

Maven解决依赖冲突总结

如果存在jar包的依赖冲突,在项目启动时总是报类似这样的错:NoSuchMethodError、ClassNotFoundException、成员变量找不到等等。真的很让人不好受。

Maven采用的是“最近获胜的策略”来处理依赖的冲突,即如果一个项目最终依赖于相同artifact的多个版本,在依赖树中离项目最近的那个版本将被使用。让我们来看看一个实际的例子。

实例分析

我们有一个web应用resolve-web,该工程依赖于project-A和project-B,project-A依赖于project-common的1.0版本并调用其中的sayHello()方法。project-B依赖于project-C,而project-C又进一步依赖于project-common的2.0版本并调用其中的sayGoodBye()方法。project-common的1.0和2.0版本是不同的,1.0中之包含sayHello()方法,而2.0中包含了sayHello()和sayGoodBye()两个方法。整个项目的依赖关系如下图:

根据Maven的最近原则依赖机制,resolve-web将同时依赖于project-common的1.0和2.0版本,这就造成了依赖冲突。而根据最近获胜策略,Maven将选择project-common的1.0版本作为最终的依赖。这和Gradle不同,Gradle在默认情况下将选择最新的版本作为获胜版本。而对于Maven,由于proejct-common的1.0版本比2.0版本在依赖树中离resolve-web更近,故1.0版本获胜。在resolve-web中执行"mvn dependency:tree -Dverbose"可以看到resolve-web的依赖关系:


[INFO] resolve-web:resolve-web:war:1.0-SNAPSHOT
 
[INFO] +- junit:junit:jar:3.8.1:test
 
[INFO] +- project-B:project-B:jar:1.0:compile
 
[INFO] |  \- project-C:project-C:jar:1.0:compile
 
[INFO] |     \- (project-common:project-commmon:jar:2.0:compile - omitted for conflict with 1.0)
 
[INFO] +- project-A:project-A:jar:1.0:compile
 
[INFO] |  \- project-common:project-commmon:jar:1.0:compile
 
[INFO] \- javax.servlet:servlet-api:jar:2.4:provided

由上可知,project-common:project-commmon:jar:2.0被忽略掉了。此时在resolve-web的war包中将只包含project-common的1.0版本,于是问题来了。由于project-common的1.0版本中不包含sayGoodBye()方法,而该方法正是project-C所需要的,所以运行时将出现“NoSuchMethodError”。

解决办法

方法1:显式加入对project-common 2.0版本的依赖。先前的2.0版本不是离resolve-web远了点吗,那我们就直接将它作为resolve-web的依赖,这不就比1.0版本离resolve-web还近吗?在resove-web的pom.xml文件中直接加上对project-common 2.0 的依赖


<dependency>       
   <groupId>project-common</groupId>      
   <artifactId>project-commmon</artifactId>  
   <version>2.0</version>   
</dependency>  

方法2:resolve-web对project-A的dependency声明中,将project-common排除掉。在resolve-web的pom.xml文件中修改对project-A的dependency声明


<dependency>  
          <groupId>project-A</groupId>  
          <artifactId>project-A</artifactId>  
          <version>1.0</version>  
          <exclusions>  
              <exclusion>  
                  <groupId>project-common</groupId>  
                  <artifactId>project-commmon</artifactId>  
              </exclusion>  
          </exclusions>  
</dependency>

此时再在resolve-web中执行"mvn dependency:tree -Dverbose",如下:


......
 
[INFO] resolve-web:resolve-web:war:1.0-SNAPSHOT
 
[INFO] +- junit:junit:jar:3.8.1:test
 
[INFO] +- project-B:project-B:jar:1.0:compile
 
[INFO] |  \- project-C:project-C:jar:1.0:compile
 
[INFO] |     \- project-common:project-commmon:jar:2.0:compile
 
[INFO] +- project-A:project-A:jar:1.0:compile
 
[INFO] \- javax.servlet:servlet-api:jar:2.4:provided
 
......

这样的话,就可以完美解决冲突了。

命令分析

这里我们对我们执行的命令做一个简单的说明。


mvn dependency:tree -Dverbose -Dincludes=<groupId>:<artifactId>

1、第一部分mvn dependency:tree是maven依赖的分析命令,作用是对我们的项目的依赖进行分析,并输出项目依赖树

2、第二部分-Dverbose的作用是添加了verbose一个环境变量,起的作用是在分析项目依赖时输出明细,这样项目中依赖的所有3、引用都会被输出出来,包含了所有的间接引用,会有很多很多,我们只需要我们要找的,所以就需要第三个参数了第三部分-Dincludes=<groupId>:<artifactId>的作用就是进行过滤,只包含我们想要的依赖的依赖时,排除掉其它不需要的,依赖树的所有叶子节点就是我们的找的依赖包。其中的groupId和artifactId可以只填写一个,为了保证准确性,一般都会填两个(填写时不包括尖括号)。

小试牛刀

在自己的项目上,启动时发现如下异常:

21-Mar-2019 15:51:33.527 信息 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
21-Mar-2019 15:52:08.905 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.socket.server.support.WebSocketHandlerMapping#0': Cannot resolve reference to bean 'org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler#0' while setting bean property 'urlMap' with key [/websocket/**]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler#0': Cannot resolve reference to bean 'org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService#0': Cannot resolve reference to bean 'SockJsScheduler' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SockJsScheduler': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'removeOnCancelPolicy' of bean class [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler]: Bean property 'removeOnCancelPolicy' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedMap(BeanDefinitionValueResolver.java:407)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:165)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1531)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4817)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5283)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1736)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:483)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:432)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at java.security.AccessController.doPrivileged(Native Method)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

执行命令分析下,项目的jar包的依赖情况,只过滤并分析spring框架的jar包依赖树情况,使用的命令如下:


mvn dependency:tree -Dverbose -Dincludes=org.springframework:

在新引入的项目jar包中,发现其再次引入了spring的相关包并且该spring包的层级属于第二层级,实际已有的spring的包处在第三或者第四层级,根据就近原则,低版本的3.2.5的jar包覆盖了高版本的jar包,导致出现找不到某变量的异常。剔除这些jar包如下配置:


<exclusion>
       <groupId>org.springframework</groupId>
       <artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context-support</artifactId>
</exclusion>

重新查看jar包的依赖树:


xujiaqingdeMacBook-Pro:mos jaycee$ mvn dependency:tree -Dverbose -Dincludes=org.springframework:
[WARNING] 
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'mirror' (position: START_TAG seen ...e the preferred\n   | server for that repository.\n   |-->\n <mirror>... @153:10)  @ /software/apache-maven-3.6.0/conf/settings.xml, line 153, column 10
[WARNING] 
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for fish:core-db:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ fish:core-db:[unknown-version], /projects/mos/core-db/pom.xml, line 79, column 21
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] FishParent                                                         [pom]
[INFO] core-db                                                            [jar]
[INFO] core                                                               [war]
[INFO] 
[INFO] --------------------------< fish:FishParent >---------------------------
[INFO] Building FishParent 1.0-SNAPSHOT                                   [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ FishParent ---
[INFO] 
[INFO] ----------------------------< fish:core-db >----------------------------
[INFO] Building core-db 1.0-SNAPSHOT                                      [2/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ core-db ---
[INFO] fish:core-db:jar:1.0-SNAPSHOT
[INFO] \- com.hand:hap-db:jar:3.5.4-RELEASE:compile
[INFO]    \- com.hand:hap-core-db:jar:3.5.4-RELEASE:compile
[INFO]       \- org.springframework:spring-core:jar:4.3.11.RELEASE:compile
[INFO] 
[INFO] -----------------------------< fish:core >------------------------------
[INFO] Building core 1.0-SNAPSHOT                                         [3/3]
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ core ---
[INFO] fish:core:war:1.0-SNAPSHOT
[INFO] +- com.hand:hap-db:jar:3.5.4-RELEASE:compile
[INFO] |  \- com.hand:hap-core-db:jar:3.5.4-RELEASE:compile
[INFO] |     \- org.springframework:spring-core:jar:4.3.11.RELEASE:compile
[INFO] +- com.hand:hap-pom:pom:3.5.4-RELEASE:provided
[INFO] |  +- com.hand:hap-core:jar:classes:3.5.4-RELEASE:provided
[INFO] |  |  +- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-jdbc:jar:4.3.11.RELEASE:provided
[INFO] |  |  |  +- org.springframework:spring-beans:jar:4.3.11.RELEASE:provided
[INFO] |  |  |  |  \- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-tx:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-test:jar:4.3.11.RELEASE:provided
[INFO] |  |  |  \- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-context:jar:4.3.11.RELEASE:provided
[INFO] |  |  |  +- org.springframework:spring-aop:jar:4.3.11.RELEASE:provided
[INFO] |  |  |  |  +- (org.springframework:spring-beans:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  |  \- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  \- org.springframework:spring-expression:jar:4.3.11.RELEASE:provided
[INFO] |  |  |     \- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-context-support:jar:4.3.11.RELEASE:provided
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-web:jar:4.3.11.RELEASE:provided
[INFO] |  |  |  +- (org.springframework:spring-aop:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-webmvc:jar:4.3.11.RELEASE:provided
[INFO] |  |  |  +- (org.springframework:spring-aop:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-expression:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-web:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  +- org.springframework.data:spring-data-redis:jar:1.7.0.RELEASE:provided
[INFO] |  |  |  +- org.springframework.data:spring-data-keyvalue:jar:1.1.0.RELEASE:provided
[INFO] |  |  |  |  +- org.springframework.data:spring-data-commons:jar:1.12.0.RELEASE:provided
[INFO] |  |  |  |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  |  |  \- (org.springframework:spring-beans:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  |  \- (org.springframework:spring-tx:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-tx:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- org.springframework:spring-oxm:jar:4.2.5.RELEASE:provided
[INFO] |  |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-aop:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  \- (org.springframework:spring-context-support:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  +- org.springframework.security:spring-security-web:jar:4.0.4.RELEASE:provided
[INFO] |  |  |  +- org.springframework.security:spring-security-core:jar:4.0.4.RELEASE:provided
[INFO] |  |  |  |  +- (org.springframework:spring-aop:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  |  \- (org.springframework:spring-expression:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-expression:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  \- (org.springframework:spring-web:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  +- org.springframework.security:spring-security-config:jar:4.0.4.RELEASE:provided
[INFO] |  |  |  +- (org.springframework:spring-aop:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  +- org.springframework.security:spring-security-cas:jar:4.0.4.RELEASE:provided
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  \- (org.springframework:spring-web:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  +- org.springframework.security.oauth:spring-security-oauth2:jar:2.0.7.RELEASE:provided
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.0.9.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.0.9.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.0.9.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  \- (org.springframework:spring-webmvc:jar:4.0.9.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  +- org.springframework.security:spring-security-ldap:jar:4.0.4.RELEASE:provided
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  \- (org.springframework:spring-tx:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  +- com.ryantenney.metrics:metrics-spring:jar:3.1.3:provided
[INFO] |  |  |  \- (org.springframework:spring-context-support:jar:4.1.6.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  +- org.springframework.amqp:spring-rabbit:jar:1.7.1.RELEASE:provided
[INFO] |  |  |  +- (org.springframework:spring-web:jar:4.3.7.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-messaging:jar:4.3.7.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- org.springframework.amqp:spring-amqp:jar:1.7.1.RELEASE:provided
[INFO] |  |  |  |  \- (org.springframework:spring-core:jar:4.3.7.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-tx:jar:4.3.7.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  \- (org.springframework:spring-context:jar:4.3.7.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  +- org.springframework:spring-websocket:jar:4.3.11.RELEASE:provided
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-web:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |  \- org.springframework:spring-messaging:jar:4.3.11.RELEASE:provided
[INFO] |  |     +- (org.springframework:spring-beans:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |     +- (org.springframework:spring-context:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  |     \- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |  +- com.hand:hap-workflow:jar:classes:3.5.4-RELEASE:provided
[INFO] |  |  +- org.activiti:activiti-spring:jar:6.0.0:provided
[INFO] |  |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  |  \- (org.springframework:spring-jdbc:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |  \- org.activiti:activiti-rest:jar:6.0.0:provided
[INFO] |  |     +- (org.springframework:spring-context:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  |     \- (org.springframework:spring-webmvc:jar:4.2.5.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] |  \- com.hand:hap-report:jar:classes:3.5.4-RELEASE:provided
[INFO] |     \- com.bstek.ureport:ureport2-console:jar:2.2:provided
[INFO] |        \- com.bstek.ureport:ureport2-core:jar:2.2:provided
[INFO] |           +- (org.springframework:spring-web:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] |           \- (org.springframework:spring-jdbc:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO] \- hscs:core:jar:classes:2.2.1-SNAPSHOT:provided
[INFO]    \- org.springframework.kafka:spring-kafka:jar:1.3.0.RELEASE:provided
[INFO]       +- (org.springframework:spring-messaging:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO]       +- org.springframework:spring-tx:jar:4.3.11.RELEASE:provided
[INFO]       |  +- (org.springframework:spring-beans:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO]       |  \- (org.springframework:spring-core:jar:4.3.11.RELEASE:provided - omitted for duplicate)
[INFO]       \- org.springframework.retry:spring-retry:jar:1.2.0.RELEASE:provided
[INFO]          \- (org.springframework:spring-core:jar:4.3.3.RELEASE:provided - omitted for conflict with 4.3.11.RELEASE)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for FishParent 1.0-SNAPSHOT:
[INFO] 
[INFO] FishParent ......................................... SUCCESS [  0.922 s]
[INFO] core-db ............................................ SUCCESS [  0.539 s]
[INFO] core ............................................... SUCCESS [  4.020 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.780 s
[INFO] Finished at: 2019-03-21T15:38:44+08:00
[INFO] ------------------------------------------------------------------------
xujiaqingdeMacBook-Pro:mos jaycee$ 

实际上,对于omitted for duplicate的提示,我们可以不用去解决,只是提示了该包的重复定义。在实际情况上,更多的是根据就近原则引用了一个低版本的jar包,这样本身高版本的Jar包包含的方法,在低版本却没有,导致项目在调用时,出现了“方法找不到”类似的异常信息。

以上为个人经验,希望能给大家一个参考,也希望大家多多支持编程网。

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯