我的脚本如下:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Getting from FTP" default="info" basedir=".">
<target name="info">
<property name="testfolder" value="My\Test\Folder\Path" />
<echo>Hello World - Welcome to Apache Ant!</echo>
<echo>Java version: ${ant.java.version}</echo>
<echo>Ant Version: ${ant.version}</echo>
<echo>Base Dir: "${basedir}"</echo>
<mkdir dir="${testfolder}\ant-test"/>
<classpath>
<fileset dir="${basedir}" includes="*.jar" />
</classpath>
<ftp action="get"
server="my.server.location.somewhere"
userid="username"
password="password"
remotedir="/path/on/my/server"
verbose="yes"
>
<fileset dir="${testfolder}\ant-test">
<include name="**\*" />
</fileset>
</ftp>
</target>
</project>
我正在 eclipse 上编写文件,并将 commons-net-3.3.jar 文件放在我的工作区文件夹中。这里是 AutomateDownload。但是,当我运行脚本时,出现此错误:
Buildfile: mydrive\on_server\my_workspace\ftpauto\AutomateDownload\build.xml
info:
[echo] Hello World - Welcome to Apache Ant!
[echo] Java version: 1.8
[echo] Ant Version: Apache Ant(TM) version 1.9.4 compiled on April 29 2014
[echo] Base Dir: "mydrive\on_server\my_workspace\ftpauto\AutomateDownload"
BUILD FAILED
mydrive\on_server\my_workspace\ftpauto\AutomateDownload\build.xml:11: Problem: failed to create task or type classpath
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.
它在我的本地机器上运行良好,因为我将 .jar 文件保存在 ANT_HOME 的 lib 文件夹中。它运行完美。但现在当我在服务器机器上运行它时,我遇到了错误。有人能帮我解决我遇到的问题吗?你能详细告诉我,问题到底是什么吗?我为什么会遇到这种问题?谢谢 :)