Ant 不可变属性变为可变 [英] Ant immutable properties to mutable
本文介绍了Ant 不可变属性变为可变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有问题.我正在使用 maven 的 antrun 插件并执行下一步:我有文件夹和子文件夹(我不知道什么叫做子文件夹及其编号),我正在使用它们的名称(子文件夹名称 - 1", 存档名称 - "1.acp").
i have a problem. I'm use antrun plugin for maven and do next: i have folder and subfolders(I do not know what are called sub-folders and their number) and i'm do archive for this subfolders with their name(subfolder name - "1", archive name - "1.acp").
<tasks>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${settings.localRepository}/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar" />
<for param="file">
<path>
<dirset dir="src/main/bootstrap" includes="/*" />
</path>
<sequential>
<basename property="dir" file="@{file}" />
<zip destfile="${project.build.outputDirectory}/alfresco/extension/agilent/${dir}.acp" basedir="@{file}" />
</sequential>
</for>
</tasks>
但是属性目录是不可变的!!!并且所有存档都具有名称1.acp".如何使此属性可变或以其他方式执行此操作?
But property dir is immutable!!! And all archive has name "1.acp". How to make this property mutable or do this another way?
推荐答案
您可以使用 1.8 Ant 的 本地任务
You may use a 1.8 Ant's Local task
就你而言:
<sequential>
<local name="dir"/>
<basename property="dir" file="@{file}"/>
<zip
destfile="${project.build.outputDirectory}/alfresco/extension/agilent/${dir}.acp"
basedir="${dir}"
/>
</sequential>
这篇关于Ant 不可变属性变为可变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文