有时候一个大的依赖包中的某些小的依赖包版本与我们电脑设备的软件不符时,
我们可以排除这个小的依赖包,
从而另外添加一个新的对应版本号的依赖包
如这个 spring-cloud-starter-zookeeper-discovery 大的依赖包中的 zookeeper包是3.5.3,
而我的zookeeper是3.4.11版本的,
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-zookeeper-discovery -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zookeeper-discovery</artifactId>
<!--排除 spring-cloud-starter-zookeeper-discovery 包中的zookeeper 3.5.3-->
<exclusions>
<exclusion>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--添加zookeeper3.4.11版本-->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.11</version>
</dependency>