本文介绍了如何使用kotlinscript DSL(build.gradle.kts)通过URL添加Maven存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

build.gradle.kts版本的build.gradle中的以下代码片段等效吗?

Whats the equivalent of the following code snippet from a build.gradle in a build.gradle.kts version?

repositories {
  mavenCentral()
  maven {
    url '<MAVEN REPO URL>'
  }
}

推荐答案

作为其他答案的补充,在#kotlin-dsl/256 快捷方法已添加到各种存储库方法中,以执行以下操作:

As an addition to the other answers, in #kotlin-dsl/256 shortcut methods were added to the various repository methods to do something like the following:

repositories {
  mavenCentral()
  maven(url = "<MAVEN REPO URL>")
}

根据此问题,已在Kotlin DSL版本0.11.1中添加了此功能. 0.11.x版本包含在 Gradle 4.2版本中.

According to the issue, this was added in the Kotlin DSL version 0.11.1. The 0.11.x versions were included in the Gradle 4.2 release.

要查看使用 Gradle包装器时正在与内部版本一起运行的Gradle版本, a>运行./gradlew --version.

To see the Gradle version you are running with your build when using the Gradle wrapper run ./gradlew --version.

这篇关于如何使用kotlinscript DSL(build.gradle.kts)通过URL添加Maven存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!