Skip to content

Gradle 7 使用 maven-publish 上传 aar 包

约 113 字小于 1 分钟

Android

2023-10-21

plugins {
    id 'com.android.library'
    id 'maven-publish'
}

android {
    compileSdk 33
    defaultConfig {
        // 配置默认属性
    }
    version = '1.2.0.0'
    // 其他 Android 配置
}


publishing {
    publications {
        release(MavenPublication) {
            // 必须有这个 否则不会上传AAR包
            afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) } 

            group = 'com.test.googlebilling'
            version = '1.2.0.0'

        }
    }
//    repositories {
//        maven {
//            url = uri('http://repository/')
//            allowInsecureProtocol = true
//            credentials {
//                username = ''
//                password = ''
//            }
//        }
//    }

    repositories {
        repositories {
            maven {
                url = '../repo'
            }
        }
    }
}