且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven - 在运行时查找依赖项

更新时间:2022-06-11 22:42:46

我将使用 mvn dependency:tree 插件生成一个带有依赖树的文本文件.然后我将解析它并从中创建依赖树/图.我将获取工件的范围、groupId、artifactId、版本及其父项.

I will just use the mvn dependency:tree plugin to generate a text file with the dependency tree. Then I will parse that in and create the dependency tree/graph from that. I will get the scope of the artifact, groupId, artifactId, version, and its parent.

我成功地实现了这种类型的查找,它只是简单地获取依赖项输出,解析它并使用缩进组织依赖项,没什么特别的.工件、组、版本和范围很容易解析,因为分隔符是 :.

I successfully implemented this type of lookup, it simply takes the dependency output, parses it and organizes dependencies simply using the indentation, nothing fancy. The artifact, group, version, and scope are easily parsed since the separator is a :.

沃尔特