java - maven 仍然列出排除的依赖项
问题描述
我有一个具有这些依赖项的 Maven项目:
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1200-jdbc41</version>
<exclusions>
<exclusion>
<groupId>org.slf4</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
如果我运行mvn tree
它仍然显示排除的工件:
$ mvn dependency:tree
...
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ testArtifact ---
[INFO] testGroup:testArtifact:jar:1.0-SNAPSHOT
[INFO] \- org.postgresql:postgresql:jar:9.4-1200-jdbc41:compile
[INFO] +- com.github.dblock.waffle:waffle-jna:jar:1.7:runtime
[INFO] | +- net.java.dev.jna:jna:jar:4.1.0:runtime
[INFO] | +- net.java.dev.jna:jna-platform:jar:4.1.0:runtime
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.7:runtime
[INFO] | \- com.google.guava:guava:jar:18.0:runtime
[INFO] \- org.slf4j:slf4j-simple:jar:1.7.7:runtime ** <--- BAD ONE
如果我运行依赖项:复制依赖项或阴影 jar 插件之类的东西,它们都会拉入不需要的 jar。
我错过了什么吗?
使用 Maven 3.6.0
解决方案
groupId 不正确。应该是 org.slf4j 而不是 org.slf4(缺少 j)。
推荐阅读
- php - SQL查询中的正则表达式数字范围
- c# - 当文件作为数组传入时,Request.Files 为空
- javascript - Swiper:TypeError:无法读取未定义的属性“push”或TypeError:classNames未定义
- excel - 我以前没有见过的一种特殊的复制和粘贴。您知道可以为 400 多个客户填写此代码的代码吗?
- asp.net-core - 如何覆盖控制器内 Startup 类中定义的“OnActionExecuting”?
- javascript - 2019 年我应该在哪里存储我的 JWT,localStorage 真的不安全吗?
- firefox - 如何修复硒中的“轮询更改失败”
- vue.js - 当调度的操作使用 Vue.set 设置状态对象时,如何使状态获取器反应?
- javascript - 热重新加载会破坏应用程序。最终加载程序没有返回 Buffer 或 String
- debugging - 错误:访问被拒绝查找属性“vendor.gralloc.disable_ahardware_buffer”