有没有办法更改 Jenkins Maven 构建的工作目录? [英] Is there any way to change the working directory of a Jenkins Maven build?

查看:50
本文介绍了有没有办法更改 Jenkins Maven 构建的工作目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以更改 Jenkins Maven 构建的工作目录吗?

Is there any way to change the working directory of a Jenkins Maven build?

只有当当前工作目录是包含 pom.xml 的目录时,有一个 Maven 构建才能工作,所以我希望 Maven 构建在该目录中执行.

There is a Maven build that will only work if the current working directory is the directory with pom.xml in it, so I want the Maven build to execute in that directory.

带有 pom.xml 的目录在一个 git 项目的子目录中.

The directory with the pom.xml is in a subdirectory of a git project.

推荐答案

创建目标以检出父项.

  • 检查构建目标的父目录
  • 设置构建 -> 目标 = 干净
  • 运行构建并确定目标工作区目录(控制台输出的第二行,在我的示例/var/lib/jenkins/workspace/my_project 中)

创建一个目标来构建你的路径

Create a target to build your path

  • 不要勾选在构建开始前删除工作区"
  • 在构建 -> 高级 - 选中更改工作区文件夹"并粘贴您的/yourtargetdirectory

它对我有用.

这篇关于有没有办法更改 Jenkins Maven 构建的工作目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆