本文介绍了蚂蚁不可改变的属性可变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题。我对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>
但物业dir是不可变的!和所有归档都有名字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>
这篇关于蚂蚁不可改变的属性可变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!