[英]Issues pulling artifacts or dependencies using Gradle from artifactory
So, here is what I want to do: 所以,这是我想做的:
From what I understand it can be done using Gradle Artifactory Plugin. 据我了解,可以使用Gradle Artifactory插件来完成。
Below is the sample build.gradle : 以下是示例build.gradle:
buildscript {
repositories {
jcenter()
}
}
dependencies {
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.1.0'
}
}
apply plugin: "com.jfrog.artifactory"
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'eclipse-wtp'
apply plugin: 'war'
group = 'a.b.c'
allprojects {
apply plugin: 'artifactory'
}
configurations{
...
}
dependencies {
compile group: 'a', name: 'b', version:'c'
compile group: 'x', name: 'y', version:'z'
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'gradle-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
ivy {
ivyLayout = '[organization]/[module]/ivy-[revision].xml'
artifactLayout = '[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]'
mavenCompatible = false
}
}
}
resolve {
repository {
repoKey = 'gradle'
repoKey = 'gradle-release-local'
maven = true
}
}
}
Sample Settings.gradle 样本Settings.gradle
rootProject.name = ‘partnering'
includeFlat ‘a'
project(‘:a').projectDir=new File(settings,'../a')
Note: 注意:
In dependencies, as you can see 如您所见,在依赖项中
ERROR: 错误:
Can somebody please let me with this issue. 有人可以让我解决这个问题吗?
gradle
is a virtual repository, it aggregates number of other repositories in it. gradle
是一个虚拟存储库,它汇总了其中的其他存储库数量。
In the repositories configuration, make sure that gradle
virtual repository contains the gradle-release-local
repository. 在存储库配置中,确保gradle
虚拟存储库包含gradle-release-local
存储库。
Once done, only leave one repoKey
for resolution, gradle
. 完成后,仅保留一个repoKey
进行解析,即gradle
。
When you want to pull dependencies from a remote repository, you need to define them in build.gradle
. 当您要从远程存储库中提取依赖项时,需要在build.gradle
定义它们。 Pushing libraries to a repository is isolated from pulling libraries. 将库推送到存储库与提取库是隔离的。
The following example contains two examples. 下面的示例包含两个示例。 One for maven central and and one for a custom repository. 一个用于Maven Central ,另一个用于自定义存储库。
repositories {
mavenCentral()
maven {
url "http://www.edwardraff.com/maven-repo/"
}
}
Look into the documentation . 查看文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.