本文介紹了Gradle:如何將 Android 庫發(fā)布到本地存儲庫的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我有一個庫和一個使用 Gradle 和 Android Studio 的 Android 應(yīng)用.我可以將庫直接包含在項目中,如下所示
I have a library and a Android app using Gradle and Android Studio. I can include the library directly in the project as following
compile project(':library')
因為我不想和庫源代碼打成一片,所以我想把庫發(fā)布到本地存儲庫中,以便我可以用作
Because I don't want to mesh up with library source code, I want to publish the library into local repository so that I can use as
compile 'com.mygroup:library:1.0'
有什么建議嗎?
推薦答案
我剛剛找到了解決方案.在庫項目的build.gradle中,添加這個
I just found a solution. In the build.gradle of the library project, add this
apply plugin: 'maven'
group = 'com.mygroup'
version = '1.0'
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://[your local maven path here]")
// or repository(url: mavenLocal().getUrl())
}
}
}
在項目文件夾中,輸入以下命令
In the project folder, type following command
gradle uploadArchives
閱讀發(fā)布工件了解更多信息
這篇關(guān)于Gradle:如何將 Android 庫發(fā)布到本地存儲庫的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!