Gradle - 与 because 语句的依赖关系

Gradle - dependencies with because statement

我是 gradle 的新手,我在 build.gradle.kts 内部依赖项中找到 because clauses/statements

dependencies { 
  implementation("commons-io:commons-io") {
      because("IOUtils")
  }
  implementation("org.apache.commons:commons-text") {
      because("StringEscapeUtils")
  }

我没有在任何 Gradle dependencies documentation 中找到这样的因为子句

它只是一个类似于添加 java 文档的自定义子句并且可以重命名为任何字符串如 myreason("""my reason is other""")

或者 Gradle 使用了 becasue 语句?

您可以在 org.gradle.api.artifacts.Dependency 界面中找到它

https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Dependency.html#because-java.lang.String-

@Incubating
@Nullable
String getReason()

Returns a reason why this dependency should be used, in particular with regards to its version. The dependency report will use it to explain why a specific dependency was selected, or why a specific dependency version was used.

Returns:
   a reason to use this dependency
Since:
   4.6


@Incubating
void because​(@Nullable
             String reason)

Sets the reason why this dependency should be used.

Since:
    4.6