maven工程jar与平台jar冲突解决办法

1、打包时报错信息如下:

[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-banned-dependencies) @ xc_exam ---
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:
Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for org.apache.httpcomponents:httpclient:4.4.1 paths to dependency are:
+-com.xc.os.platform:xc_exam:2.6
  +-org.apache.httpcomponents:httpclient:4.4.1
and
+-com.xc.os.platform:xc_exam:2.6
  +-com.zmbsms.os:zmbsms_core:4.1
    +-org.apache.httpcomponents:httpclient:4.5.4
and
+-com.xc.os.platform:xc_exam:2.6
  +-org.springframework.data:spring-data-solr:1.3.0.RELEASE
    +-org.apache.httpcomponents:httpclient:4.2.2
and
+-com.xc.os.platform:xc_exam:2.6
  +-com.aliyun.oss:aliyun-sdk-oss:2.7.0
    +-org.apache.httpcomponents:httpclient:4.4.1
and
+-com.xc.os.platform:xc_exam:2.6
  +-org.springframework.data:spring-data-solr:1.3.0.RELEASE
    +-org.apache.httpcomponents:httpclient-cache:4.2.2
      +-org.apache.httpcomponents:httpclient:4.2.2
]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

2、com.zmbsms.os:zmbsms_core:4.1为我们的平台包,平台包中也引用了httpclient、poi-2.5.1-final,但与该工程中的版本不同,处理方式为:

<!-- zmbsms-core -->
<dependency>
			<groupId>com.zmbsms.os</groupId>
			<artifactId>zmbsms_core</artifactId>
			<version>4.1</version>
</dependency>

改为:

<!-- zmbsms-core -->
<dependency>
			<groupId>com.zmbsms.os</groupId>
			<artifactId>zmbsms_core</artifactId>
			<version>4.1</version>
			<exclusions>
			    <exclusion>
				   <groupId>org.apache.httpcomponents</groupId>
			       <artifactId>httpclient</artifactId>
			    </exclusion>
			    <exclusion>
			        <groupId>poi</groupId>
			        <artifactId>poi-2.5.1-final</artifactId>
			    </exclusion>
			</exclusions>
</dependency>
发布了122 篇原创文章 · 获赞 152 · 访问量 112万+

猜你喜欢

转载自blog.csdn.net/ytangdigl/article/details/105466513