我看过各种展示如何列出依赖项的教程,并注意到依赖项的版本号是以两种不同的方式编写的。
在一个教程中,版本号写为:3.8.1.
在另一个教程中是这样写的:${org.springframework-version}
在第二个例子中,它在哪里/如何提取版本号?
谢谢。
在第二种情况下,${org.springframework-version}
引用了pom的properties
部分的一个属性。
<properties>
<org.springframework-version>3.8.1</org.springframework-version>
</properties>
如果您有几个依赖项共享相同的版本号(就像Spring的情况),这种方法是有用的
您可以将其定义为pom.xml中的一个属性:
<properties>
<org.springframework-version>3.8.1</org.springframework-version>
</properties>