Gradle脚本首先构建另一个Gradle
我不确定这是否重复,但我找不到类似的问题。
我在 MainApp 中有一个 build.gradle 文件。它依赖于另一个项目。目前看起来如下所示。
dependencies {
compile project(':TestAPI')
...
}
TestAPI 本身是另一个项目,它包含自己的 build.gradle 文件。如何使 MainApp 的 build.gradle 首先调用 TestAPI build.gradle,然后使用输出 jar 文件作为其自己的依赖项?
你可能会问我为什么要这样做。因为每个项目都是 gitlab 中的单独存储库,并且我确实有 CICD 管道,所以当我触发 MainApp 管道时,我希望它首先编译 TestAPP 管道并使用其 jar 作为依赖项,然后继续使用 MainApp 管道。
任何提示或建议都非常感谢。
I am not sure if this is duplicate but i couldnt find similar question.
I have a build.gradle file in the MainApp. which has dependencies on another project. Currently look like the below.
dependencies {
compile project(':TestAPI')
...
}
the TestAPI itself is another project, and it includes its own build.gradle file. How Can i make the MainApp's build.gradle to call the TestAPI build.gradle first and then use the output jar file as its own dependency?
You might ask why I want to do this. because each of these projects are an individual repository in the gitlab, and I do have CICD pipeline, when I trigger the MainApp pipeline, I want it to compile the TestAPP pipeline first and use its jar as dependency and then proceed with MainApp pipeline.
Any hints or suggestion is highly appreciate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@Emily Wong 尝试查看此链接
https://stackoverflow.com/a/69660601/7505687
我认为你可以使用gradle 中的多模块并构建
MainApp
,gradle 会自然地构建并包含TestAPI
模块。注意:检查
MainApp
是否将所有依赖项包含到最终 jar 中(gradle 模块和其他实现依赖项),例如。如果您需要创建一个包含所有依赖项的
MainApp.jar
作为 fatJar,请尝试在MainApp/build.gradle
中添加此任务@Emily Wong try see this link
https://stackoverflow.com/a/69660601/7505687
I think you could work with multi-modules in gradle and build
MainApp
and gradle will build and includeTestAPI
module naturally.Note: check if
MainApp
are including all dependencies into final jar ( gradle modules and other implementation dependencies )Eg. if you need create a
MainApp.jar
with all dependencies as a fatJar try to add this task inMainApp/build.gradle