第1步:上传本地仓库
在子module的build.gradle中,加入如下代码,实现打包至本地目录仓库
apply plugin: 'maven-publish'
........
........
afterEvaluate {
publishing {
repositories {
maven {
url uri("../repo")
}
}
publications {
release(MavenPublication) {
from components.release
groupId "xxx.xxx.xxx"
artifactId "xxx"
version "1.0.0"
}
debug(MavenPublication) {
from components.debug
groupId "xxx.xxx.xxx"
artifactId "xxx"
version "1.0.0"
}
}
}
}
第2步:项目引用该本地仓库
在项目根目录下的build.gradle中引入
allprojects {
repositories {
google()
mavenCentral()