簡體   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