简体   繁体   English

远程构建项目,但通过Jenkins从本地计算机中选择代码

[英]Build a project remotely but pick the code from local machine through Jenkins

I'm running jenkins on my local machine. 我在本地计算机上运行jenkins。 I need to build and run a project on remote machine as a slave. 我需要在远程计算机上以从站的身份构建和运行项目。

I have my project(Java code) in my local machine where the Jenkins is running. 我在运行Jenkins的本地计算机中有我的项目(Java代码)。 So Now when I build the project it looks for the code in my slave machine and says it's not able to find the build.xml in my slave machine. 因此,现在当我构建项目时,它会在从属计算机中查找代码,并说无法在从属计算机中找到build.xml。

I want to be able to have Jenkins looks for the code in my local machine and build it in my slave machine and run in the slave machine. 我希望能够让Jenkins在本地计算机中查找代码,并在从属计算机中构建它,然后在从属计算机中运行。

Is that possible? 那可能吗? if yes pls help me. 如果可以,请帮助我。

You do not state which version control system you are using? 您未说明您使用的是哪个版本控制系统? Jenkins has version control plugins for Git, Subversion, etc... Jenkins具有适用于Git,Subversion等的版本控制插件。

The idea is that you commit and push your changes to your source code repository and the Jenkins slave will automatically pull down the code and compile if anything has changed. 这个想法是您提交更改并将其推送到源代码存储库,如果发生任何更改,Jenkins从站将自动拉出代码并进行编译。

Try the copy artifact plugin . 尝试复制工件插件 You can create 2 jobs - 1st one to just check out the source code from your repo/version control/workspace. 您可以创建2个作业-第一个作业只是从存储库/版本控制/工作区检出源代码。 The second job (which runs on the slave restrict where this job can be run inside the job config ) can copy those files automatically to the ...remote slave/workspace and then you do whatever you want with them. 第二个作业(在从属restrict where this job can be run inside the job config运行, restrict where this job can be run inside the job config )可以将这些文件自动复制到...remote slave/workspace ,然后您可以对它们进行任何操作。

This will do what you want, but as Mark O'Çonnor mentions, the idea is you commit the changes to your repository and then the other machine checks it out. 这将完成您想要的操作,但是正如MarkO'Çonnor所提到的,您的想法是将更改提交到存储库,然后另一台计算机将其签出。

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

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