Ant jsch jar file removed on agent upgrade


One of our builds use Ant and sshexec to deploy files. However we get the following error:

#[sshexec] 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: -E:\TeamCityAgents\Agent1\plugins\ant\lib

Adding the jcsh jar file to the plugins\ant\lib folder as instructed works.

The problem is that when we do an upgrade of TeamCity to a new version, all the agents are upgraded and we lose the extra JAR.

Since we have 13 build agents spread across 3 servers, it is not really feasible to copy in the extra dependencies after every upgrade.

Do you have any suggestions as to how we can solve the problem? Is there a standard way to upload extensions to the Ant plugin to the central server so that it will always be applied to all agents on all servers?



Comment actions Permalink


You put files in wrong place. To update all plugins automatically you should put them in <TeamCity directory>/webapps/ROOT/WEB-INF/plugins directory on server. TeamCity server monitors all agent plugins .zip files for a change. Once a change is detected, agents receive the upgrade command from the server and download the updated files automatically. It means that if you want to deploy an updated agent part of your plugin without the server restart, you can put your agent plugin into this folder. But you will have to do it after every TeamCity upgrade.

The better (recommended) solution is to use ant-net-tasks tool. Needed jars are already located in <buildAgent>/tools/ant-net-tasks folder. You should add "Additional Ant command line parameters": -lib "%teamcity.tool.ant-net-tasks%".

Comment actions Permalink

Thank you very much Alina, this resolves the issue.

The problem is that the error message TeamCity displays is a bit misleading in that it instructs you to drop the required plugin in the agent plugin folder (not the server plugin folder), but in any case, that doesn't matter if passing the lib command line parameter that points to the ant tools.

It would be great if you could add some documentation to the Ant runner about this, as it is difficult to figure out at the moment.


Comment actions Permalink

I've already created a task to update doc. Thank you for feedback.


Please sign in to leave a comment.