首先我的build.gradle.kts文件如下:
plugins {
kotlin("jvm") version "1.8.0"
application
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
maven {
url "https://maven.aliyun.com/repository/central"
}
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
}
tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(8)
}
application {
mainClass.set("MainKt")
}
我的gradle-wrapper.properties文件如下:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
但是呢,我的报错信息如下:
具体错误信息文本:
A problem occurred configuring root project 'HelloWorldGradle'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0.
Required by:
project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.8.0
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0.
> Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.8.0/kotlin-gradle-plugin-1.8.0.pom'.
> Could not GET 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.8.0/kotlin-gradle-plugin-1.8.0.pom'.
> Connection reset
* 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.
点击上面的Load Script Configurations后重试,报另一个错误:
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve gradle:gradle:7.4.2.