想发布依赖到本地或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 保存到本地即可
网友评论