我有一个 git url maven 项目,我只想处理它的一个子模块。我写在管道脚本中:
...
stage("mvn build") {
steps {
script {
sh "mvn package -DskipTests=true"
}
}
}
出现错误:您指定的目标需要一个项目来执行,但此目录(/ xx /jenkins/workspace/biz-commons_deploy)中没有POM 。所以我添加命令:
sh "cd cmiot-services/comm" # subdir of biz-commons_deploy
def PWD = pwd();
echo "@@=${PWD} "
sh "mvn package -DskipTests=true"
不行,打印@@=/ root / .jenkins / workspace / biz-commons_deploy,报错和之前一样。我该如何解决这个问题以及为什么 echo 和 error 使用不同的用户空间?
我使用它sh "mvn -f cmiot-services/comm/pom.xml package -DskipTests=true"
,仍然不知道这两个用户路径来自哪里以及为什么 sh cd 不起作用。
steps {
sh '''
# list items in current directory to see where is your pom.xml
ls -l
# run job by comment out following two lines, if you don't know the
# relative path of folder where pom.xml insides exactly
cd <folder where pom.xml insides>
mvn package -DskipTests=true
'''
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句