I want to build a Gradle based project in a Jenkins pipeline.
(我想在詹金斯管道中建立一个基于Gradle的项目。)
The build step shall run in a Docker container. (构建步骤应在Docker容器中运行。)
This is my current pipeline: (这是我当前的管道:)
pipeline {
agent any
environment {
GRADLE_DOCKER_IMAGE = 'gradle:5.6.4-jdk8'
GRADLE_DOCKER_ARGS = '-v ${HOME}/.m2:/maven/.m2'
}
stages {
stage('Compile') {
steps {
script{
docker.image(GRADLE_DOCKER_IMAGE).inside("${GRADLE_DOCKER_ARGS}") {
sh './gradlew clean build --scan -s'
}
}
}
}
}
}
The pipeline itself finishes successfully but there is the following message in the log:
(管道本身成功完成,但是日志中有以下消息:)
./gradlew: 23: cd: can't cd to "./
If I omit the ./
(using just sh 'gradlew ...
) then the build fails as the command gradlew cannot be found.
(如果我省略./
(仅使用sh 'gradlew ...
),则构建将失败,因为找不到gradlew命令。)
What am I missing here?
(我在这里想念什么?)
ask by Robert Strauch translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…