简体   繁体   English

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

[英]Multi module android project inside a private maven repository

I have a multi module android project and currently anyone in our team can access the the modules from our private maven repository.我有一个多模块 android 项目,目前我们团队中的任何人都可以从我们的私有 Maven 存储库中访问这些模块。

We are using jFrog Artifactory hosted in aws for managing the repositories.我们正在使用托管在aws jFrog Artifactory来管理存储库。 The structure of our project is something like this我们项目的结构是这样的

app -lib1 -lib2 -lib2a -lib2b

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我想知道是否有办法使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我想知道是否有办法使 lib2a 和 lib2b 不能作为单独的模块访问,而只能在有人在他们的项目中添加父模块的依赖项时才能访问,在这种情况下是 lib2

Short answer:简短的回答:
No , you can't do it.,你不能这样做。

Long answer:长答案:
When you put an artifact in a maven repo you have the artifact files (may be an aar for your android libraries) and a pom file.当您将工件放入 Maven 存储库时,您将拥有工件文件(可能是您的 android 库的 aar)和一个 pom 文件。

The pom file describes also the transitive dependencies of the artifact. pom 文件还描述了工件的传递依赖项。
Currently you can't specify a parent dependency or a specific maven repo to be used (this one is under development).当前,您无法指定要使用的父依赖项或特定的 Maven 存储库(这个正在开发中)。

It means that a build system, for example gradle, read the dependency, download from the repos the pom file and download all transitive dependencies.这意味着构建系统,例如 gradle,读取依赖项,从 repos 下载 pom 文件并下载所有可传递的依赖项。
When you download a transitive dependency there is no way to specify if you have just downloaded the parent or if you are directly downloading it.当您下载传递依赖项时,无法指定您是刚刚下载父项还是直接下载它。

It can be available, or not available without conditions.它可以是可用的,也可以是无条件不可用的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM