(是的,我已经阅读并发挥各地根据答案,在这个论坛类似的问题,在许多其他如JavaRanch的 - 没有用呢。)蚂蚁:无法创建任务或键入
我根据Apache文档创建了一个自定义的ant任务。
运行ant,我得到:
BUILD FAILED
/home/russ/blackpearl/fun/build.xml:121: Problem: failed to create task or type sqlscriptpreprocessor
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:487)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:419)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
at org.apache.tools.ant.Task.perform(Task.java:347)
这是根据目标在我的build.xml文件:
<target name="mysql-preprocess"
description="Preprocess MySQL database scripts into one file">
<sqlscriptpreprocessor inputfilepath="${basedir}/extras/blackpearl.sql.in"
outputfilepath="${basedir}/extras/blackpearl.sql" />
</target>
我有蚂蚁的contrib-1.0b3.jar * * ANT_HOME/lib *。我在该路径上有sqlscriptpreprocessor.jar,以及我的构建的本地类路径。
为了驱除这个问题,我尝试了以下一组语句的所有组合,这些语句是我通过Google搜集到的,意思是< taskdef ant-contrib >其中一个在<的taskdef sqlscriptpreprocessor >结构中,两个第一与后者的一个,两个,后者的第一个,都在一起,他们没有等
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="/home/russ/dev/downloads/ant-contrib/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<taskdef name="sqlscriptpreprocessor" classname="com.etretatlogiciels.ant.task.SqlScriptPreprocessor" />
<taskdef resource="${basedir}/lib/ant-tasks/SqlScriptPreprocessor.properties"
classpath="${basedir}/lib/ant-tasks/sqlscriptpreprocessor.jar" />
<taskdef resource="${basedir}/lib/ant-tasks/SqlScriptPreprocessor.properties">
<classpath>
<pathelement location="${basedir}/lib/ant-tasks/sqlscriptpreprocessor.jar" />
</classpath>
</taskdef>
这是令人沮丧,这不是因为很容易,因为他们说为蚂蚁增加自定义任务。
我将不胜感激任何和所有评论。
感谢,
拉斯
这不是跛脚。你应该尽可能接受你的答案。 – FailedDev