IntelliJ with Tomcat and Gradle using Gretty plugin

by GarciaPL on Thursday 27 April 2017

This time I would like to describe briefly how to enable Tomcat in debug & class reload mode on IntelliJ when project is built using Gradle using this time Gretty plugin [1].

1) Add below line to build.gradle after applied war plugin

apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'

2) At the end of build.gradle add also below statement which allows us to reload classes in container in the fly after change made by you in IntelliJ

gretty {
    managedClassReload = true
}

3) Add Remote item in IntelliJ [3]

4) Run project using below command line

gradle tomcatStartDebug --info

5) Pickup Remote item in IntelliJ and run it in debug mode

6) Place breakpoints and run the code to catch them


Reference :
[1] https://github.com/akhikhl/gretty
[2] Hot deployment in Gretty
[3] Adding Remote item in IntelliJ