1 Star 0 Fork 20

iSayCheese/gradle-scripts

forked from sxfad/gradle-scripts 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
maven.gradle 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
qiujiayu 提交于 2018-05-31 10:43 . first commit
/**
* maven相关配置;
* 为达到更好的缓存效果,将请求公网仓库的请求删除, 转用私有仓库
* 作者:jiayu.qiu
* 使用方法:在根项目的build.gradle中增加如下代码,进行导入:
* ext{
* sxGradleHome = "https://raw.githubusercontent.com/sxfad/gradle-scripts/master/"
* }
* apply from: sxGradleHome + 'maven.gradle'
*
* 更多内容,请参考 https://github.com/sxfad/gradle-scripts
**/
apply plugin: 'maven'
ext {
REPOSITORY_HOME = 'http://maven.aliyun.com'
REPOSITORY_URL = REPOSITORY_HOME + "/nexus/content/groups/public"
}
allprojects {
repositories {// 使用 mavenCentral()时,将远程的仓库替换为自己搭建的仓库
all {ArtifactRepository repo ->
// println repo.url.toString()
def url = repo.url.toString()
if (repo instanceof MavenArtifactRepository && (url.startsWith("https://repo1.maven.org/maven2") || url.startsWith('https://jcenter.bintray.com/'))) {
project.logger.warn "Repository ${repo.url} removed."
remove repo
} else {
println "maven url:" + url
}
}
maven {
url REPOSITORY_URL
}
}
uploadArchives {
repositories {
mavenDeployer {
snapshotRepository(url: REPOSITORY_HOME + "/nexus/content/repositories/snapshots/") {
authentication(userName: 'xxx', password: 'xxx')
}
repository(url: REPOSITORY_HOME + "/nexus/content/repositories/releases/") {
authentication(userName: 'xxx', password: 'xxx')
}
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/qihualive/gradle-scripts.git
git@gitee.com:qihualive/gradle-scripts.git
qihualive
gradle-scripts
gradle-scripts
master

搜索帮助