使用ant-contrib请,如何使用"&的endsWith QUOT ;? [英] Use ant-contrib,how to use "endsWith"?

查看:192
本文介绍了使用ant-contrib请,如何使用"&的endsWith QUOT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

蚂蚁的contrib最新版本是蚂蚁的contrib-1.0b3.jar

http://ant-contrib.sourceforge.net/tasks/tasks/ more_conditions.html

本文档显示的endsWith 状态

但是我用蚂蚁1.8.2和蚂蚁的contrib-1.0b3.jar ,我上无法找到的endsWith 状态

 <如果>        <字符串的endsWith =D:\\飞龙软\\基本\\开发\\库\\组织\\ springframework的\\弹簧豆与=春豆/>
        <然后>
            <回声>&等于LT; /回声>
        < /然后>
        <否则>
            <回声>不等于< /回声>
        < /&其他GT;
    < /若>

但结果是:

 构建失败
E:\\工作区\\飞龙\\飞龙平台\\工具\\飞龙工具 - 蚂蚁\\的build.xml:32:如果
不支持嵌套的endsWith元素。总时间:1秒


解决方案

在检查来自antcontrib(版本1.0b2或1.0b3)来源特别是网​​/ SF / antcontrib / antcontrib.properties ../ antlib.xml
你会看到,有没有 startsWith 的endsWith 的条件,虽然它在的 antcontrib手动


这两个条件从羚羊项目,它提供了运行ant和几个Ant任务的用户界面产生。
几年前,有计划有AntContrib合并羚羊,看到的羚羊任务与AntContrib 并羚羊项目现场合并:


  

羚羊项目还提供了一组额外的任务
  提供的功能与发布的标准任务未找到
  蚂蚁。工作正在进行与AntContrib合并羚羊任务
  项目。照片[.​​..]结果蚂蚁的Contrib项目是任务的集合
  (在一个点,也许类型和其他工具)对Apache Ant的。一些
  羚羊的任务,现在是项目的一部分。


但不知何故,这些合并计划停滞不前,永远不会结束得当,也Antcontrib似乎是死了 - 的 nofollow的>最新版本1.0b3

不管怎样,你既可以使用蚂蚁用antcontrib条件匹配

 <项目>
 <! - 进口AntContrib - >
 <的taskdef资源=网/ SF / antcontrib / antlib.xml/>
 <属性名=foo的值=D:\\飞龙软\\基本\\开发\\库\\组织\\ springframework的\\弹簧豆/> <如果>
 <相匹配的字符串=$ {}富模式=^ +弹簧豆$/>
  <然后>
   <回声>&等于LT; /回声>
  < /然后>
  <否则>
   <回声>不等于< /回声>
  < /&其他GT;
 < /若>
< /项目>

羚羊Ant任务的。

the ant-contrib lastest version is ant-contrib-1.0b3.jar?

http://ant-contrib.sourceforge.net/tasks/tasks/more_conditions.html

this document show endsWith condition

But I use ant 1.8.2 And ant-contrib-1.0b3.jar, I cann't find the endsWith condition

    <if>

        <endswith string="D:\FeiLong Soft\Essential\Development\repository\org\springframework\spring-beans" with="spring-beans" />
        <then>
            <echo>equals</echo>
        </then>
        <else>
            <echo>not equals</echo>
        </else>
    </if>

But result:

BUILD FAILED
E:\Workspaces\feilong\feilong-platform\tools\feilong-tools-ant\build.xml:32: if
doesn't support the nested "endswith" element.

Total time: 1 second

解决方案

When checking the sources from antcontrib (version 1.0b2 or 1.0b3) especially net/sf/antcontrib/antcontrib.properties and ../antlib.xml you'll see, there is no startsWith or endsWith condition, though it's mentioned in the antcontrib manual.

Those two conditions originate from the Antelope project, which provides a UI for running ant and several ant tasks. Years ago there were plans to merge Antelope with AntContrib, see Antelope Tasks Merging with AntContrib and Antelope project site :

The Antelope Project also provides a set of additional tasks that provide functionality not found in the standard tasks distributed with Ant. Work is underway to merge the Antelope tasks with the AntContrib project.
[...]
The Ant-Contrib project is a collection of tasks (and at one point maybe types and other tools) for Apache Ant. Some of the Antelope tasks are now part of that project.

But somehow those merging plans stagnated and never finished properly, also Antcontrib seems to be dead - latest release 1.0b3 from 2006-11-02

Anyway, you may either use the ant matches condition with antcontrib :

<project>
 <!-- Import AntContrib -->
 <taskdef resource="net/sf/antcontrib/antlib.xml"/>
 <property name="foo" value="D:\FeiLong Soft\Essential\Development\repository\org\springframework\spring-beans"/>

 <if>
 <matches string="${foo}" pattern="^.+spring-beans$"/>
  <then>
   <echo>equals</echo>
  </then>
  <else>
   <echo>not equals</echo>
  </else>
 </if>
</project>

or the Antelope ant tasks.

这篇关于使用ant-contrib请,如何使用&QUOT;&的endsWith QUOT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆