阿里云给大家做了镜像:https://maven.aliyun.com/mvn/guide
Maven 在 pom.xml 文件内添加以下配置
<repositories>
<repository>
<id>ali-maven</id>
<url>https://maven.aliyun.com/repository/central</url>
</repository>
</repositories>
下面以 Kotlin Native的build.gradle.kts作为例子:
group = "me.sam"
version = "1.0-SNAPSHOT"
plugins {
kotlin("multiplatform") version "1.4.21"
}
/**
* Using Alibaba Repo to speed up: https://maven.aliyun.com/mvn/guide
*/
repositories {
maven{ url = uri("https://maven.aliyun.com/repository/central") }
maven{ url = uri("https://maven.aliyun.com/repository/public") }
}
kotlin {
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
nativeTarget.apply {
binaries {
executable {
entryPoint = "main"
}
}
}
sourceSets {
val nativeMain by getting
val nativeTest by getting
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
}
}
}
}
网友评论