项目作者: chrisbanes

项目描述 :
Helper将Gradle Android Artifacts上传到Maven存储库
高级语言: Groovy
项目地址: git://github.com/chrisbanes/gradle-mvn-push.git
创建时间: 2013-11-08T08:23:42Z
项目社区:https://github.com/chrisbanes/gradle-mvn-push

开源协议:Apache License 2.0

下载


gradle-mvn-push

See this blog post for more context on this ‘library’: http://chris.banes.me/2013/08/27/pushing-aars-to-maven-central/.

Usage

1. Have a working Gradle build

This is upto you.

2. Update your home gradle.properties

This will include the username and password to upload to the Maven server and so that they are kept local on your machine. The location defaults to USER_HOME/.gradle/gradle.properties.

It may also include your signing key id, password, and secret key ring file (for signed uploads). Signing is only necessary if you’re putting release builds of your project on maven central.

  1. NEXUS_USERNAME=chrisbanes
  2. NEXUS_PASSWORD=g00dtry
  3. signing.keyId=ABCDEF12
  4. signing.password=n1c3try
  5. signing.secretKeyRingFile=~/.gnupg/secring.gpg

3. Create project root gradle.properties

You may already have this file, in which case just edit the original. This file should contain the POM values which are common to all of your sub-project (if you have any). For instance, here’s ActionBar-PullToRefresh’s:

  1. VERSION_NAME=0.9.2-SNAPSHOT
  2. VERSION_CODE=92
  3. GROUP=com.github.chrisbanes.actionbarpulltorefresh
  4. POM_DESCRIPTION=A modern implementation of the pull-to-refresh for Android
  5. POM_URL=https://github.com/chrisbanes/ActionBar-PullToRefresh
  6. POM_SCM_URL=https://github.com/chrisbanes/ActionBar-PullToRefresh
  7. POM_SCM_CONNECTION=scm:git@github.com:chrisbanes/ActionBar-PullToRefresh.git
  8. POM_SCM_DEV_CONNECTION=scm:git@github.com:chrisbanes/ActionBar-PullToRefresh.git
  9. POM_LICENCE_NAME=The Apache Software License, Version 2.0
  10. POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
  11. POM_LICENCE_DIST=repo
  12. POM_DEVELOPER_ID=chrisbanes
  13. POM_DEVELOPER_NAME=Chris Banes

The VERSION_NAME value is important. If it contains the keyword SNAPSHOT then the build will upload to the snapshot server, if not then to the release server.

4. Create gradle.properties in each sub-project

The values in this file are specific to the sub-project (and override those in the root gradle.properties). In this example, this is just the name, artifactId and packaging type:

  1. POM_NAME=ActionBar-PullToRefresh Library
  2. POM_ARTIFACT_ID=library
  3. POM_PACKAGING=aar

5. Call the script from each sub-modules build.gradle

Add the following at the end of each build.gradle that you wish to upload:

  1. apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'

6. Build and Push

You can now build and push:

  1. $ gradle clean build uploadArchives

Other Properties

There are other properties which can be set:

  1. RELEASE_REPOSITORY_URL (defaults to Maven Central's staging server)
  2. SNAPSHOT_REPOSITORY_URL (defaults to Maven Central's snapshot server)

License

  1. Copyright 2013 Chris Banes
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.