大家好,请尽快帮助...这是我的代码,用于将所有.txt文件从一个位置复制到另一个位置:
<copy todir="../new/dir">
<fileset dir="C:/build/build">
<include name="**/*.txt"/>
</fileset>
</copy>
Run Code Online (Sandbox Code Playgroud)
尽管它工作正常,它正在正确地复制文件,但问题是它是维护目的地非空目录的目录结构,我想要"C:/ build/build"及其子目录下的所有文件建议立即进行删除
大家好,请看一下这段代码
在我的属性文件中,我有 win-x86.pc-shared-location=E:\Ant_Scripts
Now below i am trying to call PrintInstallerName_build from my build.xml,while as PrintInstallerName_build is in test.xml. In build.xml file,${platform.id} has value=win-x86 in the calling target and in called target param1 also has value=win-x86
<target name="PrintInstallerName" >
<echo>PlatForm.Id====>${platform.id}</echo>
<ant antfile="test.xml" target="PrintInstallerName_build">
<property name="param1" value="${platform.id}"/>
</ant>
<target name="PrintInstallerName_build" >
<echo>${param1.pc-shared-location}</echo><!--${param1.pc-shared-location}-->
<echo>${param1}.pc-shared-location}</echo><!--win-x86.pc-shared-location-->
<echo>${win-x86.pc-shared-location}</echo><!--E:\\Ant_Scripts-->
</target>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,只有最后一条语句给出了正确的输出,但它是硬编码的,我想使用 param1 并且输出应该是E:\\Ant_Scripts我尝试使用 $ 和 @ 但没有任何效果,可能是我在某处做错了有人可以帮忙吗,我我很震惊,明天就是它的国防部。
这是一小段代码,请看一下然后按照说明进行操作......
<condition property="${param1}">
<or>
<istrue value="win-x86"/>
<istrue value= "win-x86-client"/>
<istrue value= "win-x64"/>
</or>
</condition>
<target name="Mytarget" if="${param1}">
<echo message="executing windows family build:::${param1}"/>
</target>
<target name="print.name" >
<antcall target="win-x86-build">
<param name="param1" value="${platform.id}"/>
</antcall>
</target>
Run Code Online (Sandbox Code Playgroud)
我希望当 platform.id 包含任何 Windows 系列名称时,它应该打印该消息EXECUTING WINDOWS FAMILY BUILD,但问题是即使该系列是 Unix,它也会打印此消息。
我想要么是我没有正确检查情况,要么是我犯了其他错误。
有人可以帮我解决这个问题吗?
ant ×3