Building war with Gradle, Debugging with IntelliJ IDEA

时间秒杀一切 提交于 2019-12-03 14:35:57

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/27610259/building-war-with-gradle-debugging-with-intellij-idea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!