【问题标题】:How can I get the metadata of dependencies in gradle?如何在 gradle 中获取依赖项的元数据?
【发布时间】:2020-04-27 02:47:12
【问题描述】:

我想从 Gradle 获得关于我添加的每个依赖项的所有信息,

我可以通过运行得到依赖树

grade dependencies 

我们得到这样的东西

+--- io.springfox:springfox-swagger2:2.9.2
|    +--- io.swagger:swagger-annotations:1.5.20
|    +--- io.swagger:swagger-models:1.5.20
|    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.9.5 -> 2.9.0
|    |    +--- org.slf4j:slf4j-api:1.7.22 -> 1.7.26
|    |    \--- io.swagger:swagger-annotations:1.5.20
|    +--- io.springfox:springfox-spi:2.9.2 (*)
|    +--- io.springfox:springfox-schema:2.9.2
|    |    +--- io.springfox:springfox-core:2.9.2 (*)
|    |    \--- io.springfox:springfox-spi:2.9.2 (*)
|    +--- io.springfox:springfox-swagger-common:2.9.2
|    |    +--- io.swagger:swagger-annotations:1.5.20
|    |    +--- io.swagger:swagger-models:1.5.20 (*)
|    |    +--- io.springfox:springfox-spi:2.9.2 (*)
|    |    +--- io.springfox:springfox-schema:2.9.2 (*)
|    |    +--- io.springfox:springfox-spring-web:2.9.2 (*)
|    |    +--- com.google.guava:guava:20.0
|    |    +--- com.fasterxml:classmate:1.4.0
|    |    +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.26
|    |    +--- org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE (*)
|    |    \--- org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE (*)
|    +--- io.springfox:springfox-spring-web:2.9.2 (*)
|    +--- com.google.guava:guava:20.0
|    +--- com.fasterxml:classmate:1.4.0
|    +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.26
|    +--- org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE (*)
|    +--- org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE (*)
|    \--- org.mapstruct:mapstruct:1.2.0.Final

但无法获取有关依赖项的所有其他信息 我怎样才能做到这一点?

更新 我想获取有关创建者、日期、图书馆主页、图书馆语言、许可证类型或任何可以提供的信息的信息。

【问题讨论】:

  • 您需要哪些信息?
  • 我更新了我想获取有关创建者、日期、图书馆主页、图书馆语言、许可证类型或任何可以提供的信息的问题

标签: spring spring-boot gradle kotlin groovy


【解决方案1】:

Gradle 不提供用于执行此操作的 API。

如果您的依赖项使用 Maven POM 文件或 Ivy XML 作为其元数据,您可以通过 ArtifactQuery 访问这些文件。有an example in the documentation 可以做到这一点。

但是,您必须决定要提取哪些信息以及如何呈现它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-08
    • 1970-01-01
    • 1970-01-01
    • 2017-09-07
    • 2014-11-10
    • 1970-01-01
    • 2015-02-25
    • 1970-01-01
    相关资源
    最近更新 更多