apache - 我可以使用ivy.xml文件中的属性来避免重复依赖性的版本号吗?

标签 apache dependencies ivy

这是我的ivy.xml现在的样子:

<dependency org="org.springframework" name="org.springframework.core" rev="3.0.2.RELEASE" />
<dependency org="org.springframework" name="org.springframework.context" rev="3.0.2.RELEASE" />
<dependency org="org.springframework" name="org.springframework.jdbc" rev="3.0.2.RELEASE" />
<dependency org="org.springframework" name="org.springframework.beans" rev="3.0.2.RELEASE" />
<dependency org="org.springframework" name="org.springframework.jms" rev="3.0.2.RELEASE" />

这是我想要的样子:
<dependency org="org.springframework" name="org.springframework.core" rev="${spring.version}" />
<dependency org="org.springframework" name="org.springframework.context" rev="${spring.version}" />
<dependency org="org.springframework" name="org.springframework.jdbc" rev="${spring.version}" />
<dependency org="org.springframework" name="org.springframework.beans" rev="${spring.version}" />
<dependency org="org.springframework" name="org.springframework.jms" rev="${spring.version}" />

这可能吗?语法是什么?

最佳答案

我最终使用XML实体进行替换。这样可以将所有内容保存在同一文件中,这对我的用例很重要。

<?xml version="1.0"?>
<!DOCTYPE ivy-module [
    <!ENTITY spring.version "3.0.2.RELEASE">
]>
<ivy-module version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd">

    <info organisation="org" module="mod"/>

    <dependencies>
        <dependency org="org.springframework" name="org.springframework.core" rev="&spring.version;" />
        <dependency org="org.springframework" name="org.springframework.context" rev="&spring.version;" />
        <dependency org="org.springframework" name="org.springframework.jdbc" rev="&spring.version;" />
        <dependency org="org.springframework" name="org.springframework.beans" rev="&spring.version;" />
        <dependency org="org.springframework" name="org.springframework.jms" rev="&spring.version;" />
    </dependencies>
</ivy-module>

关于apache - 我可以使用ivy.xml文件中的属性来避免重复依赖性的版本号吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2996048/

相关文章:

java - 将 Apache Ivy 与 netbeans 结合使用

ivy - 使用递归 Ivy 交付或发布的示例

java - 错误: "org.apache.axis2.AxisFault: Transport error: 403 Error: Forbidden"

以 makefile 作为依赖项的 Makefile 目标

android - 离线时运行 flutter - 卡在 Resolving Dependencies

java - NetBeans 中的 Apache Ivy 用于解析导入

linux - CGI 中的 SSL 套接字通信是个好主意吗?

mysql - apt-get 更新操作卡在 0 显示 0% [工作中]

java - Tomcat6连接mySQL问题

c# - 如何手动编辑 Visual Studio 项目的 list 以明确指定引用的程序集?