compileScala (Scala plugin) does not check/honor whether the code is up-to-date


compileScala always runs, whether the source code has changed or not at all. I even tried setting outputs.upToDateWhen { true } and that didn’t help either, only disabling the task entirely (skipping) it works.

I do know that one option is to use zinc, but that is not always working - it is not working for me because compiler plugins don’t seem to work.

Is there a workaround other than creating the code that skips the task? I am not sure yet what side-effects that could have and hesitant to do that.

(Peter Niederwieser) #2

I’m not aware of such a problem. Note that ‘compileScala’ has many other inputs besides the source code (compile class path, Scala class path, compiler options, etc.). Can you provide a minimal self-contained example that allows to reproduce the problem? Same for Zinc and compiler plugins.


You are right. I discovered what it is. A jar that Scala code depends on is in another Gradle subproject that has a manifest configured for that jar task (i.e. jar { manifest { attributes … } }). This manifest includes build time specific info and causes the jar to never be up-to-date.

After commenting out the manifest, the issue disappeared. Eventually I handled this by setting the manifest in jar.doFirst {…} instead of during configuration as I do not want it causing this.

Not sure how to declare this issue ‘closed’.