gpt4 book ai didi

gradle - 如何使用Gradle将工件发布到远程存储库

转载 作者:行者123 更新时间:2023-12-03 05:25:23 27 4
gpt4 key购买 nike

我想将 Artifact 发布到url标识的远程存储库中。这是我的build.gradle文件。这是一个带有某些依赖项的java gradle项目。我能够将其发布到本地.m2存储库,并在另一个项目中使用它。

plugins {
id 'java'
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'maven-publish'
}

group = 'com.mob.ci'
version '1.0-SNAPSHOT'

apply plugin: 'maven'

sourceCompatibility = 1.8

repositories {
maven{url 'https://proget1..../maven2/Maven/'}
}

jar {
enabled = true
}

bootJar {
enabled = false
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-couchbase'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
url = 'https://proget1..../maven2/Maven/'
}
}
}

最佳答案

这是解决问题的build.gradle文件的更新。谢谢@soung的提示。我需要指定访问存储库的凭据。

plugins {
id 'java'
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'maven-publish'
}

group = 'com.mob.ci'
version '1.0-SNAPSHOT'

apply plugin: 'maven'

sourceCompatibility = 1.8

repositories {
maven{url 'https://proget1..../maven2/Maven/'}
}

jar {
enabled = true
}

bootJar {
enabled = false
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-couchbase'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
url = 'https://proget1..../maven2/Maven/'
credentials {
username = deployRepoUsername
password = deployRepoPassword
}
}
}
}

关于gradle - 如何使用Gradle将工件发布到远程存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61466121/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com