2013-11-21 183 views
9

我已經配置搖籃使用new Maven Publisher Plugin發佈項目神器,可惜的是這個插件有問題的產生pom.xml依賴 - 依賴具有範圍runtime,而不是compile神器bintray(Maven倉庫)

我的配置是這樣的:

apply plugin: 'maven-publish' 

publishing { 
    publications { 
     mavenCustom(MavenPublication) { 
      from components.java 
     } 
    } 
    repositories { 
     maven { 
      url "https://api.bintray.com/maven/codearte/public/fairyland" 
      credentials { 
       username = bintrayUser 
       password = bintrayKey 
      } 
     } 
    } 
} 

出版很簡單的一個命令:

gradle publish 

如何在舊的(工作)的方式實現這一目標?項目發佈時是否可以自動化項目計劃?

回答

6

好吧,我想通了:

apply plugin: 'maven' 

uploadArchives { 
    repositories { 
     mavenDeployer { 
      name = 'Codearte Public Repository' 
      repository(id: 'codearte-repository', url: 'https://api.bintray.com/maven/codearte/public/fairyland'){ 
       authentication(userName: bintrayUser, password: bintrayKey) 
     } 
    } 
} 

上傳使用命令:

gradle uploadArchives 
+4

也想建議你好好看看[bintray gradle這個插件(HTTPS: //bintray.com/jfrog/jfrog-jars/grad LE-bintray-插件)。它使發佈到Bintray變得更容易。 – JBaruch

3

所有POM依賴性都具有runtime範圍的事實是新的孵化maven-publish插件的已知限制。在此問題得到解決之前,您可以使用publication.pom.withXml鉤子自行解決問題,或者回退到maven插件。這兩個插件均記錄在Gradle User Guide中。

標記是一個完全不同的問題。您可以使用第三方Gradle SCM插件之一或調用命令行工具(例如使用Exec任務)。

+2

你能展現pom.withXml的個例? – BrunoJCM

+2

在我看來,新的gradle'maven-plugin'不再是新的,但問題依然存在。 – MariuszS

+4

這個「新的孵化」插件是否會完成? –