简体   繁体   English

Spring 启动微服务的依赖

[英]Dependency Of Spring boot Microservice

We have a GIT Repository which contains multiple microservices (around 120 microservices).我们有一个 GIT 存储库,其中包含多个微服务(大约 120 个微服务)。 I would like to know is there a process available to check all the poms in the repository to see if the pom contains a specific dependency jar. For example there is a microservice A and I wanted to know if there is a dependency for jar(woodstox-core) available in the pom without manually opening the POM and checking it.我想知道是否有一个过程可用于检查存储库中的所有 pom,以查看 pom 是否包含特定的依赖项 jar。例如,有一个微服务 A,我想知道是否存在对 jar(woodstox -core) 在 pom 中可用,无需手动打开 POM 并检查它。

Since there are around 120 microservices analysing each pom manually for the dependency would be very time consuming.由于大约有 120 个微服务,手动分析每个 pom 的依赖关系将非常耗时。 Also the same excercise needs to be repeated for other git repositories as well.同样的练习也需要对其他 git 存储库重复。

Any help on this is much appreciated非常感谢对此的任何帮助

If the repo has a root parent pom file then this problem is easy.如果 repo 有一个根父 pom 文件,那么这个问题很容易。 You can just run "mvn dependency:tree" from the root and this will list off all the dependencies in the children services.您可以从根目录运行“mvn dependency:tree”,这将列出子服务中的所有依赖项。

If this is not the case, and each service is built as a stand alone service (in the eyes of maven).如果不是这种情况,并且每个服务都被构建为一个独立的服务(在 maven 的眼中)。 You will need to write a small script which will iterate over all the children services/folders in the root git repo and run the "mvn dependency:tree".您将需要编写一个小脚本,它将遍历根 git 存储库中的所有子服务/文件夹并运行“mvn dependency:tree”。 If you are doing this in a bash script you can pipe all the output of the tree command to append to a central file and the just search one central location once you are done.如果您在 bash 脚本中执行此操作,您可以将 pipe 树命令的所有 output 到 append 到中央文件,完成后只需搜索一个中央位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM