Gradle依赖在相同版本的构建上无法正常工作。

huangapple go评论58阅读模式
英文:

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()
    }
}

}

huangapple
  • 本文由 发表于 2020年8月17日 19:48:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/63450180.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定