用Gradle构建战争,用IntelliJ IDEA进行调试 [英] Building war with Gradle, Debugging with IntelliJ IDEA

查看:135
本文介绍了用Gradle构建战争,用IntelliJ IDEA进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IntelliJ IDEA中开发了JavaEE webapp项目(名为ProjectA)。它具有应用war插件的 build.gradle 文件:

  apply plugin:'war'

我想调试(或运行) gradle生成的war文件,而不是调试 auto生成的intellij工件
对于我来说,能够更新在调试过程中更改的类而不需要重新启动服务器是非常重要的。


$ b



我该怎么办?


$ b $注意:


$ b $ 1)当点击gradle plugin选项卡中的刷新按钮()Intellij更新所有项目配置(例如模块依赖关系)并生成工件。我将它称为 auto generated intellij artifact



For运行它,我应该只创建新的本地Tomcat服务器配置,并将工件添加到部署选项卡。



< img src =https://i.stack.imgur.com/HGEXP.pngalt =在这里输入图片描述>



2)另外,是一些gradle任务(clean,build,war等)。我可以执行 build task war task 来生成war文件。我称之为 gradle generated war文件

解决方案

不用部署IntelliJ构建工件,您可以通过单击+按钮来部署外部源最终截图。然后,您可以导航到由Gradle构建的工件(在这种情况下,build / libs中的.war文件)。第二,您可以指示IntelliJ运行Gradle运行配置之前的任务。再次,在你的最终屏幕截图中,我将删除标记为BuildGradle ...'artifact的第二步,并添加一个步骤来运行Gradle war 任务。


I have JavaEE webapp project(named ProjectA) developed in IntelliJ IDEA.It has build.gradle file that applies war plugin :

apply plugin: 'war'

I want to debug(or run) gradle generated war file instead of debugging auto generated intellij artifact. It's very important for me that I can update classes changed during debugging without need to restart server.

How can I do it?

Note that :

1) When click refresh button in gradle plugin tab () Intellij updates all project configurations(for example module dependencies) and generate artifacts.I called it auto generated intellij artifact.

For run it,I should only create new local Tomcat Server configuration and add artifact to deployment tab.

2) In addition,there is some gradle tasks(clean,build,war and etc).I can execute build task or war task to generate war file.I called it gradle generated war file.

解决方案

Instead of deploying the IntelliJ build artifact, you can deploy an "External source" by clicking the "+" button in your final screenshot. You can then navigate to the artifact built by Gradle (in this case, the .war file in build/libs).

Second, you can instruct IntelliJ to run a Gradle task before running the configuration. Again, in your final screenshot, I would remove the second step labeled "Build 'Gradle ...' artifact" and add a step to run the Gradle war task.

这篇关于用Gradle构建战争,用IntelliJ IDEA进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆