任务'文件'在根项目中找不到

时间:2018-03-21 15:21:38

标签: jenkins groovy jenkins-pipeline artifactory

我有Jenkinsfile将我的工件部署到JFrog Artifactory

node() {

def server
def buildInfo
def rtGradle

stage('Clone') {
   ///my gitlab url
}

stage('Artifactory configuration') {
     server = Artifactory.server 'my-server-id'
     rtGradle = Artifactory.newGradleBuild()
     rtGradle.tool = 'Gradle 4.6' // Tool name from Jenkins configuration
     rtGradle.deployer repo: 'epm-lstr-hri-maven', server: server
     rtGradle.resolver repo: 'epm-lstr-hri-maven', server: server
     rtGradle.deployer.deployArtifacts = false
     buildInfo = Artifactory.newBuildInfo()
}

  stage ('Build') {
    rtGradle.run rootDir: ".", buildFile: 'build.gradle', tasks: 'build'
}

stage ('Deploy') {
    rtGradle.run rootDir: ".", buildFile: 'build.gradle', tasks: 

'artifactoryPublish', buildInfo: buildInfo
        rtGradle.deployer.deployArtifacts buildInfo
    }

    stage ('Publish build info') {
        server.publishBuildInfo buildInfo
    }
}

运行此作业后,将显示异常:

[Pipeline] newBuildInfo
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] newBuildInfo
[Pipeline] ArtifactoryGradleBuild
[CommonAPIArt] $ cmd.exe /C '""C:\Program Files (x86)\Jenkins\tools\hudson.plugins.gradle.GradleInstallation\Gradle_4.6\bin\gradle.bat"' --init-script C:/Program Files (x86)/Jenkins/workspace/test_project/CommonAPIArt@tmp/init-artifactory1204060565575984338gradle build -b .\build.gradle && exit %%ERRORLEVEL%%"

FAILURE: Build failed with an exception.

* What went wrong:
Task 'Files' not found in root project 'common-api'.

Gradle中的任务'文件' 是什么?我的项目中没有,我如何使用pipline部署工件?

0 个答案:

没有答案