(Vâng, tôi đã đọc và chơi xung quanh dựa trên câu trả lời cho câu hỏi tương tự trong diễn đàn này và nhiều người khác như JavaRanch - không có kết quả nào.)kiến: thất bại trong việc tạo ra nhiệm vụ hoặc gõ
tôi đã tạo một nhiệm vụ kiến tùy chỉnh theo tài liệu Apache.
Chạy ant, tôi nhận được:
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)
Đây là căn cứ vào một mục tiêu trong build.xml tôi file:
<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>
Tôi có ant-contrib-1.0b3.jar trên đường dẫn * $ ANT_HOME/lib *. Tôi có sqlscriptpreprocessor.jar trên đường dẫn đó, cộng với đường dẫn lớp cục bộ cho bản dựng của tôi.
Để cố gắng loại bỏ vấn đề này, tôi đã thử mọi kết hợp của tập hợp các câu lệnh sau, mà tôi đã chọn trên khắp nơi thông qua Google, nghĩa là một trong số < taskdef ant-contrib > của < taskdef sqlscriptpreprocessor > cấu trúc, hai trong số những người đầu tiên với một trong những trường hợp sau, một trong những người đầu tiên với hai trong số sau này, tất cả cùng nhau, không ai trong số họ, vv
<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>
đó là bực bội mà nó không phải là dễ dàng như họ nói để thêm nhiệm vụ tùy chỉnh vào kiến.
Tôi rất cảm kích mọi nhận xét.
Cảm ơn,
Russ
Nó không phải là khập khiễng. Bạn nên chấp nhận câu trả lời của bạn khi bạn có thể. – FailedDev