蚂蚁找不到我的JAR文件?试图做一个sshexec任务 [英] Ant can't find my JAR file? Trying to do an sshexec task
问题描述
我试图在我的OSX框中使用ANT的sshexec任务,当我尝试运行它时,我收到以下列出的错误。我已经下载了jsch jar文件: http://www.jcraft.com/jsch/ index.html 版本jsch-0.1.43.jar
我将该文件放在/ usr / share / ant / lib中,仍然发生错误。任何想法?
谢谢
< target name =testme depends =>
< sshexec host =myhost1username =$ {username}command =ls -lakeyfile =$ {user.home} /。ssh / id_rsa/>
< / target>
我收到以下错误:
BUILD FAILED
/Users/jim/Code/myapp/deploy.xml:16:问题:无法创建任务或类型sshexec
原因:类org.apache .tools.ant.taskdefs.optional.ssh.SSHExec未找到。
这看起来像Ant的可选组件之一。
操作:检查在
- / usr / share / ant / lib
- / Users / jim / .ant / lib
-a目录中是否存在适当的可选JAR命令行与-lib参数
不要惊慌,这是一个常见的问题。
最常见的原因是缺少JAR。
UPDATE ::::
我从apache安装了一个新版本的ANT,并把它在/ usr / local中,将jsch文件移动到/ usr / local / ant / lib中,它修复了错误,但是当我运行它时,我有一个新的:ant -f deploy.xml restart
BUILD FAILED
/Users/jim/Code/myapp/deploy.xml:20:java.lang.NoSuchMethodError:com.jcraft。 jsch.ChannelExec.setExtOutputStream(Ljava / io / OutputStream;)V
在org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.executeCommand(SSHExec.java:265)
在org。 apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:194)
在org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25)
在java.lang.reflect.Method.invoke(Method.java:597)
在org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
在org.apache.tools.ant.Task.perform(Task.java:348)
在org.apache.tools.ant.Target.execute(Target.java:390)
在org .apache.tools.ant.Target.performTasks(Target.java:411)
在org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
在org.apache.tools .ant.Project.executeTarget(Project.java:1366)
在org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
在org.apache.tools.ant .Project.executeTargets(Project.java:1249)
在org.apache.tools.ant.Main.runBuild(Main.java:801)
在org.apache.tools.ant.Main.startAnt (Main.java:218)
在org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
在org.apache.tools.ant.launch.Launcher.main (Launcher.java:109)
以下是我的诊断信息:
看起来像版本兼容性问题,请查看jsch的版本与ant版本支持的版本。
也许。 $ b
I'm trying to use the sshexec task for ANT on my OSX box, when I try to run it I get the error listed below. I've downloaded the jsch jar file from: http://www.jcraft.com/jsch/index.html version jsch-0.1.43.jar
I placed that file into /usr/share/ant/lib and still the error occurs. any ideas?
thanks
<target name="testme" depends="">
<sshexec host="myhost1" username="${username}" command="ls -la" keyfile="${user.home}/.ssh/id_rsa" />
</target>
I get the following error:
BUILD FAILED
/Users/jim/Code/myapp/deploy.xml:16: 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
-/Users/jim/.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.
UPDATE:::: I installed a new version of ANT from apache and put it in /usr/local and moved the jsch file into /usr/local/ant/lib and it fixes the error, however now I have a new one when I run it with: ant -f deploy.xml restart
BUILD FAILED
/Users/jim/Code/myapp/deploy.xml:20: java.lang.NoSuchMethodError: com.jcraft.jsch.ChannelExec.setExtOutputStream(Ljava/io/OutputStream;)V
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.executeCommand(SSHExec.java:265)
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:194)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
at org.apache.tools.ant.Main.runBuild(Main.java:801)
at org.apache.tools.ant.Main.startAnt(Main.java:218)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Here is my diagnostic information:
looks like a version compatibility issue, check the version of jsch matches the one supported by the ant version.
maybe.
这篇关于蚂蚁找不到我的JAR文件?试图做一个sshexec任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!