Recompile modified classes

(Mansour Al Akeel) #1

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.

(Peter Niederwieser) #2

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).

(Mansour Al Akeel) #3

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 ?

(Peter Niederwieser) #4

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

(Mansour Al Akeel) #5

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 ?

(Peter Niederwieser) #6

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

(Mansour Al Akeel) #7

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.