Java study notes-exclude pom dependency

We know that the introduction of dependencies in maven, directly in the pom file

 <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.2.1</version>
 </dependency>

 

But sometimes the imported dependency contains a layer of dependency, and the layer of dependency in it is not what we want, it needs to be excluded, how can we exclude it?

<dependency>
     <groupId>com.taobao.metaq.final</groupId>
     <artifactId>metaq-client</artifactId>
     <version>4.1.6.Final</version>
     <exclusions>
           <exclusion>
               <groupId>com.alibaba.unit.rule</groupId>
               <artifactId>unitrouter</artifactId>
           </exclusion>
      </exclusions>
 </dependency>

It can be seen from the above example that <exclusions><exclusion><exclusion/></exclusions> is used for exclusion, and the only dependency on the positioning of exclusion is groups and artifactId

At this time, you can introduce other versions of the dependency or not

Guess you like

Origin blog.csdn.net/mumuwang1234/article/details/111997738