以下是我的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}" />
这可能吗?语法是什么?
答案 0 :(得分:28)
我最终使用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>
答案 1 :(得分:13)
语法是正确的。您需要做的就是在某处设置ANT属性。
例如
ant -Dspring.version=3.0.2.RELEASE
另一种方法是将属性声明添加到 ivysettings.xml 文件中
<ivysettings>
<property name="spring.version" value="3.0.2.RELEASE"/>
<settings defaultResolver="maven2"/>
<resolvers>
<ibiblio name="maven2" m2compatible="true"/>
</resolvers>
</ivysettings>
答案 2 :(得分:0)
您可以按照以下说明使用属性文件:http://apache-ivy.996301.n3.nabble.com/ivyde-properties-on-ivy-xml-td7484.html
<properties file="${ivy.project.dir}/build.properties" />
站点ivysettings.xml