2015-11-23 90 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将重新下载最新的二进制文件。我想要做的是对于我想要发布的内容具有相同的行为。 –