我正在构建一个大型多模块 Android 库,需要将该库发布到公司内部的 Artifactory。
我应该使用旧的 maven
插件,或新的 maven-publish
插件?
注意:以上两个官方插件并不完全支持Android,所以有两个社区端口。
也很有趣 - Android 工具团队 deprecated the experimental gradle plugin这是基于 SoftwareComponent 模型 - 这是 maven-publish
插件使用的。 maven-publish
是否也被弃用了?
最佳答案
我建议您使用新的 maven publish plugin . Gradle 弃用了旧的 maven plugin使用 Gradle 1.3。据此Gradle blog post只有部分 SoftwareComponent 模型将被标记为已弃用,其余部分将被移植:
... You may therefore be wondering what is happening to the Software Model. We’re in the process of porting the configuration DSL of the native support to the current model. So the declarative nature and strong modelling language will be the same. The rule engine that was part of the Software Model will be deprecated. Everything under the model block will be ported as extensions to the current model ...
如果您想要 maven-publish
的示例,Realm-Java 使用它:https://github.com/realm/realm-java/blob/master/realm/realm-library/build.gradle
关于Android 库 : maven vs maven-publish gradle project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48469235/