Recompile modified classes

How can I recompile modified classes only, when they are modified ? Is there a plugin to do this ?

I am running a webapp with tomcat plugin, and trying to fit JRebel in the picture. I like to see changes to code takes effect, by recompiling class and put them where the embedded can reload them.

Incremental compilation is based on Ant’s depend task and can be turned on with compile.options.useDepend = true. Further options can be set via compile.options.dependOptions (see groovydoc:org.gradle.api.tasks.compile.DependOptions).

I added this to my build.gradle:

compileJava {
    useDepend = true
  classes {
    useDepend = true

I am using tomcat plugin, and invoking it with “gradle tomcatRun”. Changes to the classes are not reflected under build/classes/main

Is there something else I am missing ?

It’s ‘compileJava.options.useDepend = true’.

I just tried it with the given option. Can you please kindly list the steps to achieve incremental build using the tomcat plugin, and recompile modified classes ?

I’m not familiar with the Tomcat plugin. My answer was about incremental compilation in Gradle in general.

ok, sounds good. Since tomcat plugin invokes “compileJava” and “classes” targets, it should work. But in my case it’s not working. I am expecting the modification of any class code, to result in recompiling the class, and regenerate the byte code in build/classes/main. Please correct me if I am wrong.