Spring Boot 如何将Jar文件作为新版本发布到jfrog中,而不是删除/覆盖以前的版本

mwngjboj  于 2022-12-04  发布在  Spring
关注(0)|答案(1)|浏览(258)

我尝试将jar文件发布到jfrog中。一开始它工作得很好。但是当我多次尝试在同一路径下部署一个工件时,将应用程序版本更改为2.0.0(之前是1.0.0),它给我这个错误。
“消息”:“没有足够的权限删除/覆盖对象”客户服务:客户服务/com/客户/服务/核心/1.0.0/客户服务核心-1.0.0.jar“(用户:'username'需要DELETE权限)。”
这是我的build.gradle文件的外观。

import org.springframework.boot.gradle.plugin.SpringBootPlugin

buildscript {
   repositories {
      jcenter()

   }
   dependencies {
      //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
      classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
   }
}

plugins {
   id 'org.springframework.boot' version '2.7.5' apply false
   id 'io.spring.dependency-management' version '1.0.15.RELEASE'
   id 'java'
   id 'maven-publish'
   id 'com.jfrog.artifactory' version '4.28.1'
}

allprojects {
   apply plugin: 'com.jfrog.artifactory'
   apply plugin: 'maven-publish'
}

publishing {
   publications {
      mavenJava(MavenPublication) {
         artifactId = 'customer_service_core'
         from components.java

         pom {
            name = 'Customer service core module'
            description = 'Customer service core module'
         }
      }
   }
}

artifactory {
   contextUrl = "${artifactory_contextUrl}"

   jar {
      enabled = true
   }

   publish {
      repository {
         repoKey = 'customer-service'
         username = "${artifactory_user}"
         password = "${artifactory_password}"
         maven = true
      }
      defaults {
         // Reference to Gradle publications defined in the build script.
         // This is how we tell the Artifactory Plugin which artifacts should be
         // published to Artifactory.
         publications('mavenJava')
         publishArtifacts = true
         // Properties to be attached to the published artifacts.
         properties = ['qa.level': 'basic', 'dev.team': 'core']
         // Publish generated POM files to Artifactory (true by default)
         publishPom = true
      }
   }
}

group = 'com.customer.service'
version = '2.0.0'
sourceCompatibility = '17'

repositories {
   mavenCentral()
}

dependencyManagement {
   imports {
      mavenBom SpringBootPlugin.BOM_COORDINATES
   }
}

dependencies {
   implementation 'org.springframework.boot:spring-boot-starter'
   testImplementation 'org.springframework.boot:spring-boot-starter-test'

   // lombok dependencies
   compileOnly 'org.projectlombok:lombok'
   annotationProcessor 'org.projectlombok:lombok'
}

tasks.named('test') {
   useJUnitPlatform()
}

我想知道有没有办法将我们的jar文件部署为新版本而不覆盖以前的版本?我是否总是需要在要部署的路径中手动包含版本号,如果需要,我该如何通过此build.gradle文件来执行此操作?

相关问题