Vla*_*sov 5 java ant build maven
我有个问题.我使用antrun插件为maven做下一步:我有文件夹和子文件夹(我不知道所谓的子文件夹及其编号),我正在为这个子文件夹存档及其名称(子文件夹名称 - "1 ",存档名称 - "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>
Run Code Online (Sandbox Code Playgroud)
但属性目录是不可改变的!并且所有存档都有名称"1.acp".如何使这个属性变得可变或以另一种方式做到这一点?
您可以使用1.8 Ant的本地任务
在你的情况下:
<sequential>
<local name="dir"/>
<basename property="dir" file="@{file}"/>
<zip
destfile="${project.build.outputDirectory}/alfresco/extension/agilent/${dir}.acp"
basedir="${dir}"
/>
</sequential>
Run Code Online (Sandbox Code Playgroud)