如何在多项目grails / gradle构建中包含依赖jar?(How can I include a dependant jar in a multi project grails / gradl

编程入门 行业动态 更新时间:2024-10-25 12:27:54
如何在多项目grails / gradle构建中包含依赖jar?(How can I include a dependant jar in a multi project grails / gradle build?)

我的项目中有以下设置......

SOA样式项目的多项目gradle构建,使用rabbitmq和spring集成连接在一起。 包含许多grails项目以及表示服务的普通java / groovy项目。 除了每个服务项目之外,还有一个项目(jar),其中包含可以使用spring集成代理的服务的所有公共接口(和消息)。 这些项目使用gradle依赖项相互关联,然后使用gradle idea插件生成IntelliJ项目文件。

我想做的是:

在grails项目中包含接口jar,以便我可以使用spring集成来通过rabbitmq将我的调用代理到服务中。 当我运行grails应用程序时,这个接口jar已构建并包含在grails中。 当我从IntelliJ运行grails应用程序时,它会编译最新版本的接口并将它们包含在grails项目中。 当我从gradle构建整个项目时,让gradle正确地将接口jar与grails应用程序相关联。 理想情况下,我希望能够在gradle中使用依赖声明来做到这一点,但这可能是一个梦想......

我有什么选择?

在gradle中将任务添加到grails构建生命周期中以构建任何依赖的jar并将它们复制到grails lib文件夹中? 通过使用Events.groovy或类似方法将grails构建生命周期,以调用grails来构建和打包从属jar。 这将涵盖IntelliJ和命令行路由。 将接口构建为grails插件? 我已经打了折扣,因为它们也需要在非Grails项目中使用。

任何帮助/建议将不胜感激。

I have the following setup within my project...

A multi project gradle build for a SOA style project, wired together using rabbitmq and spring integration. Contains a number of grails projects as well as plain java / groovy projects to represent the services. Alongside each of the service projects are a project (jar) containing all of the public interfaces (and messages) for the service that can be proxied using spring integration. The projects are related to each other using gradle dependencies and then I generate IntelliJ projects files using the gradle idea plugin.

What I want to do is:

Include the interfaces jar in the grails project so that I can use spring integration there to proxy my calls into the services via rabbitmq. When I run the grails app have this intefaces jar built and included within grails. When I run the grails app from IntelliJ have it compile the latest version of the interfaces and include them in the grails project. When I build the entire project from gradle, have gradle correctly associate the interfaces jar with the grails app. Ideally I would love to be able to do this just using dependency declaration within gradle, but this is probably a pipe dream...

What are my options?

Add a task into the grails build lifecycle within gradle to build any dependant jars and copy them into the grails lib folder? Hook into the grails build lifecycle by using Events.groovy or similar to call out to grails to build and package the dependant jars. This would cover both the IntelliJ and command line routes. Build the interfaces as a grails plugin? I had discounted this as they also need to be used from non-grails projects.

Any help / advice would be appreciated.

最满意答案

事实证明我需要做的就是添加以下内容然后grails插件为我处理依赖项...

compile project(':dependent-project')

适用于run-app和war ...

Turns out all I needed to do was add the following and then the grails plugin deals with the dependencies for me...

compile project(':dependent-project')

Works nicely for run-app and war...

更多推荐

本文发布于:2023-08-02 08:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1372273.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多项   如何在   gradle   grails   jar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!