2015-05-21 62 views
3

我有一個Android圖書館,我想在bintray上發佈。使用gradle-bintray-plugin發佈於bintray

到目前爲止好,我現在用的是gradle這個-bintray-插件1.2具有以下配置:

bintray { 
    user = properties.getProperty("bintray.user") 
    key = properties.getProperty("bintray.apikey") 

    configurations = ['archives'] 
    pkg { 
     repo = "android" // thats how my maven repository is called on bintray 
     name = "mylibrary" 
     websiteUrl = "https://somewebsite" // replaced this, since the project should not matter 
     issueTrackerUrl = 'some issuetracker url' 
     vcsUrl = "some repository" 
     licenses = ["Apache-2.0"] 
     publish = true 
     version { 
      // the 2 functions here, are building the version number 
      name = versionNameBuild() // i.e. 1.0.0-SomeName 
      vcsTag = versionName() // 1.0.0 
      gpg { 
       // keys are uploaded 
       sign = true 
      } 
     } 
    } 
} 

我碰到了,是我上傳的庫後的版本號是「第一個問題未指定」。這意味着文件已成功上傳,但它被稱爲smth。如「未指定的圖書館.aar」。我發現我必須在gradle中額外指定項目版本號。

這樣的:

project.version = "1.0.1" 

之後,這是工作的罰款。現在,我只有2個問題留給:

我希望我的文件上傳這樣的:

$BINTRAYUSERNAME/$REPONAME/$PACKAGENAME/$VERSION/*.aar 

但它們實際上是上傳到水木清華這樣的:

$BINTRAYUSERNAME/$REPONAME/$PROJECT_FOLDERNAME_OF_ANDROID_STUDIO/$SUBDIRECTORY_OF_THE_LIBRARY/$VERSION/*.aar 

我可以改變不知怎的,這個「路徑」?有關係嗎?

這導致我到我的下一個問題。 如何指定maven組類型?我的意思是這是一個Maven存儲庫嗎?所以我應該能夠設置它?這可能與我的第一個問題有關嗎?

回答

2

我可以改變這個「路徑」嗎?有關係嗎?

是的,是的。只要我使用組變量,這條路就改變了:

group = "my.awesome.group" 

這也解決了第二個問題。上傳文件的路徑是:

$BINTRAYUSERNAME/$REPONAME/$PACKAGENAME/$GROUPPATH/$VERSION/*.aar 

我推薦使用Android的庫example script