【问题标题】:Kotlin Gradle using dependenciesKotlin Gradle 使用依赖项
【发布时间】:2019-08-24 20:26:45
【问题描述】:

我正在尝试使用 Gradle 和命令行在 Kotlin 中包含 org.apache.commons.net.* 库。

在我写的 build.gradle.kts 文件的依赖项中:

compile 'commons-net:commons-net:3.6' 正如apache documentation 中所说,但它给了我一个奇怪的错误:

> Configure project :
e: D:\core\Confidential\Learn\Kotlin\build.gradle.kts:30:13: Too many characters
 in a character literal ''commons-net:commons-net:3.6''

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\core\Confidential\Learn\Kotlin\build.gradle.kts' line: 30

* What went wrong:
Script compilation error:

  Line 30:     compile('commons-net:commons-net:3.6')
                       ^ Too many characters in a character literal ''commons-ne
t:commons-net:3.6''

1 error

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

(我也试过compile 'commons-net:commons-net:3.6'compile group: 'commons-net', name: 'commons-net', version: '3.6')。

我对 Kotlin 完全陌生,在开始使用 IDEA 进行 Android 开发之前,我正在尝试熟悉它。

谢谢。

【问题讨论】:

    标签: gradle kotlin gradle-kotlin-dsl


    【解决方案1】:

    就像在 Java 中一样,' 用于字符文字," 用于字符串文字。

    你想要"commons-net:commons-net:3.6"

    并且compile() 已被弃用。使用implementation()

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-11
      • 2015-11-29
      • 1970-01-01
      相关资源
      最近更新 更多