【问题标题】:Splitting existing gradle dependency into multiple modules将现有的 gradle 依赖拆分为多个模块
【发布时间】:2023-03-09 08:19:01
【问题描述】:

我目前已经在 maven Central 上发布了库。该库是android库.aar项目。 问题是当前库需要拆分为多个库,同时维护当前发布的库 artifactId 以实现向后兼容性。这是我所拥有的以及我正在努力实现的示例。

当前工件 ID

compile 'com.example:my-library:1.0.0'

新的 artifactId

compile 'com.example:my-library-core:1.0.0'
compile 'com.example:my-library-deps-1:1.0.0'
compile 'com.example:my-library-deps-2:1.0.0'

compile 'com.example:my-library:1.0.0' (with deps)
--> compile 'com.example:my-library-core:1.0.0'
--> compile 'com.example:my-library-deps-1:1.0.0'
--> compile 'com.example:my-library-deps-2:1.0.0'

所以基本上这个想法是保留原始的com.example:my-library maven artifactId,它只依赖于 3 个新创建的库,以支持老客户的向后兼容性。

现在我尝试在本地创建一个没有工件且仅具有依赖项的 pom 文件,但由于某种原因,gradle 不会从依赖项中提取工件。

【问题讨论】:

    标签: android maven gradle android-library aar


    【解决方案1】:

    回答我自己的问题。

    解决方案是有一个没有类和空清单的单独模块,从而导致空的.aar 存档。这将允许您保留现有的工件 ID 以及对新模块的依赖关系。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-08
      • 2021-12-27
      • 2019-02-11
      • 1970-01-01
      • 1970-01-01
      • 2013-09-10
      • 1970-01-01
      相关资源
      最近更新 更多