如何在Ant的Available命令中使用通配符

ian*_*ayo 17 java ant

我正在使用Ant构建脚本来整理基于Eclipse的应用程序以进行分发.

构建的一个步骤是检查构建文件夹中是否存在正确的库.我目前使用Ant命令.不幸的是,每次切换到新的Eclipse构建时我都必须修改脚本(因为版本号会更新).

我不需要检查版本号,我只需要检查文件是否存在.

那么,我该如何检查:

org.eclipse.rcp_3.5.0.*
Run Code Online (Sandbox Code Playgroud)

代替:

org.eclipse.rcp_3.5.0.v20090519-9SA0FwxFv6x089WEf-TWh11
Run Code Online (Sandbox Code Playgroud)

用Ant?

欢呼,伊恩

Von*_*onC 23

你的意思是,像(基于pathconvert任务,在这个想法之后):

<target name="checkEclipseRcp">
  <pathconvert property="foundRcp" setonempty="false" pathsep=" ">
    <path>
      <fileset dir="/folder/folder/eclipse"
               includes="org.eclipse.rcp_3.5.0.*" />
    </path>
  </pathconvert>
</target>

<target name="process" depends="checkEclipseRcp" if="foundRcp">
  <!-- do something -->
</target>
Run Code Online (Sandbox Code Playgroud)


Vad*_*zim 7

使用resourcecount条件的稍微简短且更简单的方法:

<target name="checkEclipseRcp">
    <condition property="foundRcp">
        <resourcecount when="greater" count="0">
            <fileset file="/folder/folder/eclipse/org.eclipse.rcp_3.5.0.*"/>
        </resourcecount>
    </condition>
</target>

<target name="process" depends="checkEclipseRcp" if="foundRcp">
  <!-- do something -->
</target>
Run Code Online (Sandbox Code Playgroud)