在使用Gradle(v 1.7)作为构建工具的Android库上工作时,我使用了maven插件并配置了任务uploadArchives,以将lib的发布和调试版本发布到本地maven存储库.
以下代码可以正常工作:
// [...]
apply plugin: 'android-library'
// [...] nothing unusual
/*
* Define name of the apk output file (build/apk/<outputFile>)
*/
android.libraryVariants.all
{
variant ->
def outputName = "MyModule-${android.defaultConfig.versionName}-${variant.baseName}.aar"
variant.outputFile = new File("$buildDir/libs", outputName)
}
/*
* Publish to maven local repo (older style maven plugin)
* Used while android plugin is not fixed regarding maven-publish plugin
*
* type command "gradle uploadArchives" to publish the module into the
* local .m2 repository
*/
apply plugin: 'maven'
android.libraryVariants.all …Run Code Online (Sandbox Code Playgroud)