build.gradle 的内容如下:
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.5.0'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
// https://mvnrepository.com/artifact/com.linkedin.migz/migz
compile group: 'com.linkedin.migz', name: 'migz', version: '1.0.4'
}
jar {
manifest {
attributes 'Main-Class': 'Main1Kt'
}
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
执行 gradle build 报错:
E:\kotlinProject\trySomeCode>gradle build
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\kotlinProject\trySomeCode\build.gradle' line: 13
* What went wrong:
A problem occurred evaluating root project 'trySomeCode'.
> Could not find method compile() for arguments [org.jetbrains.kotlin:kotlin-stdlib] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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
BUILD FAILED in 1s
同样的内容,只要把 kotlin 的版本改成 1.4.32 就可以正常 build,请问是 kotlin1.5 的 gradle build 配置方式改了吗?谢谢大家
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.