美文网首页
MavenPublish

MavenPublish

作者: DonaldDu | 来源:发表于2021-03-27 21:54 被阅读0次

想发布依赖到本地或Nexus仓库(带源码),非常简单!

//add to rootProject bottom
apply from: "https://gitee.com/DonaldDu/OpenGradleScript/raw/master/mavenPublish.gradle"

//publish lib
mavenPublish("group:artifactId:version")

以下是下载到本地的使用方式

init.gradle

apply from: 'privateRepository.gradle'
apply from: 'mavenPublish.gradle'

privateRepository.gradle

allprojects {
    ext {
        PRIVATE_NEXUS_REPOSITORY = 'http://www.nexus.com/'
        PRIVATE_NEXUS_USER = 'xxx'
        PRIVATE_NEXUS_PASSWORD = 'xxx'
    }

    ext.privateRepository = {
        maven {
            url PRIVATE_NEXUS_REPOSITORY
            credentials { username PRIVATE_NEXUS_USER; password PRIVATE_NEXUS_PASSWORD }
        }
    }

    repositories {
        with(privateRepository)
    }
        
    buildscript {
        repositories {
            with(privateRepository)
        }
    }
}

最后下载 mavenPublish.gradle 保存到本地即可

相关文章

  • MavenPublish

    想发布依赖到本地或Nexus仓库(带源码),非常简单! 以下是下载到本地的使用方式 init.gradle pri...

网友评论

      本文标题:MavenPublish

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