如何获取jar文件父依赖关系?
我的 lib 文件夹中有一个 jar 文件,该文件不在 pom 文件中,所以我想知道哪个依赖项下载了这个 jar,以便我可以从依赖项中排除这个 jar。 请告知是否有一个 Maven 命令可以知道我的哪些依赖项正在下载这个 jar。
案例:
我在类路径中找到了 jar slf4j-api-1.5.8.jar,我想知道哪个依赖项正在下载此 jar,以便我可以从依赖项中排除此 jar。
i have a jar file in my lib folder which is not in the pom file, so i was wondering which dependency downloaded this jar so i can exclude this jar from the dependency.
please advise if there's a maven command to know which of my dependencies are downloading this jar.
Case:
i found in my classpath the jar slf4j-api-1.5.8.jar, and i want to know which dependency is downloading this jar so i can exclude this jar from the dependency.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查找 Maven 依赖插件
您只需运行
即可查看完整依赖关系树。但如果你读过文档就好了。
Look for Maven Dependency Plugin
you can just run
to see complete dependency tree. But good if you read the doc.
JAR 文件不一定包含其依赖项。它可以包含manifest.mf的ClassPath属性中的第一级依赖项列表,该属性可以在META-INF下找到。
因此,要查找依赖项,您应该参考手册(如果开发人员编写了它)或尝试使用 JDepend 等工具来解决它们。
Jar file does not necessarily contain its dependencies. It can contain the list of first level dependencies in ClassPath property of manifest.mf that can be found under META-INF.
So to find dependencies you should refer to manual (if the developer wrote it) or try to resolve them using tool like JDepend.