配置html
須要發佈構件的模塊 build.gradle
加入以下配置java
apply plugin: 'maven-publish' publishing { publications { mavenJava(MavenPublication) { groupId 'io.github.shaobin0604' artifactId 'gradle-plugin-replace' version '1.0.0-SNAPSHOT' from components.java // more goes in here } } repositories { mavenLocal() } }
發佈android
$ ./gradlew <Module Name>:publishToMavenLocal
如何使用git
添加本地倉庫 mavenLocal()
github
buildscript { repositories { mavenLocal() // 添加本地倉庫 jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'io.github.shaobin0604:gradle-plugin-replace:1.0.0-SNAPSHOT' // 剛纔發佈的插件 } } allprojects { repositories { mavenLocal() // 添加本地倉庫 jcenter() } }