开发者

TeamCity: How To enable FTP in ANT?

I have to copy files after build on a TeamCity-Agent via FTP. The orndinary buildjob works itself works fine. The triggering of a custom script finish successfull, too. The step "copy files via ftp" fails with the following error:

[15:34:31]: copyFiles
[15:34:31]: [copyFiles] ftp
[15:34:31]: [ftp] Could not create type ftp due to java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClientConfig

I searched the web for a while and found many times the same answer: "You have to put commons-net.jar and jakarta-oro.jar i开发者_高级运维n your ANT-plugin directory." So I downloaded these two files and copied it into C:\TeamCity\buildAgent\lib, but the error still exists.

Now the question:

Where do I have to copy these files to make FTP work? Or am I on the wrong track?


You've put the jar into the wrong place, it must be in the classpath of Ant, not in the classpath of the build agent.

You should find ant.zip file (TeamCity\WEB-INF\plugins\ant-tool\agent\ant.zip) and put the required jar (commons-net-1.4.1.jar, for example) inside ant\lib directory of the ant.zip file.

After the zip is re-packaged, TeamCity will update build agents with the new Ant version and commons-net dependency will be automatically available for Ant via its own classpath.

Note that you will have to repeat this step every time you update TeamCity to a new version.

Another option is to install Ant on build agent machines manually and configure TeamCity to use custom Ant installation (with all the required custom dependencies in the Ant's lib directory), however it's inconvenient if you have many build agents, but you will not have to repeat this step when updating TeamCity server.


Ant-net-task tool is bundled with TeamCity. This tool has jar files necessary for FTP, sshexec, scp and mail.

To use it Additional Ant command line parameters: -lib "%teamcity.tool.ant-net-tasks%" should be added.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜