Ant:问题:无法创建任务或键入 propertyregex [英] Ant: Problem: failed to create task or type propertyregex

查看:34
本文介绍了Ant:问题:无法创建任务或键入 propertyregex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Ant 1.8.1.我已经下载了 ant-contrib-1.0b3.jar 并将它放在我的 $ANT_HOME/lib 目录中.但是,当我将其包含在我的 build.xml 文件中时...

我收到错误消息问题:无法创建任务或键入 propertyregex.原因:名称未定义."在运行我的 Ant 构建文件时.我还需要做什么才能使这项任务得到认可?

解决方案

propertyregex ant 任务是 ant-contrib,默认情况下不包含在任何 apache-ant 安装中.

您必须正确安装ant-contrib.从 ant-contrib 页面,您有两个选择:

<块引用>

  1. 复制ant-contrib-0.3.jar到你的Ant的lib目录下安装.如果您想在自己的项目中使用其中一项任务,添加行 <taskdefresource="net/sf/antcontrib/antcontrib.properties"/> 到您的构建文件.

  2. ant-contrib-0.3.jar 保存在单独的位置.你现在必须明确告诉 Ant 在哪里可以找到它(比如在 /usr/share/java/lib 中):



    <代码><路径元素location="/usr/share/java/lib/ant-contrib-0.3.jar"/>

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:

  1. 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.

  2. 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>

这篇关于Ant:问题:无法创建任务或键入 propertyregex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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