7

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.

enter image description here

How can I do it?

Note that :

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

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

enter image description here

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.

4

1 回答 1

13

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.

于 2014-12-22T21:43:48.727 回答