蚂蚁:问题:无法创建任务或类型propertyregex [英] Ant: Problem: failed to create task or type propertyregex
问题描述
我使用蚂蚁1.8.1。我已经下载蚂蚁的contrib-1.0b3.jar并把它放在我的$ ANT_HOME / lib目录下。然而,当我有这个在我的build.xml文件...
< propertyregex财产=selenium.email.success.subject
输入=package.ABC.name
正则表达式=(。*)__ __ ENV(。*)
取代=\\ 1 $ {buildtarget} \\ 2
覆盖=真
= CASESENSITIVE假/>
我得到的错误问题:无法创建任务或键入propertyregex原因:。这个名字是未定义一旦运行我的Ant构建文件。还有什么,我需要做的就是这项工作的认可?
的 propertyregex
Ant任务的ant-contrib ,并且默认情况下不以任何 Apache的蚂蚁的安装在内。
您必须正确安装蚂蚁的contrib
。从蚂蚁的contrib 页面,你有两个选择:
蚂蚁的contrib-0.3.jar
复制到Ant的lib目录
安装。如果你想使用的任务之一,在自己的项目,
添加行<的taskdef
到您的构建
资源=网/ SF / antcontrib / antcontrib.properties/>
文件。
请
蚂蚁的contrib-0.3.jar
在单独的位置。现在,您可以
告诉Ant明确哪里可以找到它(发言权的/ usr /共享/ Java的/ lib目录
)
<的taskdef资源=网/ SF / antcontrib / antcontrib.properties>
结果
<&类路径GT;
结果
< pathelement
结果
位置=在/ usr /共享/ Java的/ lib目录/蚂蚁的contrib-0.3.jar/>
< /类路径>
结果
< /&的taskdef GT;
块引用>I'm using Ant 1.8.1. I have downloaded ant-contrib-1.0b3.jar and placed it in my $ANT_HOME/lib directory. However, when I include this in my build.xml file ...
<propertyregex property="selenium.email.success.subject" input="package.ABC.name" regexp="(.*)__ENV__(.*)" replace="\1${buildtarget}\2" override="true" casesensitive="false" />
I get the error "Problem: failed to create task or type propertyregex. Cause: The name is undefined." upon running my Ant build file. What else do I need to do to get this task recognized?
解决方案The
propertyregex
ant task is part of ant-contrib, and not included by default in any apache-ant installation.You have to properly install
ant-contrib
. From the ant-contrib page, you have two choices:
Copy
ant-contrib-0.3.jar
to the lib directory of your Ant installation. If you want to use one of the tasks in your own project, add the line<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
to your build file.Keep
ant-contrib-0.3.jar
in a separate location. You now have to tell Ant explicitly where to find it (say in/usr/share/java/lib
):
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="/usr/share/java/lib/ant-contrib-0.3.jar"/>
</classpath>
</taskdef>
这篇关于蚂蚁:问题:无法创建任务或类型propertyregex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!