Step into Gradle - 05 - 仓库

Gradle

目录

摘要

定义远程仓库,定义本地仓库,发布到远程仓库,发布到本地仓库

仓库

远程仓库

Maven 中央仓库
repositories {
    mavenCentral()
}
JCenter 仓库
repositories {
    jcenter()
}
ivy 仓库
repositories {
    ivy {
        url "../repo"
    }
}
自定义 Maven 仓库
repositories {
    maven {
        url "http://repo.mycompany.com/maven2"
    }
}

本地仓库

本地 FlatDir
repositories {
   flatDir {
        dirs 'libs'
   }
}

发布

发布到 ivy 仓库
uploadArchives {
    repositories {
        ivy {
            credentials {
                username "username"
                password "pw"
            }
            url "http://repo.mycompany.com"
        }
    }
}
发布到 Maven 仓库
apply plugin: 'maven'

uploadArchives {
    repositories {
        mavenDeployer {
            snapshotRepository(url: RESP_SNAPSHOT_URL) {
                authentication(userName: RESP_SNAPSHOT_USERNAME, password: RESP_SNAPSHOT_PASSWORD)
            }
            repository(url: RESP_RELEASE_URL) {
                authentication(userName: RESP_RELEASE_USERNAME, password: RESP_RELEASE_PASSWORD)
            }

            pom.artifactId = POM_ARTIFACT_ID
            pom.groupId = POM_GROUP_ID
            pom.version = POM_VERSION

            pom.project {
                name POM_NAME
                description POM_DESCRIPTION
                packaging POM_PACKAGING
            }
        }
    }
}
发布到本地仓库
uploadArchives{
    repositories {
        flatDir {
            dirs 'repos'
        }
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值