Gradle:API vs API Project()差异
我是Gradle的新手,但在Maven方面有很好的经验。 我想知道下面这两个之间有什么区别。
api project(':my-prj-1')
VS
api "com.mydomain:grpc-helper:${grpc-helperVersion}"
我可以看到,在使用项目时,我只是给出项目名称而不是文物详细信息。
因此,我什么时候或何时可以使用API项目
,与Just api
相比有什么区别。在这种情况下,与Maven有任何比较。
I am quite new to gradle but have good experience with maven.
I am wondering what is the difference between these two below.
api project(':my-prj-1')
vs
api "com.mydomain:grpc-helper:${grpc-helperVersion}"
I can see that when using project, i am giving just the project name not the artifactory details.
So when should or when can i use api project
and what is the difference compared with just api
. And in this case is there any comparison possible with Maven.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(对不起,我的英语不好)
我想您有一个名为
myprj-1
的子项目,可以构建sub-artifactcom.mydomain:grpc-helper
。API Project(':MyPrj-1')
,当您构建主项目时,子项目还将构建,其工件将在主项目中使用。 (1)作者:
api“ com.mydomain:grpc-helper:$ {grpc-helperversion}”
,主项目将仅尝试从存储库中找到工件,如果子项目不在构建还将失败。 (2)根据我的经验,我更喜欢第一种方法,因为它更安全。如果已经构建了子图片,则跳过了子项目构建(由于增量构建),因此第二种方法没有性能差异。
(Sorry for my poor English)
I suppose you have a sub-project named
my-prj-1
that can build the sub-artifactcom.mydomain:grpc-helper
.By
api project(':my-prj-1')
, when you build the main project, the sub-project will also get built and its artifact will be used in the main project. (1)By
api "com.mydomain:grpc-helper:${grpc-helperVersion}"
, the main project will try to find the artifact from the repository only, if the sub-project is not built yet, the build will fail. (2)From my experience, I would prefer the first approach since it a little bit safer. If the sub-artifact is already built then the sub-project build is skipped (due to incremental build) so there are no performance differences from the second approach.