繁体   English   中英

Gradle 没有将工件上传到工件

[英]Gradle is not uploading artifact to artifactory

我正在尝试上传一个用 gradle 创建的 jar,但我遇到了麻烦,因为我对 gradle 或 artifactory 都不熟悉。

由于这是一个旧项目,因此使用的是 Gradle 3.5。

这是我添加到 build.gradle 文件中的内容:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
    }
}

allprojects {
    apply plugin: "com.jfrog.artifactory"
}

artifactory {
    contextUrl = "xxxxxxxxx"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'repokey1'
            username = "xxxxxxx"
            password = "xxxxxx" 
        }
    }
    resolve {
        repository {
            repoKey = 'repokey2'
            username = "xxxxxx"
            password = "xxxxxx"  
        }
    }
}
apply plugin: "com.jfrog.artifactory"

当我运行时:

gradle artifactoryPublish

我收到以下消息:

Deploying build descriptor to: http://xxxxxxxx/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under http://xxxxxxx/artifactory/webapp/builds/my-project/1626816605048/2021-07-20T17:30:05.039-0400/

如果我访问 http://xxxxxxxx/artifactory/api/build 我会得到一个带有一些元数据的 json,但是在任何地方都找不到 jar,我是否遗漏了什么?

Gradle Artifactory 插件应该被告知将上传哪个发布配置。 在您的情况下,您可以添加收集所有 JAR 的默认“存档”配置:

artifactory {
    publish {
        ...
        defaults {
            publishConfigs('archives')
        }
    }
}

注意 - 不推荐使用发布配置方法,拥有较新 Gradle 版本的用户应使用 Gradle 发布。

阅读更多:

  1. 文档
  2. 例子

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM