有人可以告诉我 mvn dependency:analyze
是如何工作的吗?我的一个项目中的 mvn dependency:analyze
输出显示
[WARNING] Used undeclared dependencies found:
[WARNING] org.apache.commons:commons-lang3:jar:3.4:compile
[WARNING] com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
...
[WARNING] Unused declared dependencies found:
[WARNING] org.springframework.boot:spring-boot-starter-test:jar:1.5.4.RELEASE:test
[WARNING] org.springframework.restdocs:spring-restdocs-mockmvc:jar:1.1.3.RELEASE:test
[WARNING] ch.qos.logback:logback-classic:jar:1.1.11:compile
有人可以告诉我以下信息吗 -
使用发现的未声明的依赖项
表示什么?这是否意味着它没有在pom.xml
dependency
中声明,而是在代码中使用并通过一些传递依赖项包含在内?发现未使用的声明依赖项
是否仅检查pom.xml
中声明的依赖项
,还是也检查传递依赖项?
Maven 版本 - 3.5.0
最佳答案
What does Used undeclared dependencies found denote? Does it mean that this is not declared in pom.xml dependencies but getting used in code and is included via some transitive dependencies?
完全正确!
Does Unused declared dependencies found check only for the dependencies declared in pom.xml or it checks transitive dependencies as well?
声明的依赖项是在您的 POM 中声明的依赖项。因此该插件在其检查中不包括传递依赖项。
请注意,该插件默认进行字节码分析,这对于仅与常量或注释一起使用的依赖项来说是有问题的。在某些情况下,这可能会导致错误报告。请参阅FAQ了解详情。
关于java - mvn依赖如何:analyze work?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48315863/