gpt4 book ai didi

gradle - 无法在 gradle maven-publish 插件中传输工件 pom

转载 作者:行者123 更新时间:2023-12-02 05:15:46 26 4
gpt4 key购买 nike

我使用 gradle (2.9) ma​​ven-publish 插件将文件发布到私有(private) nexus maven 存储库。 build.gradle 文件是

apply plugin: 'maven-publish'

publishing {
repositories {
maven {
name "example-maven"
url "https://..."
credentials {
username mavenUser
password mavenPassword
}
}
}
publications {
maven(MavenPublication) {

groupId 'com.example.karaf-utils'
artifactId 'esa-bootstrapper'
version '1.0.0'

artifact source: "${projectDir}/kar/example.esa.bootstrapper.kar", extension: 'kar'

}
}
}

kar 文件已正确上传,在 nexus 中我可以看到预期的 xml 描述符:

<dependency>
<groupId>com.example.karaf-utils</groupId>
<artifactId>esa-bootstrapper</artifactId>
<version>1.0.0</version>
<type>kar</type>
</dependency>

但不幸的是,在执行 publish 任务期间,我收到以下错误:

gradle :com.example.karaf.subsys.bootstrap:publish
:com.example.karaf.subsys.bootstrap:generatePomFileForMavenPublication
:com.example.karaf.subsys.bootstrap:publishMavenPublicationToexample-mavenRepository
Upload https://nexus.dev.example.io/nexus/content/repositories/example-maven/com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.kar
Upload https://nexus.dev.example.io/nexus/content/repositories/example-maven/com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.kar.sha1
Upload https://nexus.dev.example.io/nexus/content/repositories/example-maven/com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.kar.md5
Upload https://nexus.dev.example.io/nexus/content/repositories/example-maven/com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.pom
Could not transfer artifact com.example.karaf-utils:esa-bootstrapper:pom:1.0.0 from/to remote (https://nexus.dev.example.io/nexus/content/repositories/example-maven): Could not write to resource 'com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.pom'
:com.example.karaf.subsys.bootstrap:publishMavenPublicationToexample-mavenRepository FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':com.example.karaf.subsys.bootstrap:publishMavenPublicationToexample-mavenRepository'.
> Failed to publish publication 'maven' to repository 'example-maven'
> Failed to deploy artifacts: Could not transfer artifact com.example.karaf-utils:esa-bootstrapper:pom:1.0.0 from/to remote (https://nexus.dev.example.io/nexus/content/repositories/example-maven): Could not write to resource 'com/example/karaf-utils/esa-bootstrapper/1.0.0/esa-bootstrapper-1.0.0.pom'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

如何修复此错误?

最佳答案

问题已解决:问题是我试图覆盖 nexus 中现有的 pom 文件。我删除了 kar 文件,但在运行 gradle 任务之前忘记删除 pom。

关于gradle - 无法在 gradle maven-publish 插件中传输工件 pom,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34609996/

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