英文:
Gradle dependency not working on same version of build
问题
在我们的公司,我们使用Artifactory来管理Gradle的构件和依赖关系。
我们有一个使用Gradle 6.0.1构建的库,此外,还有一个使用Gradle 6.0.1构建的微服务,它将此库作为依赖项。
我验证过这个库在声明的仓库中存在。
当我们尝试构建项目时,我们会收到一个错误,指出在声明的仓库中不存在该库,并且我们应该声明正确的仓库。
奇怪的是,如果我们将微服务降级到Gradle版本5.6.2,该库就可以被下载并且工作正常。
我们还使用其他基于使用Gradle版本4.10.3构建的模板项目的旧微服务进行了测试,它们中也可以正常工作。
可能的问题是什么?
英文:
At our company, we use Artifactory to manage artifacts and dependencies of Gradle.
We have library that was build with Gradle 6.0.1, in addition, have a micro-service that was built with Gradle 6.0.1 that is using this library as a dependency.
I verified that this library exists in the declared repo.
When we try to build the project we get an error that this library doesn't exist in the declared repositories and that we should declare the correct one.
The weird part is that if we downgrade the micro-service to Gradle version 5.6.2 the library does get download and working.
We also tested it with other older micro-services that we have based on a template project that is built with Gradle version 4.10.3 and It's also working in them.
What could be the issue?
答案1
得分: 0
我在问题中提到的那个库并没有与之一起发布的POM文件。
所以,我要么需要再次发布它,并生成POM文件(因为这个库本身是用Gradle构建的,而不是Maven - 有一种方法可以用Gradle生成POM文件)
要么:
我将会在 build.gradle
文件中添加以下代码,这样Gradle将会下载这个artifact,即使它没有POM文件。
repositories {
maven {
url uri('lib')
metadataSources {
artifact()
}
}
}
英文:
The library I was referring to in my question didn't have the POM file published with it.
So either I will need to publish it again with the POM being generated (since the library itself was built with Gradle and not Maven - there is a way to generate POM with Gradle)
or:
I will add the following code to build.gradle
file so Gradle will download the artifact even though it doesn't have POM file.
repositories {
maven {
url uri('lib')
metadataSources {
artifact()
}
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论