私有 Maven 存储库中的多模块 android 项目

Multi module android project inside a private maven repository

我有一个多模块 android 项目,目前我们团队中的任何人都可以从我们的私有 Maven 存储库访问模块。

我们正在使用 aws 中托管的 jFrog Artifactory 来管理存储库。我们项目的结构是这样的

app -lib1 -lib2 -lib2a -lib2b

我想知道是否有一种方法可以使 lib2alib2b 不能作为单独的模块访问,而只能在有人在他们的项目中添加父模块的依赖项时才能访问lib2 在这种情况下

I want to know if there is a way by which lib2a and lib2b is not accessible as separate modules but only accessible when someone adds the dependency of the parent module in their project which is lib2 in this case

简答:
不行,你做不到。

长答案:
当您将工件放入 Maven 存储库时,您将拥有工件文件(可能是 android 库的 aar)和一个 pom 文件。

pom 文件还描述了工件的传递依赖性。
目前您无法指定要使用的父依赖项或特定的 Maven 存储库(正在开发中)。

这意味着构建系统,例如gradle,读取依赖项,从repos下载pom文件并下载所有传递依赖项。
当您下载传递依赖项时,无法指定您是刚刚下载了父项还是直接下载了它。

可以无条件提供,也可以不提供。