由于未解析的oro依赖性,ANT FTP构建命令失败

时间:2013-09-12 15:09:03

标签: java ant ftp

我想在我的ANT命令中使用FTP标记从FTP位置接收文件。为了实现这一点,我在我的ANT的lib文件夹中复制了jakarta-oro-2.0.8.jarapache-commons-net.jar。运行命令时出现以下错误:java.lang.Error: Unresolved compilation问题:

    The import org.apache.oro cannot be resolved
    The import org.apache.oro cannot be resolved
    The import org.apache.oro cannot be resolved
    The import org.apache.oro cannot be resolved
    The import org.apache.oro cannot be resolved
    The import org.apache.oro cannot be resolved
    Pattern cannot be resolved to a type
    MatchResult cannot be resolved to a type
    PatternMatcher cannot be resolved to a type
    _matcher_ cannot be resolved
    Perl5Matcher cannot be resolved to a type
    pattern cannot be resolved
    Perl5Compiler cannot be resolved to a type
    MalformedPatternException cannot be resolved to a type
    result cannot be resolved or is not a field
    _matcher_ cannot be resolved
    pattern cannot be resolved or is not a field
    result cannot be resolved or is not a field
    _matcher_ cannot be resolved
    result cannot be resolved or is not a field
    result cannot be resolved or is not a field
    result cannot be resolved or is not a field
    result cannot be resolved or is not a field
    result cannot be resolved or is not a field
    result cannot be resolved or is not a field
    result cannot be resolved or is not a field

    at org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl.<init>(RegexFTPFileEntryParserImpl.java:19)
    at org.apache.commons.net.ftp.parser.ConfigurableFTPFileEntryParserImpl.<init>(ConfigurableFTPFileEntryParserImpl.java:57)
    at org.apache.commons.net.ftp.parser.UnixFTPEntryParser.<init>(UnixFTPEntryParser.java:136)
    at org.apache.commons.net.ftp.parser.UnixFTPEntryParser.<init>(UnixFTPEntryParser.java:119)
    at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createUnixFTPEntryParser(DefaultFTPFileEntryParserFactory.java:169)
    at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:94)
    at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2359)
    at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2142)
    at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2188)
    at org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.forceRemoteSensitivityCheck(FTP.java:695)
    at org.apache.tools.ant.taskdefs.optional.net.FTP$FTPDirectoryScanner.scan(FTP.java:372)
    at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles(FTP.java:1738)
    at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles(FTP.java:1850)
    at org.apache.tools.ant.taskdefs.optional.net.FTP.execute(FTP.java:2539)

为什么Ant无法导入ORO依赖项?

1 个答案:

答案 0 :(得分:0)

ANT 1.6.5是一个非常古老的ANT版本。以下示例使用ANT 1.9.0进行了测试:

<project name="demo" default="build">

   <target name="bootstrap">
      <mkdir dir="${user.home}/.ant/lib"/>
      <get dest="${user.home}/.ant/lib/commons-net.jar" src="http://search.maven.org/remotecontent?filepath=commons-net/commons-net/3.3/commons-net-3.3.jar"/>
      <get dest="${user.home}/.ant/lib/oro.jar" src="http://search.maven.org/remotecontent?filepath=oro/oro/2.0.8/oro-2.0.8.jar"/>
   </target>

   <target name="build">
      <ftp server="ftp.apache.org" userid="anonymous" password="me@myorg.com">
         <fileset dir="htdocs/manual"/>
      </ftp>
   </target>

</project>

bootstrap目标将缺少的ftp任务依赖项安装到ANT将在下次运行时使用的位置。