2015-11-23 28 views
0

所以我有一個Bintray存儲庫,但是我很難從gradle上載它。那麼,我的意思是版本管理不能滿足我的需求,目前我上傳的每一個.jar文件都必須增加配置中的版本和依賴項。我知道這不是應該如何完成的。我的問題是如何使用Bintray自動化/實現VCS標籤。現在我上載的配置看起來像這樣(使用bintray插件):Bintray VCS Tagging

bintray { 
user = "$bintrayUser" 
key = "$bintrayKey" 
publications = ['maven'] 
dryRun = false 
publish = true 
pkg { 
    repo = "$targetBintrayRepo" 
    name = "$targetBintrayPackage" 
    desc = '' 
    websiteUrl = "$programWebsiteUrl" 
    issueTrackerUrl = "$programIssueUrl" 
    vcsUrl = "$programVcsUrl" 
    licenses = ["$programLicense"] 
    labels = [] 
    publicDownloadNumbers = true 

    version { 
     name = "$programVersion" 
     released = new java.util.Date() 
     vcsTag = "$programVcsTag" 
    } 

} 
} 

我的變量是:

def programVersion = '0' 
def programVcsTag = '0.0.0' 
def programGroup = 'com.gmail.socraticphoenix' 
def targetBintrayRepo = 'Main' 
def targetBintrayPackage = 'java-api' 
def programLicense = 'MIT' 
def programWebsiteUrl = 'https://github.com/meguy26/PlasmaAPI' 
def programIssueUrl = 'https://github.com/meguy26/PlasmaAPI/issues' 
def programVcsUrl = 'https://github.com/meguy26/PlasmaAPI.git' 

然而here無標籤的出現,(即使有不同的運行再次發佈vcs標籤)導致版本已經存在的錯誤。 (Could not upload to 'https://api.bintray.com/content/meguy26/Main/java-api/0/com/gmail/socraticphoenix/PlasmaAPI/0/PlasmaAPI-0.jar': HTTP/1.1 409 Conflict [message:Unable to upload files: An artifact with the path 'com/gmail/socraticphoenix/PlasmaAPI/0/PlasmaAPI-0.jar' already exists]

很抱歉,如果我被noobish,但我不明白爲什麼它不工作,我填寫了所有合適的變量(我認爲)

回答

1

Bintray不支持每個版本的多個標籤。版本是唯一的字符串。如果您想從具有不同標籤的相同版本發佈某些內容,請使用程序版本和標籤撰寫Bintray版本字符串,例如"$programVersion-$programVcsTag"

+0

我不完全確定你的意思。我會在哪裏把組成的字符串?另外,我想要的最終結果是能夠發佈「更新」到一個版本,該版本將由gradle構建腳本(取決於工件)下載,而不需要更改版本號 –

+0

我建議應該去的字符串到'version.name'。對版本的「更新」 - 這是一個非常糟糕的主意。一個版本下的二進制文件應該是不可變的(因爲很多原因,其中之一 - 發佈的二進制文件被構建工具緩存)。如果你想推更新,你將不得不製作一個新版本。 – JBaruch

+0

不,我不希望覆蓋版本下的二進制文件,但是例如,我有一個依賴於API的項目,並且該API在其回購版中始終在相同版本下發布更新的二進制文件。所有的二進制文件仍然存在,但如果我刷新它,Gradle將重新下載最新的二進制文件。我想要做的是對於我想要發佈的內容具有相同的行爲。 –