本文介绍了Gradle依赖关系 - 最新快照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在一个项目中,我定义了对其他JAR的一些依赖关系,并且使用'+'来始终依赖在最新版本的JAR上

 运行时组:'com.app',名称:'core',版本:' +'

这个工程很棒,任何时候我重建一个核心项目的版本,这个项目按照预期获得最新的JAR。然而,这似乎只在我明确构建带有版本的JAR时才起作用 - 但SNAPSHOT构建不会被拾取。

例如,如果我有 core-1.0.1.jar 那么我的项目就使用它,然后我建立<$>

c $ c> core-1.0.2.jar ,并且该项目将打开新的jar文件,但是如果我然后构建像 core-SNAPSHOT这样的jar快照版本。 jar ,那么该项目仍然使用1.0.2版本。



(我知道它不太好依赖快照 - 但我会运行这个机智h我的CI服务器构建编号版本并安装到回购站,但是在开发中我希望能够构建adhoc快照构建并能够在不更改配置的情况下使用它们)

这可能吗?我一直无法找到任何有关这样做的信息吗?通常,快照总是包含版本号(例如 1.0.3-SNAPSHOT )。我认为它没有选择它,因为现在 SNAPSHOT 被认为是低于 1.0.2 的版本


I have a gradle multi-project build.

In one project, I have defined some dependencies on other JARs, and have used the '+' to always depend on the latest version of the JAR e.g.

runtime group:'com.app', name: 'core', version: '+'

This works great, and anytime I re-build a version of the core project, this project picks up the latest JAR as expected.

However, this only seems to work when I explicitly build the JAR with a version - but SNAPSHOT builds are not picked up.

For example, if I have core-1.0.1.jar then my project uses that, then I build core-1.0.2.jar and the project will pcik up that new jar, however if I then build a snapshot version of the jar like core-SNAPSHOT.jar, then the project remains using 1.0.2 version.

(I know its not good to depend on snapshots - but I will be running this with my CI server building the numbered versions and installing to the repo, but when in dev I want to be able to build adhoc snapshot builds and be able to use them without changing config)

Is this possible? I have not been able to find any info about doing this?

解决方案

Normally, snapshots always include a version number (e.g. 1.0.3-SNAPSHOT). I think it's not picking it up because as it stands, SNAPSHOT is considered a lower version than 1.0.2.

这篇关于Gradle依赖关系 - 最新快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 08:59