- 在github创建账号,创建Repositories.
创建maven本地仓库目录
$ mkdir maven $ cd maven $ mkdir abptrcompat
在代码的build.gradle文件中加入
apply plugin: 'maven' uploadArchives { repositories.mavenDeployer { repository(url: "file:///Users/yangzhixin/maven/abptrcompat/") pom { version = '1.0.0' artifactId = 'yzx-abptrcompat' groupId = 'com.yzx' } } }
编译上传到本地仓库
$ gradle clean build uploadArchives
进入本地仓库目录 maven/abptrcompat
$ git init $ git remote add remotecompat https://github.com/yzx41099298/abptrcompat.git $ git add . $ git commit -m “abcompat-1.0.0” $ git push remotecompat master
在调用库的build.gradle中加入
repositories { maven{ url "https://github.com/yzx41099298/abptrcompat/raw/master/"} } dependencies { compile 'com.yzx:yzx-abptrcompat:1.0.0@aar' }
参考:http://downright-amazed.blogspot.com/2011/09/hosting-maven-repository-on-github-for.html