如何包装Gradle多模块弹簧启动应用程序以用于其他项目?

发布于 2025-02-13 14:04:28 字数 273 浏览 0 评论 0原文

我有一个带有多个模块的Gradle Spring Boot项目,并希望将其构建为JAR文件,以便我可以重复使用其他项目中不同模块的方法。

我在根路径的build.gradle中使用了java-library插件,并将其作为jar包装。但是,当我将其导入其他应用程序作为依赖项时,无法访问boot-inf/libs下的每个模块的JAR文件,而我称之为的方法无法找到。

有什么办法可以使每个模块可重复使用其他应用程序?

I have a gradle spring boot project with multiple modules and want to build it as a jar file so that I can reuse the methods from different modules in other projects.

I used java-library plugin in the build.gradle of the root path and packaged it as a jar. But when I imported it into my other applications as a dependency, the jar files of each module under BOOT-INF/libs are not accessible and the methods I called can't be located.

Is there any way I can make each module reusable for other applications?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅浅 2025-02-20 14:04:28

您可以将项目作为模块管理,并在导入时使用它们,

请检查以下链接:
https://stackoverflow.com/a/69660601/7505687

> @componentscan

You can manage projects as module and use them on importing

Check this link:
https://stackoverflow.com/a/69660601/7505687

If you need to share spring boot beans ammong them use @ComponentScan

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文