我用 android studio 创建了一个 android 项目。
它将生成一些 apk。
如何使用 gradle 将 apk 发布到 Maven 中心?
我可以在 apk 的工件中写什么?
apply plugin: 'maven'
apply plugin: 'signing'
configurations {
archives {
extendsFrom configurations.default
}
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
configurePOM(pom)
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: sonatypeRepositoryUrl) {
authentication(userName: nexusUsername, password: nexusPassword)
}
}
}
}
......
artifacts {
archives file: files(dir: '$buildDir/apk/*.apk', include: '*.apk')
// archives androidReleaseApklib
archives androidReleaseJar
archives androidSourcesJar
archives androidJavadocsJar
}
}