依赖版本格式:$ {version.XXX} [英] Dependency Version Format: ${version.XXX}

查看:132
本文介绍了依赖版本格式:$ {version.XXX}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的pom.xml文件中,我使用格式{version.XXX}对依赖项版本进行了大量引用.例如:

In my pom.xml file, I have a lot of references to the dependency version using the format {version.XXX}. For example:

    <dependency>
        <groupId>com.extjs</groupId>
        <artifactId>gxt</artifactId>
        <version>${version.gxt}</version>
    </dependency>

我很难找到有关这种格式的信息.我的假设是,这用于处理您具有引用相同的artifactId的多个依赖项的方案.这将使我们仅将版本信息维护在一个地方.因此$ {version.XXX}的含义类似于为其他地方引用的XXX artificatId查找版本属性".

I'm having a hard time finding information on this kind of format. My assumption is that this is used for handling scenarios where you have multiple dependencies that reference the same artifactId. This would allow us to only maintain the version information in one place. So ${version.XXX} would mean something like "find the version attribute for the XXX artificatId referenced somewhere else".

我的问题:

  1. 我的假设正确吗?如果没有,请纠正我!
  2. 如果我的假设正确,那么必须遵循某些规则才能正确使用此规则吗?例如,在列出使用$ {version.XXX}格式的依赖项之前,是否必须首先列出包含pom.xml并提供XXX工件版本信息的依赖项?

推荐答案

这只是属性的替换,因此,在此pom或其中一个父项中的某个位置,您必须将版本列为属性,例如:

This is just a property replacement, so somewhere in either this pom or in one of the parents you must list the version as a property, like this:

<properties>
    <version.gxt>your version goes here</version.gxt>
</properties>

这篇关于依赖版本格式:$ {version.XXX}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆