簡體   English   中英

使用Kotlin DSL的Gradle全局插件存儲庫

[英]Gradle global plugin repository with Kotlin DSL

我是Gradle的新手,但需要從我公司網絡上的機器構建一個使用它的開源項目。 該項目最近已轉移到Kotlin DSL,因此需要一些插件。

我需要使用我們的企業Nexus服務器來獲取插件依賴項,我想在全局設置它,因為我不想在所有項目中修改settings.gradle.kts (我已經嘗試過這個和有用)

如果我想在全球范圍內這樣做,我從https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_management了解到我需要在USER_HOME/.gradle有一個init.gradle.kts文件目錄。 這就是我所做的,這是文件的內容:

    settingsEvaluated { settings ->
            settings.pluginManagement {
                repositories {
                    mavenLocal()
                    maven("https://my_corporate_nexus/")
                }
            }
    }

但是當我接觸我的構建時,這就是我得到的:

* What went wrong:
Script compilation errors:

  Line 1: settingsEvaluated { settings ->
          ^ None of the following functions can be called with the arguments supplied:
              public open fun settingsEvaluated(p0: Closure<(raw) Any!>): Unit defined in Init_gradle
              public open fun settingsEvaluated(p0: Action<in Settings!>): Unit defined in Init_gradle
              public final fun settingsEvaluated(p0: Settings!.() -> Unit): Unit defined in Init_gradle

以下是我的版本詳細信息,由gradle -v提供:

  • Gradle 4.9
  • Kotlin DSL:0.18.4
  • 科特林:1.2.41
  • Groovy:2.4.12

所以它看起來很像我遺失的東西。

知道它可能是什么?

它似乎適用於:

settingsEvaluated {
        settings.pluginManagement {
            repositories {
                mavenLocal()
                maven("https://my_corporate_nexus/")
            }
        }
}

沒有settings ->

我不確定文檔是否錯誤或者我的設置是否具體但是...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM