Wednesday, August 3, 2011

How to Fix Ant Build Error: "Could not load a dependent class com/jcraft/jsch/Logger. It is not enough to have Ant's optional JARs"

If you get an error message like this while running a problematic Ant build script file :


/home/ceefour/git/magento-id/build.xml:13: The following error occurred while executing this line:
/home/ceefour/git/magento-id/build.xml:22: Problem: failed to create task or type sshexec
Cause: Could not load a dependent class com/jcraft/jsch/Logger
       It is not enough to have Ant's optional JARs
       you need the JAR files that the optional tasks depend upon.
       Ant's optional task dependencies are listed in the manual.
Action: Determine what extra JAR files are needed, and place them in one of:
        -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

It means your Ant build script file using optional Ant libraries and need to tell Ant where to find them.

In my case, it needs jsch.jar aka libjsch-java package in Debian/Ubuntu Linux.

First you need to install ant-optional package for Ant optional libraries support :
sudo apt-get install ant-optional

Then the libjsch-java Debian/Ubuntu package:
sudo apt-get install libjsch-java

Then put it in correct directories so that Ant can find them :

sudo ln -s /usr/share/java/jsch.jar /usr/share/ant/lib/
mkdir -vp ~/.ant/lib
ln -s /usr/share/java/jsch.jar ~/.ant/lib/

Ubuntu's Ant look for libraries in /usr/share/ant/lib folder, while Eclipse IDE's Ant look for optional Ant libraries in $HOME/.ant/lib folder.

Note that for Eclipse IDE, you may need to refresh Eclipse Ant Plug-in's Runtime Classpath, by going to Window > Preferences > Ant > Runtime, and clicking "Restore Defaults".
Make sure that the required libraries are now listed under "Global Entries".

Ant build system is frequently used in typical Java EE 6 enterprise application development. I highly recommend The Java EE 6 Tutorial: Basic Concepts (4th Edition) for a practical guide to the Java EE 6 technology.


  1. A great presentation. Very open and enlightening.You have attractively presented your concept in this webpage blog post.
    Who wrote the sonnet of seaside romance? Guess Shakespeare would feel wordless at the sight of marine motif wedding dresses 2012. Amber’s beach cheap wedding dresses plus size unfold pictures of sea-inspired details like pearl beading, shelly appliqué and metallic embroidery. A profusion of drapes, bubbles, pleating and ruffling echoes to the very physique of the beach and the sea.

    1. When compared to Windows 7 Home Premium Product Key, Windows 7 Professional Product Key is outstanding. When will Microsoft ever learn? Keep it simple, attractive, and easy to use. Windows 8 Professional Product Key Most computer users just want the system to work. Windows 7 does this.

  2. Very interesting article. Esp. the stands used to support the head. I would not have noticed it on my own. Will have to look carefully at old photographs to see this feature.

  3. Worth it to read post.Buy RS Gold Esp. the actual holders accustomed to secure the head. I wouldn't have seen the idea on my own. Should look carefully at outdated pictures to determine this particularBuy MapleStory Mesos feature.

  4. The person that has been serving to you with the driving faculty should be able to supply you with some hints regarding cnc602a fuel injector cleaner tester how to cope with the problem.. You will also discover from expertise as you proceed to implement these tools. This is a important element of possessing and driving a car.

  5. In my expertise, a 4- or 5-star rating is really a reliable thumbs-up. A score of two or three stars implies window anytime upgrade key “Meh.” And also a 1-star ranking is the equal of a raised center finger. Should you read the evaluations that accompany windows anytime upgrade key ultimate1-star rankings, you are going to locate equivalent components rage and buyer’s regret.

  6. Store, share, and reuse business process diagrams and subprocesses through Visio 2010 integration with SharePoint 2010 Process Repository.
    Project Professional 2010 gives you a powerful, visually enhanced way to effectively manage a wide range of projects and programs. From meeting crucial deadlines, to selecting the right resources and empowering your teams, Microsoft Project Professional 2010 Download delivers new and intuitive experiences to simply plan, manage, and collaborate with individuals, teams, and the enterprise.
    Adobe Acrobat 9 Download is a platform for viewing, creating, manipulating and managing files in Adobe's PDF format.

  7. Cheap D3 Gold Pertaining to training to work, it needs to be done efficiently. Normally, GW2 Gold just putting things off in terms of transforming into a better person moves.

  8. For Microsoft Project 2010 Download, all tabs and groups on the ribbon are fully customizable. If your organization has features unique to its business, you can group them on their own ribbon tab.

  9. thank you .your article helped me to resolve the dependency issue. thanks

  10. Nice article, thanks for the information. It's very complete information. I will bookmark for next reference
    jaring futsal | jaring golf | jaring pengaman proyek |
    jaring pengaman bangunan | jaring pengaman gedung