maven_push.gradle 1.12 KB
apply plugin: 'maven'

uploadArchives() {
    repositories {
        mavenDeployer {
            def lib = out_shared
            //发布环境(正式/测试)
            android.defaultPublishConfig lib.debug ? "debug" : "release"
            //发布渠道(地址/账号)
            repository(url: maven.mavenMixedUrl) {
                authentication(userName: maven.mavenUserName, password: maven.mavenPwd)
            }
            //发布信息(包名/别名/版本)
            pom.project {
                groupId lib.packeg
                artifactId lib.name
                version = lib.debug ? lib.version.concat("-SNAPSHOT") : lib.version
            }
            pom.whenConfigured { pom ->
                List list = new ArrayList()
                //手动增加过滤项
                pom.dependencies.findAll {
                    dep -> dep.groupId == "pub.devrel" || dep.groupId == "com.chensl.rotatephotoview"
                }.collect { dep -> list.add(dep) }
                //移除支持库
                pom.dependencies.clear()
                pom.dependencies.addAll(list)
            }

        }
    }
}