简体   繁体   English

在Jenkins中复制更改的文件

[英]Copy changed files in Jenkins

I'm using Jenkins for building my projects. 我正在使用Jenkins构建我的项目。 I'm using Ant to do the compilation itself. 我正在使用Ant自己进行编译。 When build finishes I'd like to copy files that were compiled in this build to some directory. 构建完成后,我想将在此构建中编译的文件复制到某个目录。 Is this possible? 这可能吗?

Yes, you could do this as part of your Ant project using the Ant copy task. 是的,您可以使用Ant复制任务将其作为Ant项目的一部分进行。 Best practice is to clean the directory containing your compiled binaries at the start of each build, so you should just be able to copy the whole directory without filtering the contents. 最佳实践是在每次构建开始时清理包含编译的二进制文件的目录,因此您应该只能够复制整个目录而无需过滤内容。

If you want to specifically find changed files, you could take a recursive md5 over your Target directory before and after your build, and only copy those files which do not match the prebuild checksum. 如果要专门查找更改的文件,则可以在构建之前和之后在目标目录上使用递归md5,并且仅复制与预构建校验和不匹配的那些文件。

This being said, if you've got a clean build directory you should just copy everything over; 这就是说,如果您有一个干净的构建目录,则应该将所有内容都复制过来; changed files will get copied as needed, and unchanged files will copy but won't impact the application. 更改后的文件将根据需要进行复制,未更改的文件将被复制但不会影响应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM