dadacafe
dadacafe

Reputation: 11

class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec was not found

I have somewhat common problem with ant not being able to find the class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec. However, the common solutions don't work for me:

  1. ensuring that the jsch.jar and ant-jsch.jar exists in the classpath
  2. ensuring that there are not multiple different versions of the mentioned jars
  3. ensuring that ant -diagnostics is infact seeing the jars

I have no idea what I should try out next. The output I get is the good 'ol:

build.xml: 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
        -/opt/home/myname/.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.

My setup:

Ant diagnostics log can be found here: http://pastebin.com/q5AURxuk

As seen from the diagnostics log, the jars are there but ant reports: sshexec : Not Available (the implementation class is not present)

I also extracted the jar file and ensured that the class is there.

Any ideas?

Upvotes: 1

Views: 3479

Answers (2)

Christian
Christian

Reputation: 313

I've been hit by nearly the same problem, especially ant -diagnostics shows that sshexec task is "Not available".

On my system the solution was to install package "ant-optional" additionally (as I've already posted here: ANT can't find specific libraries)

Maybe this helps.

Regards

Upvotes: 2

user4998901
user4998901

Reputation: 11

Came across a problem very similar to yours, problem with SCP rather than SSH but otherwise the same. Tou don't say if you compiled Ant yourself ot used a binary distribution, but or us it turned out to be a problem with the ant-jsch.jar not compiling properly. There was no suggestion of a problem on compile, but the jar was much smaller than expected, only 6k. We fixed the issue by using the ant-jsch.jar from the binary distribution, which is 48k. This was with ant-1.9.4 and ant-1.9.5, Java 1.8.0_45.

Upvotes: 1

Related Questions