美文网首页工具技巧
Maven / Gradle 国内源

Maven / Gradle 国内源

作者: 山哥Samuel | 来源:发表于2020-12-20 18:27 被阅读0次

    阿里云给大家做了镜像: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")
                }
            }
        }
    }
    
    

    相关文章

      网友评论

        本文标题:Maven / Gradle 国内源

        本文链接:https://www.haomeiwen.com/subject/gepknktx.html