apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'maven-publish' // 声明aar包的版本号 def aarVersion = "0.0.1.101" android { compileSdkVersion versions.compileSdk buildToolsVersion versions.buildTools defaultConfig { minSdkVersion versions.minSdk targetSdkVersion versions.targetSdk flavorDimensions "versioncode" buildConfigField("String", "APP_ID", "\"" + apps.applicationId + "\"") } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } productFlavors productF namespace 'com.xuqm.base' } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) api androidxDependencies implementation 'androidx.appcompat:appcompat:1.3.0' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'org.jetbrains.anko:anko-commons:0.10.5' annotationProcessor compilerDependencies commonDependencies.each { k, v -> api(v) { //去除第三方的重复support库 exclude group: 'com.android.support' } } //扫码二维码 api 'com.huawei.hms:scanplus:1.1.1.301' } // 这个是把源码打入aar包中的任务 task sourceJar(type: Jar) { archiveClassifier.set('sources') from android.sourceSets.main.java.srcDirs } afterEvaluate { publishing { publications { // 这里的debug名字是自己起的 release(MavenPublication) { groupId = 'cn.org.bjca.trust.android' artifactId = 'base' version = aarVersion // 这里除了有debug 还有release from components.release // 运行任务,把源码打进去 artifact sourceJar } } // 添加仓库地址 repositories { // 本地仓库 // mavenLocal() // 当上传到远端仓库 // maven { // allowInsecureProtocol true // url("http://nexus.51trust.net/repository/android-hosted/") // credentials { // username = "deployment" // password = "deployment123" // } // } maven { allowInsecureProtocol true url("http://xuqinmin.com.cn:8081/repository/android-releases/") credentials { username = "admin" password = "xuqinmin1022" } } } } }