【问题标题】:ANT can't find specific librariesANT 找不到特定的库
【发布时间】:2013-08-03 03:12:12
【问题描述】:

我正在尝试使用SSHEXEC ANT task,它需要JSCH library

当我尝试使用 SSHEXEC 任务时,我得到以下信息:

BUILD FAILED
/home/www/test/build/build.xml:140: Problem: failed to create task or type sshexec
Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/share/ant/lib
        -/root/.ant/lib
        -a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem

我已经将jsch-0.1.50.jar(最新的)放在/usr/share/ant/lib/root/.ant/lib中,甚至尝试了以下方法:

ant my-sshexec-target-name -lib /path/to/jsch-0.1.50.jar

而且我不断收到同样的错误。我还尝试在所有相同的位置将文件重命名为 jsch.jar。结果相同。我在这里做错了什么?

更新

我还跑了ant -diagnostics,看到了这个:

...
-------------------------------------------
 Tasks availability
-------------------------------------------
p4reopen : Not Available (the implementation class is not present)
image : Not Available (the implementation class is not present)
sshexec : Not Available (the implementation class is not present)
wlrun : Not Available (the implementation class is not present)
p4label : Not Available (the implementation class is not present)
p4revert : Not Available (the implementation class is not present)
p4submit : Not Available (the implementation class is not present)
scp : Not Available (the implementation class is not present)
p4change : Not Available (the implementation class is not present)
p4delete : Not Available (the implementation class is not present)
p4integrate : Not Available (the implementation class is not present)
rexec : Not Available (the implementation class is not present)
stlist : Not Available (the implementation class is not present)
telnet : Not Available (the implementation class is not present)
etc...

注意:sshexec : Not Available(实现类不存在)

这是什么意思?

【问题讨论】:

  • 嘿,杰克,答案是什么?此线程中没有任何帮助。

标签: java ant jsch


【解决方案1】:

通过在 unix 中打印 CLASSPATH 变量来检查 jar 是否在类路径中

【讨论】:

  • echo $CLASSPATH 没有给我任何东西...我还用更多信息更新了我的问题。
  • 变量根本没有打印任何值,或者你的 jar 不在其中?
  • 变量没有值。终端中只有一个空行。
  • 它清楚地说'sshexec:不可用(实现类不存在)'。理想情况下它很奇怪。尝试更改jar文件的位置并添加它
【解决方案2】:

在我的 Linux Mint Debian Edition 2 上,我遇到了同样的问题:想知道为什么在执行“ant -diagnostics”时“sshexec”任务被声明为“不可用”。

我的系统上的解决方案是另外安装包“ant-optional”。之后,通常的解决方案按预期工作,例如将 jsch.jar 放入 ~/.ant/lib。

问候

【讨论】:

    【解决方案3】:

    将 ANT_HOME 设置为 /usr/share/ant/

    export ANT_HOME=/usr/share/ant/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-29
      • 1970-01-01
      相关资源
      最近更新 更多