0
我如果一個屬性在Ant目標設定爲複製文件中的螞蟻一個文件,但我總是得到一個錯誤的代碼:複製根據病情
<condition property="component.is.x">
<equals arg1="${COMPONENT_ID}" arg2="x" />
</condition>
<target name="copyschemaparamsfile" if="sql.file.present" >
<if>
<equals arg1="${component.is.x}" arg2="true" />
<then>
<copy file="${in.root}/schema/${COMPONENT_ID}-schema.sql"
tofile="${tmp.dir}/${COMPONENT_ID}/x/schema/schema.sql"
failonerror="false" />
</then>
<else>
<copy file="${inf.root}/schema/${COMPONENT_ID}-schema.sql"
tofile="${tmp.dir}/${COMPONENT_ID}/${COMPONENT_ID}/schema/schema.sql" failonerror="false" />
</else>
</if>
</target>
錯誤是:
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'if'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and the JAR file and/or libraries
implementing the functionality were not found at the time you
yourself built your installation of Ant from the Ant sources.
Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
task and make sure it contains more than merely a META-INF/MANIFEST.MF.
If all it contains is the manifest, then rebuild Ant with the needed
libraries present in ${ant.home}/lib/optional/ , or alternatively,
download a pre-built release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task
and needs to be declared using <taskdef>.
- You are attempting to use a task defined using
<presetdef> or <macrodef> but have spelt wrong or not
defined it at the point of use
Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath
當我執行時,我總是會遇到上述錯誤。有人可以建議如何檢查一個參數並從一個目錄複製到另一個目錄內的其他目錄?
您好,感謝您的答覆。我做的和1)一樣(1)將ant-contrib-0.3.jar複製到Ant安裝的lib目錄中。如果您想使用自己項目中的任務之一,請在構建文件中添加 。但錯誤仍然是一樣的。 –
user1885159
未找到Ant-Contrib JAR文件。例如,你可能已經把它放在你正在調用的ant安裝的'lib /'目錄下。仔細檢查錯誤消息中的每個建議以及非常全面的建議。如果所有這些都失敗了,請嘗試其他(2)方法。 – kjhughes