首页 > 解决方案 > Artifactory newGradleBuild() - artifactoryDe​​ploy .zip' 不存在,需要发布

问题描述

我有一个 spring boot 应用程序,我需要在其中创建 boot.tar 文件,并且我需要排除 gradle application plugin 创建的所有文件

apply plugin: 'war'

apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'


dependencies {
    compile('org.springframework.boot:spring-boot-starter-actuator')
    compile('org.springframework.boot:spring-boot-starter-thymeleaf')
    compile('org.springframework.boot:spring-boot-starter-web')

    compile('com.fasterxml.jackson.core:jackson-annotations:2.9.6')
    compile('com.fasterxml.jackson.core:jackson-core:2.9.6')
    compile('com.fasterxml.jackson.core:jackson-databind:2.9.6')

    testCompile('org.springframework.boot:spring-boot-starter-test')
    providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')

}
apply plugin: 'application'
application {
    mainClassName = 'com.xx.MyMainClass'
}

distZip.enabled = false
distTar.enabled = false
bootDistZip.enabled = false

我还有一个通用的 jenkins 管道,它jenkins artifactory plugin在我运行构建时使用它运行 gradle 构建它失败并出现以下错误

Execution failed for task artifactoryDeploy 
File '/workerfs/workspace/mybuild/2/myApp/build/distributions/myapp-x.y.z.zip' does not exists, and need to be published!.zip' does not exists, and need to be published

更新了 Jenkinsfile

rtGradle = Artifactory.newGradleBuild()
rtGradle.usesPlugin = false
rtGradle.deployer.deployMavenDescriptors = true
rtGradle.deployer.deployIvyDescriptors= false
rtGradle.deployer server: server, repo: "snapshotLocal"
rtGradle.resolver server: "myartifactoryserver", repo: "virtualLocal"
rtGradle.useWrapper = true
rtGradle.deployer.deployArtifacts = false

               rtGradle.run rootDir: ".", buildFile: 'build.gradle', tasks: "clean build artifactoryPublish", buildInfo : <buidINfoObj>

标签: spring-bootjenkinsgradlejenkins-pipeline

解决方案


推荐阅读