美文网首页Android 开发
创建lib上传到maven

创建lib上传到maven

作者: 小领袖 | 来源:发表于2021-07-22 11:14 被阅读0次

    local.properties配置

    maven.url=http\://repo.cho.cn/nexus/content/repositories/releases/
    maven.user=admin
    maven.password=12345677
    version=0.0.0.1
    

    build.gradle 配置

    uploadArchives {
        // 读取本地配置文件
        Properties properties = new Properties()
        properties.load(project.rootProject.file('gradle.properties').newInputStream())
        def userName = properties.getProperty('maven.user')
        def password = properties.getProperty('maven.password')
        def mavenUrl = properties.getProperty('maven.url')
        def libVersion = properties.getProperty('version')
        repositories {
            mavenLocal()
            repositories.mavenDeployer {
                repository(url: mavenUrl) {
                    authentication(userName: userName, password: password)
                }
                pom.project {
                    groupId 'com.cho.lib.analysis'
                    artifactId 'analysis'
                    version libVersion
                    packaging 'aar'
                }
            }
        }
    
        task androidSourcesJar(type: Jar) {
            classifier = 'sources'
            from android.sourceSets.main.java.sourceFiles
        }
        artifacts {
            archives androidSourcesJar
        }
    }
    
    
    

    相关文章

      网友评论

        本文标题:创建lib上传到maven

        本文链接:https://www.haomeiwen.com/subject/jbuemltx.html