简体   繁体   English

Jenkins:无法通过 Jenkins 运行本地 Maven 项目

[英]Jenkins : Unable to Run Local Maven Project through Jenkins

I am new to CI.我是 CI 的新手。 I am trying to run my local Selenium Project through Jenkins but it is getting failed with error.我正在尝试通过 Jenkins 运行我的本地 Selenium 项目,但它因错误而失败。 Here are the complete details:以下是完整的详细信息:

OS - MAC OS local POM xml Path:操作系统 - MAC 操作系统本地 POM xml 路径:

Users/prakuma/git/NaveenPOMProject/Naveen_HybridPOM/pom.xml

I am not sure why is /Users/Shared/Jenkins/Home/workspace/Naveen_POMHybrid getting added before my pom.xml path.我不确定为什么在我的pom.xml路径之前添加了/Users/Shared/Jenkins/Home/workspace/Naveen_POMHybrid

I am attaching screen shot of Configuration and Global Setting of Jenkins.我附上了 Jenkins 的配置和全局设置的屏幕截图。

  1. Maven Global Maven全球在此处输入图片说明
  2. Global setting :全局设置 : 在此处输入图片说明
  3. Error:错误: 在此处输入图片说明

For working with maven jenkins plugin to use local project which is outside jenkins workspace.用于使用 maven jenkins 插件以使用 jenkins 工作区之外的本地项目。 You can use Copy Data To Workspace Plugin which will move the code to workspace before maven execution.您可以使用Copy Data To Workspace Plugin ,它将在 maven 执行之前将代码移动到工作区。

Give your project folder to in path to folder variable.将您的项目文件夹放入path to folder变量的path to folder

Now in Root pom , simply leave it empty or just give pom.xml.现在在Root pom ,只需将其留空或仅提供 pom.xml。

To make Jenkins find the pom.xml in a custom workspace ...为了让 Jenkins 在自定义工作区中找到pom.xml ...

  1. set the jobs Root POM to pom.xml将作业Root POM设置为pom.xml
  2. set Use custom workspace with the path to your pom.xml (eg /Users/prakuma/git/NaveenPOMProject/Naveen_HybridPOM/ in this case)设置Use custom workspace带有pom.xml路径的Use custom workspace (例如/Users/prakuma/git/NaveenPOMProject/Naveen_HybridPOM/在这种情况下)

在此处输入图片说明

Please follow the steps given below, which helped me to execute pom.xml successfully through jenkins on macOS.请按照下面给出的步骤,它帮助我在 macOS 上通过 jenkins 成功执行 pom.xml。

  1. Click on configuration (of project in jenkins)单击配置(jenkins 中的项目)
  2. Click on Build tab.单击构建选项卡。
  3. Keep Root POM as pom.xml保持根 POM 为 pom.xml
  4. click on Advance.单击高级。
  5. search for "Use custom workspace"搜索“使用自定义工作区”
  6. check "Use custom workspace" , under Directory give your git dir location where pom.xml is there (eg: /Users/username/git/TestProject/TestProject).选中“使用自定义工作区”,在目录下给出 pom.xml 所在的 git 目录位置(例如:/Users/username/git/TestProject/TestProject)。
  7. Save.节省。
  8. Give all permission to directory(eg: /Users/username/git/TestProject)授予目录所有权限(例如:/Users/username/git/TestProject)

Please click here to get the image请点击此处获取图片

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

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