Java Library
// publish_local_java.gradle
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
groupId 'com.wlqq.android'
artifactId POM_ARTIFACT_ID
version POM_VERSION_NAME
from components.java
// more goes in here
}
}
repositories {
mavenLocal()
}
}
Android Library
// publish_local_android.gradle
apply plugin: 'maven-publish'
publishing {
publications {
library(MavenPublication) {
groupId 'com.wlqq.android'
artifactId project.name
version android.defaultConfig.versionName
// 若是 android gradle plugin 3.3.x ,这里需要改成 bundleReleaseAar
artifact(bundleRelease)
}
}
repositories {
mavenLocal()
}
}
如何使用
- 在 library project 的
build.gradle
中 apply
该脚本
- 执行命令
./gradlew <library module name>:PublishToMavenLocal
参考