gpt4 book ai didi

gradle - Kotlin Gradle 使用依赖项

转载 作者:行者123 更新时间:2023-12-02 13:20:29 25 4
gpt4 key购买 nike

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

在我的 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 开发之前,我正在尝试熟悉它。

谢谢。

最佳答案

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

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

compile()已弃用。使用implementation() .

关于gradle - Kotlin Gradle 使用依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57641298/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com