在Maven中,排除依赖包的子依赖可以通过在pom.xml文件中使用
例如,假设要排除spring-boot-starter-web依赖包的子依赖中的spring-boot-starter-tomcat依赖,可以在pom.xml文件中添加以下配置:
<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><exclusions><exclusion><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-tomcat</artifactId></exclusion></exclusions></dependency></dependencies>在上述配置中,通过在spring-boot-starter-web依赖包上使用
保存pom.xml文件后,重新构建项目,Maven将会排除指定的子依赖。

