25 Star 42 Fork 19

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')
}
}
}
}
}
Java
1
https://gitee.com/sxfad/gradle-scripts.git
git@gitee.com:sxfad/gradle-scripts.git
sxfad
gradle-scripts
gradle-scripts
master

搜索帮助