Android Studio
在Module的buill.gradle文件中添加插件:
apply plugin: 'maven'
定义task
uploadArchives{
repositories.mavenDeployer{
repository(url:"file://D://maven/android/repository/")
pom.groupId = "com.xxxxx"
pom.artifactId = "xxxx"
pom.version = "1.x.x"
}
在Terminal中,在module根目录执行task
gradlew #module#:uploadArchives
或者
gradlew uploadArchives
执行成功后即完成发布,目录为task定义的目录D://maven/android/repository/
当别的项目想要使用本地仓库的jar包时,直接在项目的build.gradle中的repositories下添加
repositories {
maven { url 'D://maven/android/repository' }
}
即可直接在依赖中声明使用
dependencies {
compile 'com.xxxxx.xxxx:1.x.x'
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)