我想从我的ant脚本生成一个属性文件,其中包含我的项目的svn版本号。我是做的方式1/3:java:生成一个包含svn版本号的属性文件
要做到这一点,我需要:
使用svnversion,如果
把结果中,在我的构建路径
结束了一个属性文件我有点与1a和2.任何想法失去了什么?
我想从我的ant脚本生成一个属性文件,其中包含我的项目的svn版本号。我是做的方式1/3:java:生成一个包含svn版本号的属性文件
要做到这一点,我需要:
使用svnversion,如果
把结果中,在我的构建路径
结束了一个属性文件我有点与1a和2.任何想法失去了什么?
没关系,我得到它的工作:
<target name="svnversion">
<echo file="${srcDir}/${packagePath}/svnversion.properties">svnversion=</echo>
<exec executable="svnversion"
output="${srcDir}/${packagePath}/svnversion.properties" append="true">
</exec>
</target>
我使用的是执行svn info --xml
,然后使用<XmlProperty>
task加载得到的xml文件,最后只是替换构建路径路径的属性文件中的一个令牌。
因此,像这样:
<target name="svn-build-number">
<tempfile property="svninfo.file"/>
<exec dir="." executable="svn" output="${svninfo.file}">
<arg line="info --xml"/>
</exec>
<echo message="${svninfo.file}" />
<xmlproperty file="${svninfo.file}" collapseAttributes="true" />
<echo message="${info.entry.revision}" />
</target>
在${info.entry.revision}
是在当前目录库的修订。
,而不是温度。文件,你可以使用一个属性: < propertyresource name =“svninfo.xml”/> xml property> –
kabado
2010-08-06 10:30:28