Android开发之maven私服打包和上传gradle配置

apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 29
        versionCode 1
        versionName "0.1.0zc127"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = [AROUTER_MODULE_NAME: project.getName()]
            }
        }
    }

    buildTypes {
        debug {
            buildConfigField("String", "PLUGIN_VERSION_NAME", "\"" + defaultConfig.versionName + "\"")
        }

        sdk {

        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField("String", "PLUGIN_VERSION_NAME", "\"" + defaultConfig.versionName + "\"")
        }
    }
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

//    implementation project(':WyzePlatformKit')
    kapt 'com.alibaba:arouter-compiler:1.2.2'
    implementation group: 'com.wyze.android', name: 'wpk', version: '2.11.0.a902', changing: true
    implementation 'com.google.android.material:material:1.3.0'
    //注解处理器
    kapt 'com.wyze.android:compiler:1.0.6'
}
uploadArchives {
    repositories {
        mavenDeployer {
            Properties properties = new Properties()
            InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream();
            properties.load(inputStream)
            def NEXUS_REPOSITORY_URL = "https://cangku.favorlink.com.cn/repository/company_leedarson/"
            def POM_GROUP = "com.xiayiye5"
            def POM_ARTIFACT = "yhsh"
            def POM_VERSION = android.defaultConfig.versionName
            def POM_PACKAGING = "aar"
            def POM_USERNAME = properties.getProperty('maven.username')
            def POM_PASSWORD = properties.getProperty('maven.password')
            repository(url: NEXUS_REPOSITORY_URL) {
                authentication(userName: POM_USERNAME, password: POM_PASSWORD)
                pom.project {
                    groupId = POM_GROUP
                    artifactId = POM_ARTIFACT
                    packaging = POM_PACKAGING
                    version = POM_VERSION
                }
            }
        }
    }
}

再看下账号和密码配置

在local.properties文件中定义

## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Wed Jan 06 11:06:55 CST 2021
sdk.dir=/Users/xiayiye5/Library/Android/sdk
maven.username=company_xiayiye5_android
maven.password=e4d4e10e-ded5-11eb-a5a8-0a80ff2603de

猜你喜欢

转载自blog.csdn.net/xiayiye5/article/details/119424064