首页 > 解决方案 > 使用 curl 获取 Spring Initializr 的所有依赖项列表

问题描述

官方文档中,它讲述了如何使用curl来创建一个 spring 项目。

例如,

curl https://start.spring.io/starter.zip -d dependencies=web,devtools \
     -d bootVersion=2.1.9.RELEASE -o my-project.zip

我的问题是,我如何使用curl来获取所有依赖项的列表?

输出应该如下所示

# output of `curl ...` to get all dependencies of Spring Initializr
...
web
devtools
...

标签: springspring-boot

解决方案


也许为时已晚,您不再需要,但可以对其他人有所帮助...

有一个 url 可以检索相关信息,例如版本、选项和依赖项。

curl -H 'Accept: application/json' https://start.spring.io

如果您只想过滤依赖项的名称,在jq帮助下,您可以使用以下命令请求:

curl -H 'Accept: application/json' https://start.spring.io | jq '.dependencies.values[].values[].id'

结果是这样的:

"devtools"
"lombok"
"configuration-processor"
"web"
"webflux"
"data-rest"
"session"
"data-rest-explorer"
"data-rest-hal"
...

推荐阅读